puppeteer: [Bug]: "No usable sandbox!" with user namespace cloning enabled
Minimal, reproducible example
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch(); // Fails
const page = await browser.newPage();
await page.setContent('<div>test</div>');
Background
The troubleshoot page discourages --no-sandbox in favor of user namespace cloning, but I’m having trouble getting it to work.
I’m using Ubuntu 24.04 (kernel 6.8.0-38-generic).
As far as I can tell namespace cloning is enabled: sudo sysctl kernel.unprivileged_userns_clone outputs kernel.unprivileged_userns_clone = 1.
(From what I understand, Ubuntu 24.04 has implemented stronger restrictions around unprivileged user namespaces, but I can only guess at if this issue is a side-effect effect of those changes.)
Expectation
Browser launches
Reality
Am getting the following error:
file:///home/dev/puppeteer-test/node_modules/@puppeteer/browsers/lib/esm/launch.js:301
reject(new Error([
^
Error: Failed to launch the browser process!
[421602:421602:0723/183305.941550:FATAL:zygote_host_impl_linux.cc(126)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/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.
TROUBLESHOOTING: https://pptr.dev/troubleshooting
at ChildProcess.onClose (file:///home/dev/puppeteer-test/node_modules/@puppeteer/browsers/lib/esm/launch.js:301:24)
at ChildProcess.emit (node:events:529:35)
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
Node.js v18.19.1
Puppeteer configuration file (if used)
No response
Puppeteer version
22.13.1
Node version
18.19.1
Package manager
yarn
Package manager version
1.15.2
Operating system
Linux
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 17 (2 by maintainers)
Commits related to this issue
- Pin `ubuntu-22.04` instead of `ubuntu-latest` Issue: https://github.com/puppeteer/puppeteer/issues/12818, https://crbug.com/373753919 — committed to mathiasbynens/tibia-bosses by mathiasbynens 2 years ago
- Pin `ubuntu-22.04` instead of `ubuntu-latest` Issue: https://github.com/puppeteer/puppeteer/issues/12818, https://crbug.com/373753919 — committed to mathiasbynens/tibia-json by mathiasbynens 2 years ago
- Pin runners to ubuntu-22 • ubuntu-latest now points to ubuntu-24 • ubuntu 23 and onwards now restricts unprivileged user namespace using Canonical's AppArmor system and this disallows Chromium from s... — committed to sphiria/gbf-wiki-opengraph by FabulousCupcake 2 years ago
- Pin runners to ubuntu-22 • ubuntu-latest now points to ubuntu-24 • ubuntu 23 and onwards now restricts unprivileged user namespace using Canonical's AppArmor system and this disallows Chromium from s... — committed to sphiria/gbf-wiki-opengraph by FabulousCupcake 2 years ago
- test: fix "no sandbox" error in Github Actions See Puppeteer issue here: https://github.com/puppeteer/puppeteer/issues/12818 — committed to qualweb/qualweb by deleted user 2 years ago
- Pin Ubuntu due to chromium bug (via puppeteer) https://github.com/puppeteer/puppeteer/issues/12818 — committed to ember-learn/super-rentals-tutorial by kategengler 2 years ago
- Pin Ubuntu due to chromium bug (via puppeteer) https://github.com/puppeteer/puppeteer/issues/12818 — committed to ember-learn/super-rentals-tutorial by kategengler 2 years ago
- Pin Ubuntu due to chromium bug (via puppeteer) https://github.com/puppeteer/puppeteer/issues/12818 --- Commit: ember-learn/super-rentals-tutorial@9de8f5f791454f54e6bbb04422c5c6892590f084 Script: ... — committed to ember-learn/super-rentals by ember-tomster 2 years ago
- Pin Ubuntu due to chromium bug (via puppeteer) https://github.com/puppeteer/puppeteer/issues/12818 --- Commit: ember-learn/super-rentals-tutorial@9de8f5f791454f54e6bbb04422c5c6892590f084 Script: ... — committed to ember-learn/super-rentals by ember-tomster 2 years ago
- fix: temporary fix for ubuntu version problem Detailed at, https://github.com/puppeteer/puppeteer/issues/12818 — committed to OpenArchitex/Caerus by SudharakaP 2 years ago
- Update login.yml runs-on: ubuntu-22.04 https://github.com/puppeteer/puppeteer/issues/12818#issuecomment-2415915338 — committed to aurashadowsong/serv00-auto-scripts by aurashadowsong 2 years ago
- Pin reffy jobs to ubuntu-22.04 for now For puppeteer/chromium sake see https://github.com/puppeteer/puppeteer/issues/12818 — committed to w3c/webref by dontcallmedom 2 years ago
- Allow more complex ob-mermaid-cli-path * ob-mermaid.el (org-babel-execute:mermaid): Allow users to set ob-mermaid-cli-path to something more complex like "aa-exec --profile=chrome mmdc", which may be... — committed to sachac/ob-mermaid by sachac 2 years ago
- Fixing github actions See https://github.com/puppeteer/puppeteer/issues/12818#issuecomment-2593659514. — committed to 4lejandrito/next-plausible by 4lejandrito 2 years ago
- pin to ubuntu-22.04 for puppeteer/chromium sake (https://github.com/puppeteer/puppeteer/issues/12818) — committed to w3c/spec-generator by deniak 2 years ago
- Disable Ubuntu app-armor in CI to avoid Chromium/Puppeteer bug "No Usable Sandbox!" See https://github.com/puppeteer/puppeteer/issues/12818 — committed to emberjs/ember.js by kategengler 2 years ago
- Disable Ubuntu app-armor in CI to avoid Chromium/Puppeteer bug "No Usable Sandbox!" See https://github.com/puppeteer/puppeteer/issues/12818 — committed to emberjs/ember.js by kategengler 2 years ago
- Disable Ubuntu app-armor in CI to avoid Chromium/Puppeteer bug "No Usable Sandbox!" See https://github.com/puppeteer/puppeteer/issues/12818 (cherry picked from commit 9321b5917e12f0fefba89369c7efbd2... — committed to emberjs/ember.js by kategengler 2 years ago
- Disable Ubuntu app-armor in CI to avoid Chromium/Puppeteer bug "No Usable Sandbox!" See https://github.com/puppeteer/puppeteer/issues/12818 (cherry picked from commit 9321b5917e12f0fefba89369c7efbd2... — committed to emberjs/ember.js by kategengler 2 years ago
- ci: pin browser tests to ubuntu-22.04 (puppeteer/puppeteer#12818) — committed to node-influx/node-influx by bencevans 2 years ago
For GitHub Actions, I can confirm (after testing on some hobby projects) that the temporary workaround to replace
runs-on: ubuntu-latestwithruns-on: ubuntu-22.04works.Filed https://crbug.com/373753919
ubuntu-latest was pointing to 22.04 but as of today (10/15/2024) it is pointing to 24.04. I am running puppeteer in a GitHub Action and was able to see the version change in the logs.
I downgraded my action to run against 22.04 (ubuntu-latest -> ubuntu-22.04). That seems to have ‘fixed’ the error for now or at least buys some time for me to investigate and decide how to work with the changes in ubuntu.
Yes, this works, I confirm in 2025.
@lewistg I’m pretty sure you need to either install the browser to the path whitelisted in
/etc/apparmor.d/chrome, or create a new AppArmor profile with the actual install path. See also this article about the same issue regarding Firefox: https://support.mozilla.org/en-US/kb/install-firefox-linux#w_security-features-warning (the formatting of the file quoted there is broken; refer to the format of the files on your machine and described in the man page)This is how
/etc/apparmor.d/chromelooks on my Ubuntu 24.04 installation:Note that the path also allows globbing (see the linked man page).
It fails as well. The error message seems to include instructions for Ubuntu:
[2423:2423:1016/062159.567901:FATAL:zygote_host_impl_linux.cc(128)] No usable sandbox! If you are running on Ubuntu 23.10+ or another Linux distro that has disabled unprivileged user namespaces with AppArmor, see https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md. Otherwise seehttps://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the (older) SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
The issue is on the Ubuntu side. We now documented it here https://pptr.dev/troubleshooting#issues-with-apparmor-on-ubuntu You would need to configure Ubuntu to allow user namespace cloning to make it work with Ubuntu versions that have this restriction.
Re-opening as requested. I’ll let the puppeteer maintainers re-close as they see fit
@lewistg can you reopen this issue while sandbox-problem won’t be fixed on
ubuntu-latest/Ubuntu 24.04?I solved this editing file etc/apparmor.d/unprivileged_userns
profile unprivileged_userns { #audit deny capability, <-- commented
and adding capability sys_admin, capability sys_chroot, capability sys_ptrace, capability ipc_lock, capability sys_resource,
Opened a PR to test with 24.04 https://github.com/puppeteer/puppeteer/pull/13196