Skip to content

fix(browser): add --no-sandbox for root user on Linux/WSL2#1366

Open
furkankoykiran wants to merge 1 commit intogarrytan:mainfrom
furkankoykiran:fix/root-no-sandbox
Open

fix(browser): add --no-sandbox for root user on Linux/WSL2#1366
furkankoykiran wants to merge 1 commit intogarrytan:mainfrom
furkankoykiran:fix/root-no-sandbox

Conversation

@furkankoykiran
Copy link
Copy Markdown
Contributor

@furkankoykiran furkankoykiran commented May 7, 2026

Fixes #1364.

When running as root on Linux or WSL2, Chromium exits immediately because its sandbox can't initialize for the root user. browser-manager.ts already skips the sandbox under CI and CONTAINER, but root was missing from that check.

Change

// before
if (process.env.CI || process.env.CONTAINER) {
  launchArgs.push('--no-sandbox');
}

// after
const isRoot = typeof process.getuid === 'function' && process.getuid() === 0;
if (process.env.CI || process.env.CONTAINER || isRoot) {
  launchArgs.push('--no-sandbox');
}

The typeof process.getuid === 'function' guard keeps this safe on Windows where getuid is not defined.

Test

# Before fix (as root, WSL2)
B=~/.claude/skills/gstack/browse/dist/browse
$B goto https://example.com
# [browse] FATAL: Chromium process crashed or was killed. Server exiting.

# After fix
$B goto https://example.com
# Navigated to https://example.com (200)

View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Chromium's sandbox can't initialize when running as root on Linux,
causing an immediate exit. Extend the existing CI/CONTAINER check to
also cover this case, keeping the Windows-safe `typeof getuid` guard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux/WSL root user: /browse fails to start Chromium without CI=1 (missing --no-sandbox)

1 participant