#1630·jcode

jcode update and /update install an unpatched binary on Termux (Android aarch64)

Author: luciusrockwingCreated Oct 1, 2026Updated Oct 1, 2026

On Termux, jcode update and the in-app /update install the downloaded jcode-linux-aarch64 binary without repointing its ELF interpreter at Termux's glibc loader. You get a binary that cannot exec. scripts/install.sh does this patch; the Rust updater does not.

Every Termux user who updates in-app hits this. The README lists Termux as supported, so updates being the one broken path is a surprise.

Environment

  • POCO F3, Android 13, aarch64
  • Termux, aarch64, PREFIX=/data/data/com.termux/files/usr
  • glibc 2.44 from the termux-glibc repo, patchelf present
  • jcode v0.89.3 (de65ade33), installed with curl -fsSL https://jcode.sh/install | bash

Reproduce

bash
pkg install glibc patchelf
curl -fsSL https://jcode.sh/install | bash   # succeeds, prints "Patched Termux glibc ELF interpreter"
jcode --version                              # works

jcode update                                 # or /update inside the TUI

Expected

The updater applies the same Termux ELF interpreter patch scripts/install.sh applies, so the new version launches. Installer and in-app updater should agree on Termux.

Actual

The update reports success but the installed binary keeps its stock ld-linux-aarch64.so.1 interpreter. Termux has no such path at the root, so exec fails:

cannot execute: required file not found

~/.local/bin/jcode offers no way out. It is two lines with no validation:

bash
#!/usr/bin/env bash
unset LD_PRELOAD
exec "/data/data/com.termux/files/home/.jcode/builds/stable/jcode" "$@"

If the failed update leaves stable/ pointing at the unpatched file, every entry point is dead until you run patchelf by hand. The installer also rm -fs this launcher before writing its own, so any repair you make gets thrown away on the next reinstall.

Root cause

scripts/install.sh detects Termux and patches the binary:

bash
if [ "$IS_TERMUX" = true ] && [ "$IS_WINDOWS" = false ]; then
  termux_glibc_linker="$termux_glibc_dir/ld-linux-aarch64.so.1"
  ...
  patchelf --set-interpreter "$termux_glibc_linker" "$dest_version_dir/$bin_name"

The in-app updater does not. download_and_install_blocking_with_progress() in crates/jcode-app-core/src/update.rs extracts the archive, calls set_permissions_executable, and installs into builds/versions/<version>/, with no equivalent branch. grep -ci 'termux\|patchelf' crates/jcode-app-core/src/update.rs returns 0 across all 1771 lines. Same for crates/jcode-update-core/src/lib.rs, which picks the asset name (jcode-linux-aarch64) with no platform-specific post-install handling.

The release pipeline already accommodates Termux elsewhere: jcode-linux-aarch64 is built with -Z tls-model=emulated because Android kernels implement ELF TLS Variant 1 while glibc expects Variant 2. The artifact is Termux-ready in every respect except the interpreter path, which only the shell installer fixes.

Suggested fix

Mirror the installer's Termux branch in the updater. After extraction, when running under Termux, set the interpreter to /data/data/com.termux/files/usr/glibc/lib/ld-linux-aarch64.so.1 (aarch64) or ld-linux-x86-64.so.2 (x86_64).

Two things worth folding in:

  • Validate before switching channels. The updater already knows the expected interpreter. Verifying it after install, and refusing to advance the symlinks when the binary is unusable, would also cover truncated downloads. Those leave the same dead end today.
  • Make the launcher self-validating. ~/.local/bin/jcode execs stable/jcode unconditionally. Checking that the target is an ELF with the expected interpreter would let it fall back to the previous known-good version instead of failing outright.

Workaround I am using

A wrapper at ~/.jcode/bin/jcode-launch, outside the paths any installer or updater rewrites. It validates ELF magic and the interpreter, then walks current → stable → newest valid version, running patchelf itself if needed. I mention it as a regression path, not as a substitute — Termux users should not have to maintain their own launcher.

Related issues

Searched open and closed issues for termux, android, LD_PRELOAD, ELF interpreter, aarch64, and update terms. Nothing covers this.

  • #1561 — auto-update skipped inside a git repo. Same file (update.rs), different mechanism: the updater never runs rather than installing an unusable binary.
  • #356 — installer wrapper/binary mtime ordering causing a reload loop on x86_64/WSL2. Fixed in #355; that binary runs fine.
  • #912, #909, #289, #799 — unrelated update or install-reporting issues.

No duplicate found.