Failed to launch the browser process... No usable sandbox error [SOLVED]
Hopefully documenting this issue helps someone else find and fix this potential failure...
Steps to reproduce
-
Running on Debian Testing, updated within the past week
-
Clone this repo (or alternatively install via
npm i -g pagedjs-cli
)git clone https://gitlab.pagedmedia.org/tools/pagedjs-cli.git
-
Attempt to convert the text sample test html into a pdf (or alternatively run
pagedjs-cli some.html -o some.pdf
)$ ./bin/paged test/samples/text.html -o test/samples/text.pdf ◷ Loading: test/samples/text.html(node:55163) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! [0614/105223.716406:FATAL:zygote_host_impl_linux.cc(116)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox. #0 0x558307509219 base::debug::CollectStackTrace() #1 0x55830746d363 base::debug::StackTrace::StackTrace() #2 0x55830747f195 logging::LogMessage::~LogMessage() #3 0x558308cfb00e service_manager::ZygoteHostImpl::Init() #4 0x558307076f27 content::ContentMainRunnerImpl::Initialize() #5 0x5583070c5afa service_manager::Main() #6 0x558307075501 content::ContentMain() #7 0x5583070c48f5 headless::(anonymous namespace)::RunContentMain() #8 0x5583070c459d headless::HeadlessShellMain() #9 0x558304c39aa7 ChromeMain #10 0x7f686b344e0b __libc_start_main #11 0x558304c398ea _start Received signal 6 #0 0x558307509219 base::debug::CollectStackTrace() #1 0x55830746d363 base::debug::StackTrace::StackTrace() #2 0x558307508d61 base::debug::(anonymous namespace)::StackDumpSignalHandler() #3 0x7f686d280110 <unknown> #4 0x7f686b359781 gsignal #5 0x7f686b34355b abort #6 0x558307507b65 base::debug::BreakDebugger() #7 0x55830747f634 logging::LogMessage::~LogMessage() #8 0x558308cfb00e service_manager::ZygoteHostImpl::Init() #9 0x558307076f27 content::ContentMainRunnerImpl::Initialize() #10 0x5583070c5afa service_manager::Main() #11 0x558307075501 content::ContentMain() #12 0x5583070c48f5 headless::(anonymous namespace)::RunContentMain() #13 0x5583070c459d headless::HeadlessShellMain() #14 0x558304c39aa7 ChromeMain #15 0x7f686b344e0b __libc_start_main #16 0x558304c398ea _start r8: 0000000000000000 r9: 00007ffc4e2a4a30 r10: 0000000000000008 r11: 0000000000000246 r12: 00007ffc4e2a5cf8 r13: 00007ffc4e2a4cd0 r14: 00007ffc4e2a5d00 r15: aaaaaaaaaaaaaaaa di: 0000000000000002 si: 00007ffc4e2a4a30 bp: 00007ffc4e2a4c80 bx: 00007f6869dfbd40 dx: 0000000000000000 ax: 0000000000000000 cx: 00007f686b359781 sp: 00007ffc4e2a4a30 ip: 00007f686b359781 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000 [end of stack trace] Calling _exit(1). Core file will not be generated. TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/master/docs/troubleshooting.md at onClose (/home/nick/gitlab.pagedmedia.org/tools/pagedjs-cli/node_modules/puppeteer/lib/Launcher.js:750:14) at Interface.<anonymous> (/home/nick/gitlab.pagedmedia.org/tools/pagedjs-cli/node_modules/puppeteer/lib/Launcher.js:739:50) at Interface.emit (events.js:327:22) at Interface.close (readline.js:416:8) at Socket.onend (readline.js:194:10) at Socket.emit (events.js:327:22) at endReadableNT (_stream_readable.js:1221:12) at processTicksAndRejections (internal/process/task_queues.js:84:21) (node:55163) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:55163) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ◵ Loading: test/samples/text.html ^C
-
Ensured all Puppeteer dependencies were installed (they were all already installed)
sudo apt install -y \ ca-certificates \ fonts-liberation \ gconf-service \ libappindicator1 \ libasound2 \ libatk-bridge2.0-0 \ libatk1.0-0 \ libc6 \ libcairo2 \ libcups2 \ libdbus-1-3 \ libexpat1 \ libfontconfig1 \ libgbm1 \ libgcc1 \ libgconf-2-4 \ libgdk-pixbuf2.0-0 \ libglib2.0-0 \ libgtk-3-0 \ libnspr4 \ libnss3 \ libpango-1.0-0 \ libpangocairo-1.0-0 \ libstdc++6 \ libx11-6 \ libx11-xcb1 \ libxcb1 \ libxcomposite1 \ libxcursor1 \ libxdamage1 \ libxext6 \ libxfixes3 \ libxi6 \ libxrandr2 \ libxrender1 \ libxss1 \ libxtst6 \ lsb-release \ wget \ xdg-utils
-
Ensured user namespace cloning is enabled in the kernel configuration; see also this Stack Overflow comment/thread
$ sysctl kernel.unprivileged_userns_clone kernel.unprivileged_userns_clone = 0
This is the root cause!
Solution
sudo sysctl -w kernel.unprivileged_userns_clone=1
Confirm the configuration change
$ sysctl kernel.unprivileged_userns_clone
kernel.unprivileged_userns_clone = 1
Retry
Now it works
$ ./bin/paged test/samples/text.html -o test/samples/text.pdf
✔ Loaded
✔ Rendering 45 pages took 763.4800000014366 milliseconds.
✔ Generated
✔ Processed
✔ Saved to /home/qtfkwk/gitlab.pagedmedia.org/tools/pagedjs-cli/test/samples/text.pdf