Skip to content

t3 browser setup reports ready inside an Incus/LXC guest, but the host's AppArmor userns restriction still blocks Chrome's sandbox #38222

Open

Description

@cthulahoops

What happened

t3 browser setup tells me the sandbox is set up, but the interface keeps telling me to run the
command. Browser/preview tools never start.

T3 runs as a systemd user service (t3 serve --tailscale-serve) inside an unprivileged Incus
container; the client is the web app in Firefox.

Diagnosis

The guest is an unprivileged Incus container (security.nesting=true) on an Ubuntu 26.04 host;
both have kernel.apparmor_restrict_unprivileged_userns=1 and
kernel.apparmor_restrict_unprivileged_unconfined=1.

Setup wrote and loaded /etc/apparmor.d/t3-chrome-headless-shell in the guest. The profile is
attached (the browser runs with label t3-chrome-headless-shell (unconfined)), yet Chrome still
dies with "No usable sandbox": after clone(CLONE_NEWUSER) the child is denied CAP_SYS_ADMIN in
its own namespace (openat("/proc/self/setgroups", O_WRONLY) returns EACCES).

The denial comes from the host. On the host, every guest process carries the stacked label
incus-NAME_//&unconfined//&:incus-NAME_:. The host
kernel applies the userns restriction to that host-level unconfined component and stacks the
host's unprivileged_userns onto it, which denies capabilities. No profile loaded inside the guest
can change that: a confined allow all profile, an exact clone of Ubuntu's bwrap profile rules,
abi 5.0, fresh add instead of replace, and an exact-path attachment all fail identically.

Executables whose path matches a profile loaded on the host escape, because the host swaps its
own profile in for the unconfined component on exec (/usr/bin/bwrap works inside the guest;
rsyslogd in the guest shows //&rsyslogd//&). Loading T3's own profile text on the host fixed it
immediately, with Chrome's sandbox still on.

What T3 gets wrong on 0.1.7 (and main):

  • PreviewBrowserHost.sandboxBlocked only checks that the profile file exists, so setup prints
    "This host is ready for T3's browser" while the browser cannot start. Verifying by launching
    the browser (or probing unshare -U + uid_map) would catch this.
  • PreviewBrowserSandboxError tells the user to run setup "on the host"; in a container that means
    the Incus/LXC host, which the message does not say. When systemd-detect-virt -c reports lxc,
    setup could say the profile must be loaded on the host and print its text.

Steps to reproduce

  1. Ubuntu 24.04+ host with kernel.apparmor_restrict_unprivileged_userns=1, Incus (6.0.5 here), an
    unprivileged Ubuntu container with security.nesting=true.
  2. In the guest, run t3 serve as a normal user and use any browser/preview tool in a thread.
    Server logs PreviewBrowserSandboxError and the UI asks to run sudo env "PATH=$PATH" t3 browser
    setup.
  3. Run that in the guest. It writes and loads the profile and prints "Allowed Chrome's sandbox
    for T3's browser."; running it again prints "This host is ready for T3's browser."
  4. Retry the preview: same error.
    ~/.t3/tools/chrome-headless-shell/linux64//chrome-headless-shell --headless --dump-dom
    about:blank prints "No usable sandbox!".
  5. Copy the same profile file to /etc/apparmor.d/ on the host and apparmor_parser -r it: the
    browser starts.

Version

0.1.7 (server in the guest, systemd user service; t3 triage CLI also 0.1.7)

Environment

Guest: Ubuntu 26.04.1 in unprivileged Incus 6.0.5 container (security.nesting=true), kernel 7.0.0-38-generic, AppArmor 5.0.2, Node 26, Firefox web client. Host: Ubuntu 26.04.1, Incus 6.0.5, AppArmor 5.0.2.

Evidence

# guest: server journal, repeated on every preview attempt
  WARN: This host blocks the sandbox T3's browser runs in (AppArmor on Ubuntu 23.10+). Run `sudo
  env "PATH=$PATH" t3 browser setup --base-dir ~/.t3` on the host once to allow it, then try again.
    cause: { _tag: 'PreviewBrowserSandboxError' }
  # guest: strace of chrome-headless-shell (profile loaded and attached)
  [pid 34795] clone(child_stack=..., flags=CLONE_NEWUSER|SIGCHLD) = 34797
  [pid 34797] openat(AT_FDCWD, "/proc/self/setgroups", O_WRONLY) = -1 EACCES (Permission denied)
  [pid 34795] write(2, "[...FATAL:content/browser/zygote_host/zygote_host_impl_linux.cc:130] No
  usable sandbox! ..."
  # host: dmesg
  audit: type=1400 apparmor="DENIED" operation="capable" class="cap" profile="unprivileged_userns"
  comm="chrome-headless" capability=21 capname="sys_admin"
  # host: label of the guest's t3 server process
  incus-agent_NAME_</var/lib/incus>//&unconfined//&:incus-agent_NAME_<var-lib-incus>:unconfined
  (enforce)

Related issues

#36490 and #32282 handle a profile on disk but not loaded; here it is loaded and attached. #27136 is LXC but a different symptom. #18938 is the root case.

Fix applied or workaround

Loaded T3's unchanged profile text at
/etc/apparmor.d/t3-chrome-headless-shell on the Incus host (apparmor_parser -r). The guest's
browser then starts with the sandbox on. Alternative without host access:
Environment=T3CODE_SERVER_BROWSER_SANDBOX=0 in the guest's t3 service.

Filed by

Claude Fable 5.1 (claude-fable-5-1) in Claude Code, via t3 triage

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions