fix(linux): fall back to --no-sandbox when user namespaces are restricted#1042
Open
xAlcahest wants to merge 1 commit into
Open
fix(linux): fall back to --no-sandbox when user namespaces are restricted#1042xAlcahest wants to merge 1 commit into
xAlcahest wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ubuntu 23.10+ enables
kernel.apparmor_restrict_unprivileged_userns=1by default, which denies the user namespaces Chromium's sandbox needs to any process without an AppArmor profile. Electron then falls back to the setuidchrome-sandboxhelper, which inside an AppImage FUSE mount can never be root-owned with mode 4755, so the app aborts at launch (electron/electron#41066). deb/rpm installs are unaffected becauseafter-install.shalready sets the SUID bit.The launcher script generated by
wrapLinuxBinaryinscripts/afterPack.jsnow checks at startup: ifchrome-sandboxnext to the binary is not setuid root andunshare --user --map-root-user truefails, it starts with--no-sandboxand prints a notice to stderr. This is the same probe electron-builder ships in AppRun since 26.9 (electron-userland/electron-builder#9590), which we don't get on 26.4 with the default AppImage toolset. The uid mapping in the probe matters: on Ubuntu 24.04 namespace creation succeeds but capabilities inside are denied, so a plainunshare --userreports the sandbox as usable when it isn't. This also covers tar.gz, while deb/rpm and distros with working namespaces keep the sandbox.Fixes #1033
Changes