Repository navigation
fix(server): t3 browser setup no longer reports ready while Chrome's sandbox fails #38233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -141,8 +141,19 @@ const browserSetupCommand = Command.make("setup", { baseDir: baseDirFlag }).pipe | |
| : []; | ||
| const needsFonts = !(yield* fontAvailable); | ||
| const hasApt = yield* fs.exists("/usr/bin/apt-get").pipe(Effect.orElseSucceed(() => false)); | ||
| const sandboxStillBlocked = | ||
| restricted && Option.isSome(browser) && rootWarning === undefined | ||
| ? PreviewBrowserHost.sandboxFailsToStart( | ||
| browser.value, | ||
| isRoot ? env.SUDO_USER : undefined, | ||
| ) | ||
| : Effect.succeed(false); | ||
| const stillBlockedMessage = `Chrome's sandbox still cannot start, although the AppArmor profile at ${PreviewBrowserHost.APPARMOR_PROFILE_PATH} is ${isRoot ? "loaded" : "on disk"}. In a container (LXC, Incus, LXD), the container's host restricts user namespaces too: copy that profile to the container's host and load it there with \`apparmor_parser -r ${PreviewBrowserHost.APPARMOR_PROFILE_PATH}\`. Otherwise set \`T3CODE_SERVER_BROWSER_SANDBOX=0\` in the T3 server's environment and restart the server; this disables Chrome's sandbox.`; | ||
|
|
||
| if (!needsProfile && missing.length === 0 && !needsFonts) { | ||
| if (yield* sandboxStillBlocked) { | ||
| return yield* Console.log(stillBlockedMessage + reloadHint); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not append a definite guest-profile diagnosis. If the guest profile is already loaded but the container host still blocks the sandbox, this branch prints the container-host guidance. It then appends
|
||
| } | ||
| return yield* Console.log( | ||
| rootWarning ?? | ||
| (Option.isSome(browser) | ||
|
|
@@ -248,6 +259,7 @@ const browserSetupCommand = Command.make("setup", { baseDir: baseDirFlag }).pipe | |
| ); | ||
| } | ||
|
|
||
| if (yield* sandboxStillBlocked) return yield* Console.log(stillBlockedMessage); | ||
| yield* Console.log(rootWarning ?? "This host is ready for T3's browser."); | ||
| }), | ||
| ), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Respect the configured sandbox opt-out.
If a nonroot user sets
T3CODE_SERVER_BROWSER_SANDBOX=0, this guard still runs the sandboxed probe. On the affected container, setup then suppresses readiness and recommends the opt-out that is already configured. Real browser launches usechromiumSandbox: falsefor this configuration. Add!PreviewBrowserHost.sandboxDisabled(env)to the guard. Keep the probe for sandbox-enabled configurations. (raw.githubusercontent.com)