在Ubuntu 13.10上编译并运行Chromium源代码
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
add to bashrc :
export PATH="$PATH":/home/y0.kim/project/depot_tools
export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox
fetch --nohooks chromium --nosvn=True
git checkout master
build/install-build-deps.sh
git pull
gclient sync
ninja -C out/Debug chrome chrome_sandbox
build/update-linux-sandbox.sh
out/Debug/chrome -> Fail
out/Debug/chrome --no-sandbox -> Fail
获取源代码并编译没有问题。 但是,当我执行chrome时,我有以下错误
正常执行
:~/project2/src$ out/Debug/chrome
The setuid sandbox provides API version 1, but you need 0
Please read https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment.
[37555:37588:0616/152604:FATAL:browser_main_loop.cc(207)] <unknown>: Command line `dbus-launch --autolaunch=f271cc756e9c41e457760b8c00000496 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
#0 0x7f570456a39d base::debug::StackTrace::StackTrace()
#1 0x7f57045bc51d logging::LogMessage::~LogMessage()
#2 0x7f5707e45cef content::(anonymous namespace)::GLibLogHandler()
#3 0x7f5701c20f61 g_logv
#4 0x7f5701c21172 g_log
#5 0x7f56f5240d2a <unknown>
#6 0x7f56f5241087 <unknown>
#7 0x7f5701c19d13 g_main_context_dispatch
#8 0x7f5701c1a060 <unknown>
#9 0x7f5701c1a45a g_main_loop_run
#10 0x7f56f524098b <unknown>
#11 0x7f5701c3b9b5 <unknown>
#12 0x7f56fdfd0e9a start_thread
#13 0x7f56fc1853fd clone
Aborted (core dumped)
执行--no-sandbox
~/project2/src$ out/Debug/chrome --no-sandbox
[19653:19653:0616/152447:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
[19653:19656:0616/152447:FATAL:browser_main_loop.cc(207)] <unknown>: Command line `dbus-launch --autolaunch=f271cc756e9c41e457760b8c00000496 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n
#0 0x7f8f13bbe39d base::debug::StackTrace::StackTrace()
#1 0x7f8f13c1051d logging::LogMessage::~LogMessage()
#2 0x7f8f17499cef content::(anonymous namespace)::GLibLogHandler()
#3 0x7f8f11274f61 g_logv
#4 0x7f8f11275172 g_log
#5 0x7f8f05095d2a <unknown>
#6 0x7f8f05096087 <unknown>
#7 0x7f8f1126dd13 g_main_context_dispatch
#8 0x7f8f1126e060 <unknown>
#9 0x7f8f1126e45a g_main_loop_run
#10 0x7f8f0509598b <unknown>
#11 0x7f8f1128f9b5 <unknown>
#12 0x7f8f0d624e9a start_thread
#13 0x7f8f0b7d93fd clone
Aborted (core dumped)
:~/project2/src$ [0616/152448:ERROR:nacl_helper_linux.cc(277)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly
ninja -C out/Debug chrome chrome_sandbox
build/update-linux-sandbox.sh
~/.bashrc
是否在线下方
export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox
--no-sandbox
选项不起作用的原因是什么?任何意见都会受到高度赞赏。
杨
答案 0 :(得分:4)
此错误消息...
The setuid sandbox provides API version 1, but you need 0
...表示您的setuid二进制文件已过期,因此该程序无法启动/产生新的浏览上下文即 Chrome浏览器会话。
根据Linux SUID Sandbox Development google-chrome中的文档,需要一个SUID
帮助程序二进制文件才能在Linux上打开沙箱。在大多数情况下,您可以使用以下命令为您安装适当的沙箱:
build/update-linux-sandbox.sh
该程序将在/usr/local/sbin
中为您安装正确的沙盒,并告诉您根据需要更新.bashrc
。
但是,举例来说,可能会有一些例外,如果您的setuid
二进制文件已过期,则会收到诸如以下消息:
The setuid sandbox provides API version X, but you need Y
You are using a wrong version of the setuid binary!
在这种情况下,您需要执行以下步骤:
chrome_sandbox
而不是ninja -C xxx chrome chrome_sandbox
)时都构建ninja -C xxx chrome
构建后,执行update-linux-sandbox.sh
。
# needed if you build on NFS!
sudo cp out/Debug/chrome_sandbox /usr/local/sbin/chrome-devel-sandbox
sudo chown root:root /usr/local/sbin/chrome-devel-sandbox
sudo chmod 4755 /usr/local/sbin/chrome-devel-sandbox
最后,您必须在~/.bashrc
(或.zshenv
)中加入以下行:
export CHROME_DEVEL_SANDBOX=/usr/local/sbin/chrome-devel-sandbox
您可以在以下位置找到文档:
答案 1 :(得分:1)
我遇到了类似的问题,当我使用此标志运行chrome时,它运行良好
--disable-setuid-sandbox
答案 2 :(得分:-2)
这个问题的答案是:
使用root帐户卸载chrome。
重新启动系统。
使用普通用户登录。
打开终端,输入sudo
并运行命令以下载系统中的铬。在我的例子中,命令是:pacman -S chromium
。在其他发行版中可能会有类似apt-get chromium
的内容。