Skip to content

fix(linux): restore Ubuntu 20.04 launch — pin node-pty glibc symbols + add glibc/libstdc++ packaging gate (#9902) - #10019

Merged
nwparker merged 3 commits into
mainfrom
nwparker/bug-linux-app-fails-to-launch-on-ubuntu-20.04-bu
Jul 23, 2026
Merged

nwparker merged 3 commits into
mainfrom
nwparker/bug-linux-app-fails-to-launch-on-ubuntu-20.04-bu

Conversation

@nwparker

@nwparker nwparker commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #9902 — the Linux app crashed on startup on Ubuntu 20.04 (and any glibc < 2.34).

The bundled node-pty pty.node is compiled from source in release CI on GitHub's ubuntu-latest runner (now glibc 2.39). glibc's 2.32–2.34 libpthread/libutil merge relocated three long-stable functions into libc under new symbol versions, and the from-source build bound to them:

symbol version source
openpty GLIBC_2.34 libutil → libc
forkpty GLIBC_2.34 libutil → libc
pthread_sigmask GLIBC_2.32 libpthread → libc

Ubuntu 20.04 ships glibc 2.31, so those versions don't exist there. Orca's main process statically imports node-pty at startup (src/main/providers/local-pty-provider.ts), so the native-module load throws and the app never opens a window. pty.node is 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.04 runners are retired and ubuntu-22.04 still has glibc 2.35 (> 2.34). The fix must be runner-agnostic.

What changed

  1. config/patches/[email protected] — a .symver shim in src/unix/pty.cc pins the three symbols to their pre-merge version node (GLIBC_2.2.5 on x64, GLIBC_2.17 on arm64 — each arch's baseline glibc, which glibc still ships as a compat alias). Because gcc's default --as-needed then drops libutil/libpthread from DT_NEEDED (the pinned symbols resolve from libc's compat aliases at build time), the binding.gyp gains Linux-only ldflags forcing libutil.so.1/libpthread.so.0 back into DT_NEEDED so they're present on the target. Guarded to #if defined(__linux__) / OS=="linux" — macOS and Windows are untouched.

  2. config/scripts/verify-linux-glibc-floor.cjs (+ afterPack wiring) — a packaging gate that reads every bundled native binary's version needs (objdump -p "Version References", under LC_ALL=C) and fails the Linux build if any strong GLIBC_/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), rejects GLIBC_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.

  3. 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 needs GLIBCXX_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.node on real Ubuntu 20.04:

Error: Failed to load native module: pty.node ...
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by .../pty.node)

Fixed — real node-pty rebuilt with the committed patch, run on real Ubuntu 20.04 via official Node, on both x86_64 and aarch64:

=== BROKEN pty.node (current CI build) ===
  Error: Failed to load native module: pty.node
=== FIXED pty.node (symver + forced-needed) ===
  spawn exit=0 data="ORCA_PTY_OK_42"      # loaded, spawned a shell, ran 6×7

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), and libutil.so.1+libpthread.so.0 are back in DT_NEEDED.

Regression gate verified against real binaries — fails on a broken pty.node (GLIBC_2.34), a -z pack-relative-relocs binary (GLIBC_ABI_DT_RELR), a launch-critical GLIBCXX_3.4.29 binary, and a GLIBC_PRIVATE binary; 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_PRIVATE handling — were fixed and re-validated; the final round returned clean. macOS/Windows builds, the SSH-relay node-pty path, and the existing afterPack test are unaffected.

Note (pre-existing, out of scope): speech-to-text (sherpa-onnx) needs libstdc++ ≥ GCC 11 (Ubuntu 21.10 / 22.04 LTS). It loads lazily and never blocks launch; documented in docs/reference/linux-glibc-compatibility.md.

Made with Orca 🐋

…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.
@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e73b2b3-733d-49b3-bd47-699d59e9292a

📥 Commits

Reviewing files that changed from the base of the PR and between 219f080 and 973772e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • config/electron-builder.config.cjs

📝 Walkthrough

Walkthrough

The 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)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the fix but is missing required template sections like Screenshots, Testing, AI Review Report, Security Audit, and Notes. Add the missing template sections: Screenshots, Testing checklist, AI Review Report, Security Audit, and Notes, and summarize validation/results for each.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the Linux startup fix, node-pty glibc pinning, and the new packaging gate.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e6956564-85cc-425d-88fe-5a7f0cd802f1

📥 Commits

Reviewing files that changed from the base of the PR and between 407d7af and 50c9f8d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • .gitignore
  • AGENTS.md
  • config/electron-builder.config.cjs
  • config/patches/[email protected]
  • config/scripts/verify-linux-glibc-floor.cjs
  • config/scripts/verify-linux-glibc-floor.test.mjs
  • docs/reference/headless-linux-server.md
  • docs/reference/linux-glibc-compatibility.md

Comment on lines 135 to +141
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)
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether prunePackagedRuntimeNodeModules can remove native binaries.
rg -n -A 20 'function prunePackagedRuntimeNodeModules' config

Repository: 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.cjs

Repository: 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')))
PY

Repository: 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.

nwparker added 2 commits July 22, 2026 18:49
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
@nwparker
nwparker merged commit a0944cc into main Jul 23, 2026
7 of 8 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…+ 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Linux app fails to launch on Ubuntu 20.04 — bundled node-pty pty.node requires GLIBC_2.34, both .deb and AppImage crash on startup

1 participant