Fix browser hand: add --no-sandbox when Chromium runs as root#394
Open
cryptonahue wants to merge 1 commit intoRightNow-AI:mainfrom
Open
Fix browser hand: add --no-sandbox when Chromium runs as root#394cryptonahue wants to merge 1 commit intoRightNow-AI:mainfrom
cryptonahue wants to merge 1 commit intoRightNow-AI:mainfrom
Conversation
Chromium refuses to launch without --no-sandbox when the process is running as UID 0. This causes the browser hand to fail immediately with 'Chromium exited before printing DevTools URL' on any server-based OpenFang installation that runs as root (the default install). Added is_running_as_root() which reads /proc/self/status on Linux to detect UID 0 without requiring a libc dependency, with a fallback to the HOME env var for other Unix systems. When root is detected, --no-sandbox is appended to the Chromium launch args automatically.
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
Error: Chromium exited before printing DevTools URL--no-sandbox— this is a known Chromium requirementReproduction
Chromium exited before printing DevTools URL. Is Chrome installed?Fix
Added
is_running_as_root()which detects UID 0 by reading/proc/self/status(no new dependencies needed). When running as root,--no-sandboxis automatically appended to Chromium's launch args.The root detection reads
/proc/self/statuson Linux (reliable, no deps) and falls back to checkingHOME=/rooton other Unix systems. On non-Unix platforms it always returns false.Test plan
cargo build -p openfang-runtime— compiles cleanlycargo clippy -p openfang-runtime -- -D warnings— zero warnings