Remote server update fails on Linux when node-pty must compile (no linux-x64 prebuild; opaque error)
Summary
Remote/boot-service self-update can fail on Linux while preparing a pinned t3@<version> runtime because node-pty has no linux-x64 prebuild and the native rebuild fails. The desktop/UI only shows:
Server update failed: Could not prepare [email protected].
The underlying npm/node-gyp error is not surfaced, so operators have to dig through server npm debug logs and effect traces.
Environment
- Host: Ubuntu 24.04 (Linux x64)
- T3 server mode: boot-service / headless (
t3 service,T3CODE_HOMEpinned runtimes underruntime/versions/) - From version:
0.0.32 - Target version:
0.0.33 - Node: v22.23.1
- System compiler:
g++→ g++-13 (nog++-11package installed)
What happens
- Client requests remote update to exact version
0.0.33. - Server runs
ensurePinnedRuntimeInstalled→npm install --prefix <staging> --no-fund --no-audit [email protected]. - Install pulls
[email protected]. node-ptyinstall script:node scripts/prebuild.js || node-gyp rebuild.- Prebuild check: no
prebuilds/linux-x64in the published package (only darwin/win32 prebuilds present). - Rebuild fails. In our case the make step looked for
g++-11and exited 127. - npm exits 1 →
PinnedRuntimeInstallError→ UI:Could not prepare [email protected].
Relevant packaging observation on [email protected] tarball contents: prebuilds exist for darwin-arm64, darwin-x64, win32-arm64, win32-x64 only.
Expected
- Linux installs should not require a local C++ toolchain for a normal server update (ship
linux-x64prebuilds fornode-pty, or vendor a prebuilt binary for the supported Node ABI). - If native compile still fails, the remote update error should include the actionable cause (e.g. missing compiler / node-gyp stderr tail), not only
Could not prepare t3@X.
Workaround that unblocked us
# stage with explicit compiler
CXX=g++ CC=gcc npm install --prefix ~/.t3/runtime/versions/.staging-... --no-fund --no-audit [email protected]
# then t3 service update / normal activation
# prevent recurrence on the user service
# ~/.config/systemd/user/t3code.service.d/40-native-build.conf
# [Service]
# Environment=CXX=g++
# Environment=CC=gcc
Why this matters
Headless / remote Linux boxes are a first-class T3 deployment path (t3 service, Tailscale, mobile/desktop remote control). Forcing an opaque native compile on every server version bump makes remote updates fragile and hard to support.
Nice-to-haves
- Document remote-update prerequisites (Node version, compiler, disk) if native build remains required on some platforms.
- Consider caching successful
node-ptybuilds across staged versions on the same Node ABI to avoid rebuild thrash.
Happy to provide redacted npm debug log excerpts if useful.
Confirmed another instance of this failure through t3 triage, with a different native-build trigger and an exact actionable cause.
Environment
- Server:
t3code.servicesystemd user background service - Server version:
[email protected] - Target:
[email protected] - Server host: Linux x64, Node
24.20.0 - Client: macOS nightly desktop app
0.0.38-nightly.20260831.1236 - Connection: remote through T3 Connect
Confirmed failure
Three remote-update attempts failed identically. The UI only reported:
Server update failed: Could not prepare [email protected].
The server trace recorded PinnedRuntimeInstallError with npm exit code 1. Matching npm debug logs showed [email protected] falling back to node-gyp rebuild, after which GCC failed with:
fatal error: error writing to /tmp/cc*.s: Disk quota exceeded
The actionable cause was a per-user quota on /tmp, not globally exhausted disk space:
/tmp: 15.7 GiB tmpfs mounted withusrquota- User-owned data in
/tmp: approximately 12.588 GiB, apparently at the per-user limit dfstill reported approximately 2.9 GiB globally available/homehad approximately 66 GiB free
This is easy to misdiagnose if the updater checks only filesystem-wide free space.
The current error path retains the npm exit code and stdout/stderr lengths in PinnedRuntimeInstallError, then exposes the generic Could not prepare t3@… wrapper. The useful npm stderr never reaches the remote client.
Suggested improvements
- Surface a bounded, sanitized installation diagnostic. Known failures could be classified as temporary-directory quota exceeded, filesystem out of space, missing compiler/toolchain, or permission denied. Raw npm output should remain private because it may contain paths, registry configuration, or credentials.
- Preflight the temporary directory before starting a native build, accounting for per-user quota rather than only
df/statfsfree space. - Consider running pinned-runtime installation with a private
TMPDIRunder the T3 state directory or another user-writable location with sufficient capacity. - For unclassified errors, retain the redacted fallback but direct the operator to the relevant server/npm log.
No workaround was applied during triage.
Additional data point: same failure on linux-arm64 with [email protected] (stable) — so this isn't x64-only.
- Host: Linux aarch64 (KVM VM, Ubuntu), Node
24.21.0 npx t3@latest service installsucceeded, butt3code.servicecrash-looped withNodePtyModuleLoadError: Failed to load node-pty for linux-arm64. The bundled[email protected]ships onlydarwin-*/win32-*prebuilds — nolinux-*at all.- Workaround that got the service green:
npx node-gyp rebuildinside~/.t3/runtime/versions/0.0.40/node_modules/node-pty, copybuild/Release/pty.node→prebuilds/linux-arm64/pty.node, restart the service. (This box had make/g++/python3; without a toolchain this path is a dead end, which is the core of this issue.) - Caveat: the fix lives in the per-version runtime dir, so every
service updateneeds it redone until node-pty ships Linux prebuilds (upstream microsoft/node-pty#860 → PR #857, 1.2.0 line).
+1 for shipping Linux prebuilds (or vendoring the binary) and for surfacing the node-gyp stderr instead of Could not prepare t3@X.