Skip to content

fix(agent): run Linux bundles on the host glibc, like Zed (#1166) - #1403

Merged
AnthonyRonning merged 2 commits into
masterfrom
codex-linux-host-glibc-maple
Oct 31, 2026
Merged

AnthonyRonning merged 2 commits into
masterfrom
codex-linux-host-glibc-maple

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes issue #1166 (Linux Agent cannot open a window when the host GPU driver needs a newer glibc).

Problem

The Linux bundle shipped Nix's glibc 2.42 and forced it with AppRun → bundled ld-linux --inhibit-cache --library-path …. GPU drivers still come from the host, so on any host whose glibc is newer than the bundled one, Mesa's libLLVM cannot load into our process. Both Vulkan and GL fail, and the window panics with Failed to create surface for any enabled backend: {}. Arch already has glibc 2.44; every distro that moves past 2.42 would hit this.

Fix: do what Zed does

Zed (same GPUI) never ships glibc or a loader. It builds against an old glibc floor, uses the host loader, and loads the graphics stack from the host, so the whole process shares one libc.

  • Build: build-release.sh uses cargo zigbuild --target x86_64-unknown-linux-gnu.2.31 on Linux. The toolchain stays pinned through the Agent flake (zig, cargo-zigbuild from the same nixpkgs). Nix libraries are passed as link-time stand-ins (-L native=…, --allow-shlib-undefined); the host's copies resolve their own glibc symbols at runtime.
  • Bundle: contains only the payload. No libraries, no gconv/NSS, no fontconfig/ALSA/XLOCALEDIR/VK_DRIVER_FILES overrides. AppRun is now a plain exec "$appdir/usr/bin/maple-agent" "$@", with a clear message when there is no glibc host loader (NixOS without nix-ld).
  • Audit (linux-release-appimage.py) enforces:
    • the payload is the only ELF;
    • its interpreter is /lib64/ld-linux-x86-64.so.2;
    • it has no RUNPATH;
    • its DT_NEEDED libraries are on an allowlist of desktop libraries (glibc, libxkbcommon(-x11), libX11, libXi, libxcb, ALSA);
    • it needs no glibc version above 2.31.
  • Host requirements (documented in the bundle README and docs/desktop-builds.md): glibc ≥ 2.31, a Vulkan or OpenGL driver, and the standard desktop libraries above. These match Zed's.
  • Error message: window-open failures from a missing or unusable GPU driver now say so and point at VK_LOADER_DEBUG=error,warn,driver.

Existing installs and the updater

Bundle format maple-agent-linux-bundle-v1 and the updater code are unchanged. Installed releases check the new archive with the same rules:

  • Archive check: they require an executable regular file at usr/lib/ld-linux-x86-64.so.2, and any regular file may be 0644 or 0755. That path is now a small shell launcher.
  • After the swap: they relaunch the new AppRun.
  • Before relaunch: they may start a bounded child as usr/lib/ld-linux-x86-64.so.2 --inhibit-cache --library-path … usr/bin/maple-agent …. The launcher accepts those options and execs only the bundle's own payload.

The updater's existing Linux fixtures already use a non-ELF placeholder at that path and no libc.so.6, and its prepare/swap/checkpoint tests pass with that shape. self_launch.rs now resolves the payload directly instead of the loader. docs/updates.md explains why the launcher must stay while old releases can still update.

Verification

Local, from a zig cross-build of this branch (glibc 2.31 target), run in an emulated x86_64 VM with Xvfb and each distro's own Mesa software Vulkan:

Host glibc master bundle this branch
Arch 2.44 ❌ exits 101: libm.so.6: version 'GLIBC_2.44' not found (required by /lib64/libLLVM.so.23.1) ✅ window opens on host llvmpipe (Vulkan)
Fedora 44 2.43 ✅ window opens ✅ window opens
Debian 12 2.36 not run ✅ window opens
Ubuntu 22.04 2.35 ⚠️ Mesa's LLVM 15 JIT aborts under the emulator's CPU model ⚠️ same abort
Ubuntu 20.04 2.31 (floor) ⚠️ Mesa 21 llvmpipe too limited for wgpu (max_color_attachments) ⚠️ same; the binary loads and runs

The ⚠️ rows behave identically on master, so they are not regressions; they reflect software rendering in this test setup, not glibc. --version and --build-info succeed on every host. The binary links only the allowlisted libraries, and its newest glibc symbol is GLIBC_2.30.

Also run:

  • the real staging, bundle and audit scripts on the real binary (Linux);
  • verify-linux-bundle-docker.sh: detached host start, signed-out ACP guard across two clients, release on stop;
  • the transition paths an old process uses into a new tree: relaunching AppRun with an inherited APPDIR, and the bounded child through the v1 loader path with the exact old argv;
  • the Python packaging suites (on Linux and macOS);
  • self_launch and the Linux update discovery tests;
  • cargo fmt and clippy (-D warnings);
  • the pre-commit just ci-lint.

CI (ci:package): agent-package-linux passed in 9m26s. It ran the real release-profile zig build in the Nix shell, then package, verify, the updater-archive validation (the same updater code installed releases run) and the Docker smoke. The CI-built bundle reports bundled_glibc: false, its newest glibc symbol is GLIBC_2.30, and it links only the allowlisted libraries; that exact artifact opens its window on Arch with glibc 2.44. verify-linux-bundle-docker.sh now installs the desktop libraries into its Ubuntu image in a build step and still runs the smoke with --network none. That lane runs only on master and with the ci:package/ci:full labels, so PR CI time is unchanged.

Not verified: a real GPU. Anthony's Omarchy box is the natural check, and the CI artifact maple-agent-dev-linux-x86_64-unsigned-41242860253 can be used for it.

🤖 Generated with Claude Code

Integration after #1401: merged current master into this branch and resolved the build-script, build-fixture and documentation overlap. Linux retains Zig/glibc2.31 and host-runtime verification; Windows retains native x64/ARM64 target selection and static PE checks. Focused packaging tests passed (91 cases, four existing platform skips), and root just lane repo passed. The full Rust pre-commit hook was not repeated for this conflict-only integration. The requester authorized merging with bypass if needed; fresh hosted checks on ab59d1f57d687c86f872a49c3eae33302ef1b841 are not claimed passed.

The Linux bundle shipped Nix's glibc 2.42 and forced its loader, but GPU
drivers come from the host. On hosts with a newer glibc (Arch 2.44), Mesa's
libLLVM could not load against the bundled libm, so both Vulkan and GL
failed and the window panicked with an empty backend set.

Build the release binary with cargo-zigbuild for glibc 2.31 and ship no
libraries: AppRun execs the payload with the host loader, which loads the
host's glibc, desktop libraries and drivers together. The audit enforces
the host loader, no runtime path, an allowlist of desktop DT_NEEDED
libraries and the glibc floor.

Bundle format v1 is unchanged. Installed updaters require an executable
usr/lib/ld-linux-x86-64.so.2, so that path is now a small launcher that
accepts the old loader options and runs only the bundle's own payload.

Window-open failures from a missing or unusable GPU driver now say so and
point at VK_LOADER_DEBUG.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AnthonyRonning AnthonyRonning added the ci:package Build unsigned packages on this PR label Oct 31, 2026
@AnthonyRonning
AnthonyRonning merged commit 5ea199d into master Oct 31, 2026
22 checks passed
@AnthonyRonning
AnthonyRonning deleted the codex-linux-host-glibc-maple branch October 31, 2026 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:package Build unsigned packages on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent Linux AppImage cannot load newer Mesa/LLVM driver requiring GLIBC_2.44

1 participant