Repository navigation
fix(linux): restore Ubuntu 20.04 launch — pin node-pty glibc symbols + add glibc/libstdc++ packaging gate (#9902) - #10019
Conversation
…bols (#9902) The bundled node-pty pty.node is compiled from source in release CI on ubuntu-latest (glibc 2.39). glibc's 2.32-2.34 libpthread/libutil merge relocated openpty/forkpty (GLIBC_2.34) and pthread_sigmask (GLIBC_2.32) into libc under new symbol versions, so the from-source build bound to versions absent on Ubuntu 20.04 (glibc 2.31). The main process imports node-pty at startup, so the app crashed on launch. pty.node is the sole blocker (Electron needs GLIBC_2.25; other native modules <= 2.17). - Patch node-pty: a .symver shim pins the 3 symbols to their pre-merge version (GLIBC_2.2.5 x64 / GLIBC_2.17 arm64), and Linux-only ldflags force libutil.so.1/libpthread.so.0 back into DT_NEEDED. Guarded to Linux; macOS/Windows untouched. - Add a packaging gate (verify-linux-glibc-floor.cjs, afterPack): reads each bundled native binary's objdump -p version needs and fails the Linux build if any strong GLIBC_/GLIBCXX_/CXXABI_ node exceeds stock Ubuntu 20.04 (glibc 2.31 / GLIBCXX_3.4.28 / CXXABI_1.3.12). Catches GLIBC_ABI_DT_RELR, rejects GLIBC_PRIVATE, skips weak needs, fail-closed. - Docs + tests; the lazy sherpa-onnx speech prebuilt (GLIBCXX_3.4.29, never loaded at launch) is a documented libstdc++-floor exemption.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change establishes an Ubuntu 20.04/glibc 2.31 compatibility floor for Linux native modules. It patches node-pty symbol references and runtime error handling, adds a verifier that inspects ELF version requirements and provider dependencies, and runs that verifier during Linux Electron packaging. Unit and integration tests cover parsing, binary discovery, exemptions, failures, and successful checks. Project guidance and reference documentation describe the compatibility requirements and maintenance procedures. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e6956564-85cc-425d-88fe-5a7f0cd802f1
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (8)
.gitignoreAGENTS.mdconfig/electron-builder.config.cjsconfig/patches/[email protected]config/scripts/verify-linux-glibc-floor.cjsconfig/scripts/verify-linux-glibc-floor.test.mjsdocs/reference/headless-linux-server.mddocs/reference/linux-glibc-compatibility.md
| afterPack: async (context) => { | ||
| // Why: a Linux runner-image glibc bump silently shipped a node-pty pty.node | ||
| // requiring GLIBC_2.34, crashing the app on startup on Ubuntu 20.04 (#9902). | ||
| // Fail packaging if any bundled native binary exceeds the supported floor. | ||
| if (context.electronPlatformName === 'linux') { | ||
| verifyLinuxGlibcFloor(context.appOutDir) | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check whether prunePackagedRuntimeNodeModules can remove native binaries.
rg -n -A 20 'function prunePackagedRuntimeNodeModules' configRepository: stablyai/orca
Length of output: 1909
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== electron-builder config relevant section =="
sed -n '110,155p' config/electron-builder.config.cjs
echo
echo "== packaged runtime node modules exports/import =="
sed -n '1,30p' config/packaged-runtime-node-modules.cjs
echo "== require of packaged runtime node modules =="
rg -n "require\\(['\"]\\./packaged-runtime-node-modules\\." config/electron-builder.config.cjs config
echo
echo "== prunePackagedRuntimeNodeModules implementation and helper predicates =="
sed -n '360,445p' config/packaged-runtime-node-modules.cjs
echo "== all prune* function names =="
rg -n 'function prune|const prune|rmSync\\(|readdirSync\\(' config/packaged-runtime-node-modules.cjsRepository: stablyai/orca
Length of output: 5730
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== prunePackagedNodePty implementation and regexes =="
sed -n '1,130p' config/packaged-runtime-node-modules.cjs
echo
sed -n '300,370p' config/packaged-runtime-node-modules.cjs
echo
echo "== prunePackagedParcelWatcher implementation =="
sed -n '130,230p' config/packaged-runtime-node-modules.cjs
echo
echo "== verifyLinuxGlibcFloor implementation =="
sed -n '1,180p' config/scripts/verify-linux-glibc-floor.cjs
echo
echo "== deterministic behavior probe from source text =="
python3 - <<'PY'
from pathlib import Path
text = Path('config/packaged-runtime-node-modules.cjs').read_text()
checks = {
'prunePackagedNodePty_rmSynclinux': 'rmFileSync(join(nodeModulesDir, "node-pty", "build", "Release", "pty.node"), { force: true })' in text or 'rmSync(join(nodeModulesDir, "node-pty", "build", "Release", "pty.node"), { force: true })' in text,
'nodePtyPtyRe_matches_pty_node': 'PTY_NODE_RE)' in text and '"\\.node$"' in text,
'parcelWatcherPruneRe_matches_node': '"\\.node$" in text and 'PARCEL_WATCHER_PRECOMPiled_BIN_RE' in text
}
import re
source = Path('config/packaged-runtime-node-modules.cjs').read_text()
print('contains ptynode regex literal:', ".node$" in source and 'node-pty' in source)
print('contains prunePackagedNodePty rmSync for pty.node:', 'pty.node' in source and 'packageReleaseDir' in source and 'rmSync' in source[:source.find('function prunePackagedNodePty', source.find('function prunePackagedNodePty')))
PYRepository: stablyai/orca
Length of output: 17988
Run the Linux glibc floor check after runtime node-module pruning.
afterPack currently checks context.appOutDir before prunePackagedRuntimeNodeModules(resourcesDir, ...); on Linux this scans prebuild subdirs and non-local optional addon packages that are later removed by pruning (@parcel/watcher-*, unrelated node-pty prebuilds/*, Windows-only third_party/conpty/deps/winpty). Move this call to run after pruning and narrow it to the Linux resourcesDir to avoid false-positive builds from binaries that won’t ship.
Harden the packaging gate (flagged in adversarial re-eval): the version-floor check alone can false-pass if the patch's forced `-l:libutil.so.1` ever silently drops — the pinned openpty@GLIBC_2.2.5 still resolves from libc's compat alias at build time, but fails to load on Ubuntu 20.04 where openpty/forkpty live only in libutil. The gate now also asserts that any binary importing openpty/forkpty keeps libutil.so.1 in DT_NEEDED. Validated on a real symver-pinned .so with libutil dropped (now fails) vs. present (passes). Documents the recommended real-host smoke-test follow-up.
…p-fails-to-launch-on-ubuntu-20.04-bu # Conflicts: # pnpm-lock.yaml
…+ add glibc/libstdc++ packaging gate (stablyai#9902) (stablyai#10019) * fix(linux): restore Ubuntu 20.04 launch by pinning node-pty glibc symbols (stablyai#9902) The bundled node-pty pty.node is compiled from source in release CI on ubuntu-latest (glibc 2.39). glibc's 2.32-2.34 libpthread/libutil merge relocated openpty/forkpty (GLIBC_2.34) and pthread_sigmask (GLIBC_2.32) into libc under new symbol versions, so the from-source build bound to versions absent on Ubuntu 20.04 (glibc 2.31). The main process imports node-pty at startup, so the app crashed on launch. pty.node is the sole blocker (Electron needs GLIBC_2.25; other native modules <= 2.17). - Patch node-pty: a .symver shim pins the 3 symbols to their pre-merge version (GLIBC_2.2.5 x64 / GLIBC_2.17 arm64), and Linux-only ldflags force libutil.so.1/libpthread.so.0 back into DT_NEEDED. Guarded to Linux; macOS/Windows untouched. - Add a packaging gate (verify-linux-glibc-floor.cjs, afterPack): reads each bundled native binary's objdump -p version needs and fails the Linux build if any strong GLIBC_/GLIBCXX_/CXXABI_ node exceeds stock Ubuntu 20.04 (glibc 2.31 / GLIBCXX_3.4.28 / CXXABI_1.3.12). Catches GLIBC_ABI_DT_RELR, rejects GLIBC_PRIVATE, skips weak needs, fail-closed. - Docs + tests; the lazy sherpa-onnx speech prebuilt (GLIBCXX_3.4.29, never loaded at launch) is a documented libstdc++-floor exemption. * fix(linux): assert DT_NEEDED provider deps in the glibc-floor gate Harden the packaging gate (flagged in adversarial re-eval): the version-floor check alone can false-pass if the patch's forced `-l:libutil.so.1` ever silently drops — the pinned openpty@GLIBC_2.2.5 still resolves from libc's compat alias at build time, but fails to load on Ubuntu 20.04 where openpty/forkpty live only in libutil. The gate now also asserts that any binary importing openpty/forkpty keeps libutil.so.1 in DT_NEEDED. Validated on a real symver-pinned .so with libutil dropped (now fails) vs. present (passes). Documents the recommended real-host smoke-test follow-up.
Summary
Fixes #9902 — the Linux app crashed on startup on Ubuntu 20.04 (and any glibc < 2.34).
The bundled
node-ptypty.nodeis compiled from source in release CI on GitHub'subuntu-latestrunner (now glibc 2.39). glibc's 2.32–2.34 libpthread/libutil merge relocated three long-stable functions intolibcunder new symbol versions, and the from-source build bound to them:openptyGLIBC_2.34forkptyGLIBC_2.34pthread_sigmaskGLIBC_2.32Ubuntu 20.04 ships glibc 2.31, so those versions don't exist there. Orca's main process statically imports
node-ptyat startup (src/main/providers/local-pty-provider.ts), so the native-module load throws and the app never opens a window.pty.nodeis the sole blocker — Electron itself needs only GLIBC_2.25 and every other bundled native module ≤ 2.17.Pinning the runner isn't an option:
ubuntu-20.04runners are retired andubuntu-22.04still has glibc 2.35 (> 2.34). The fix must be runner-agnostic.What changed
config/patches/[email protected]— a.symvershim insrc/unix/pty.ccpins the three symbols to their pre-merge version node (GLIBC_2.2.5on x64,GLIBC_2.17on arm64 — each arch's baseline glibc, which glibc still ships as a compat alias). Because gcc's default--as-neededthen dropslibutil/libpthreadfromDT_NEEDED(the pinned symbols resolve from libc's compat aliases at build time), thebinding.gypgains Linux-onlyldflagsforcinglibutil.so.1/libpthread.so.0back intoDT_NEEDEDso they're present on the target. Guarded to#if defined(__linux__)/OS=="linux"— macOS and Windows are untouched.config/scripts/verify-linux-glibc-floor.cjs(+afterPackwiring) — a packaging gate that reads every bundled native binary's version needs (objdump -p"Version References", underLC_ALL=C) and fails the Linux build if any strongGLIBC_/GLIBCXX_/CXXABI_node exceeds what stock Ubuntu 20.04 provides (glibc 2.31 / GLIBCXX_3.4.28 / CXXABI_1.3.12). It catches symbol-less markers (GLIBC_ABI_DT_RELR), rejectsGLIBC_PRIVATE(not a stable ABI contract), skips weak needs, and is fail-closed (throws if objdump can't read a binary). This makes a future runner/toolchain bump fail the release instead of silently shipping a broken app.Docs & tests —
docs/reference/linux-glibc-compatibility.md, an AGENTS.md pointer, the headless-server support matrix (now includes 20.04), and unit tests for the gate.The lazy speech prebuilt (
sherpa-onnx, loaded only in the STT worker — never at launch) already needsGLIBCXX_3.4.29; it's a documented exemption from the libstdc++ floor (its glibc is still gated). Speech-to-text needs libstdc++ from GCC 11+ (Ubuntu 21.10 / 22.04 LTS) — a pre-existing, out-of-scope condition that doesn't affect app launch.ELI5
Orca's terminal engine (
node-pty) is a small C++ program compiled fresh on each release. The build machine's system libraries kept getting newer, and the compiler quietly stamped "requires a 2021-era Linux" onto that program — even though nothing in it actually needed new features. On Ubuntu 20.04 (2020), Linux sees that stamp and refuses to run it, and since Orca loads the terminal engine the instant it starts, the whole app dies before showing anything.The fix tells the compiler "stamp this with the old version label instead" (the functions have existed for 20 years; only the label changed) and makes sure the old system libraries it points at are actually loaded. Then we added a tripwire to the release build: it inspects every compiled piece and refuses to publish if anything again demands a too-new Linux — so this can't silently come back.
Evidence of fix (real Ubuntu 20.04, glibc 2.31)
Reproduced — released
pty.nodeon real Ubuntu 20.04:Fixed — real
node-ptyrebuilt with the committed patch, run on real Ubuntu 20.04 via official Node, on both x86_64 and aarch64:The rebuilt
pty.node's max glibc drops from 2.34 → 2.28, the 3 symbols are pinned to@GLIBC_2.2.5(x64) /@GLIBC_2.17(arm64), andlibutil.so.1+libpthread.so.0are back inDT_NEEDED.Regression gate verified against real binaries — fails on a broken
pty.node(GLIBC_2.34), a-z pack-relative-relocsbinary (GLIBC_ABI_DT_RELR), a launch-criticalGLIBCXX_3.4.29binary, and aGLIBC_PRIVATEbinary; passes the fixed 18-binary tree (+ exempt sherpa); throws fail-closed on a corrupt ELF.macOS build re-verified (Linux-guarded changes compile to nothing off-Linux); the mac/win packaging path is unchanged.
Regressions
Zero. This restores previously-broken behavior (launch on 20.04) and adds a release-time guard. Adversarially reviewed to convergence over three rounds (independent GPT-5.6-Sol + Fable passes): all findings — DT_RELR/named-node coverage, objdump exit-status fail-closed, non-English-locale determinism, libstdc++/GLIBCXX gating,
GLIBC_PRIVATEhandling — were fixed and re-validated; the final round returned clean. macOS/Windows builds, the SSH-relay node-pty path, and the existingafterPacktest are unaffected.Made with Orca 🐋