Skip to content

fix(browser): inject --no-sandbox for root and AppArmor userns restrictions#19747

Merged
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a
May 4, 2026
Merged

fix(browser): inject --no-sandbox for root and AppArmor userns restrictions#19747
teknium1 merged 1 commit into
mainfrom
hermes/hermes-8c54fd4a

Conversation

@teknium1

@teknium1 teknium1 commented May 4, 2026

Copy link
Copy Markdown
Contributor

Salvage of #15771 by @ygd58 — core browser fix only.

Summary

On VPS/Docker deployments and some Ubuntu 23.10+ hosts, Chromium refuses to start without --no-sandbox:

  • uid=0 (root): hard requirement, common on Hetzner/DigitalOcean/Docker
  • AppArmor apparmor_restrict_unprivileged_userns=1: Ubuntu 23.10+ also restricts non-root users under systemd or unprivileged containers

Detect both conditions and inject AGENT_BROWSER_CHROME_FLAGS="--no-sandbox --disable-dev-shm-usage" when the user hasn't already set the flags themselves. Without this fix, browser_navigate hangs until the command timeout fires (~30s) before surfacing an obscure error.

Adaptation during salvage

The original PR also added a Playwright MCP preset with matching root-safe flags. That's a net-new feature surface, not a bug fix, so it was dropped from this salvage — the underlying browser fix stands on its own and helps every agent-browser user on affected systems.

Changes

  • tools/browser_tool.py: root + AppArmor userns detection, inject CHROME_FLAGS when needed (+28/-0)

Validation

Pre-existing failures in test_browser_chromium_check.py on main are unrelated to this change (same failures with or without it).

Original PR: #15771
Fixes: #15765

…ctions

On VPS/Docker and some Ubuntu 23.10+ hosts, Chromium refuses to start
without --no-sandbox:
  - uid=0 (root): hard requirement (VPS/Docker deployments)
  - AppArmor apparmor_restrict_unprivileged_userns=1 (Ubuntu 23.10+):
    non-root too, under systemd or unprivileged containers

Detect both conditions and inject AGENT_BROWSER_CHROME_FLAGS with
--no-sandbox --disable-dev-shm-usage when the user hasn't already
set the flags themselves.

Salvage of #15771 — only the browser_tool.py fix is cherry-picked.
The PR's accompanying MCP preset addition (new feature surface)
was dropped so the bug fix can land independently.

Co-authored-by: ygd58 <buraysandro9@gmail.com>
@teknium1 teknium1 merged commit 74c1b94 into main May 4, 2026
7 of 10 checks passed
@teknium1 teknium1 deleted the hermes/hermes-8c54fd4a branch May 4, 2026 12:27
@alt-glitch alt-glitch added type/bug Something isn't working tool/browser Browser automation (CDP, Playwright) P2 Medium — degraded but workaround exists labels May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browser automation fails on Linux root/VPS: needs --no-sandbox and chromium channel auto-detection

3 participants