Google Chrome/Chromium:setuid 沙盒未以 root 身份运行

Google Chrome/Chromium:setuid 沙盒未以 root 身份运行

我们正在使用 Chrome/Chromium headless 进行屏幕抓取。

(突然)Chrome 拒绝启动。

strace 揭示了这个错误:

The setuid sandbox is not running as root. Common causes:
  * An unprivileged process using ptrace on it, like a debugger.
  * A parent process set prctl(PR_SET_NO_NEW_PRIVS, ...)
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
Failed to generate minidump.Illegal instruction

Google Chrome(不稳定)和 Chromium 的错误相同。

chrome-sandbox 二进制文件的文件权限应为(setid root):

grabber@mail:/opt/google/chrome$ ./google-chrome --version
Google Chrome 76.0.3809.87

grabber@mail:/opt/google/chrome$ ls -la *sandbox*
-rwsr-xr-x 1 root root 227856 Jul 28 10:19 chrome-sandbox

操作系统版本为 VERSION="16.04.6 LTS (Xenial Xerus)。

该解决方法可能会有用,--no-sandbox但我想知道还有什么可能导致(突然的)问题?

以 root 身份运行 google-chrome:

[32718:32718:0807/061610.314297:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

root@mail:~# /opt/google/chrome/google-chrome  --no-sandbox
root@mail:~# [0807/061615.230679:ERROR:nacl_helper_linux.cc(310)] NaCl helper process running without a sandbox!
Most likely you need to configure your SUID sandbox correctly

相关内容