GeezerVison is showing github.com — OpenCode binary fails to run natively on Termux / Android aarch64 (wrong interpreter + non‑PIE executable) · Issue #10504 · anomalyco/opencode
OpenCode binary fails to run natively on Termux / Android aarch64 (wrong interpreter + non‑PIE executable) #10504DescriptionDescription
Environment
- Device: Android smartphone/tablet, HUAWEI PaperMate 11.5
- OS: Android (5.0+), HarmionyOS 4.2.0
- Terminal: Termux
- Arch:
aarch64 (uname -m → aarch64)
- Install method: official install script (
curl ... | sh, binary ends up in ~/.opencode/bin/opencode)
Summary
After installing OpenCode on Termux using the official script, the Linux/aarch64 opencode binary does not start as a native Android executable.
- The binary requests a dynamic linker at
/lib/ld-linux-aarch64.so.1, which does not exist on Android/Termux.
- After manually changing the interpreter to the correct Android linker, the binary fails with
Android 5.0 and later only support position-independent executables (-fPIE), which means it was not compiled as PIE and cannot be run on modern Android at all.
Steps to reproduce
- Install Termux from F‑Droid / Play Store.
- Update packages and install diagnostic tools:
pkg update -y
pkg install -y file binutils patchelf
- Install OpenCode using the official method, for example:
curl -fsSL https://opencode.ai/install.sh | sh
- Try to run the binary:
/data/data/com.termux/files/home/.opencode/bin/opencode
- Observe the shell error:
bash: /data/data/com.termux/files/home/.opencode/bin/opencode: cannot execute: required file not found
Diagnostics
-
Check the file type:
file /data/data/com.termux/files/home/.opencode/bin/opencode
The output shows a 64‑bit ELF for aarch64, with the program interpreter set to /lib/ld-linux-aarch64.so.1 (standard on many Linux distros, but not on Android/Termux).
-
On Termux/Android, /lib/ld-linux-aarch64.so.1 does not exist.
To find the correct interpreter, I inspected a working Termux binary (bash):
readelf -l "$(which bash)" | grep "Requesting program interpreter"
This reports /system/bin/linker64 as the requested program interpreter.
-
I tried to “fix” the opencode binary by changing its interpreter:
patchelf --set-interpreter /system/bin/linker64 \
/data/data/com.termux/files/home/.opencode/bin/opencode
This successfully changes the interpreter to the Android linker used by Termux.
-
Running opencode again:
/data/data/com.termux/files/home/.opencode/bin/opencode
Now I get a different error:
"/data/data/com.termux/files/home/.opencode/bin/opencode": error: Android 5.0 and later only support position-independent executables (-fPIE).
This is the typical Android error when the ELF binary is not built as PIE. Since Android 5.0, only position‑independent executables (built with -fPIE / -pie) are allowed to run.
What I expected
I expected the official Linux/aarch64 OpenCode binary to either:
- run natively under Termux on Android (with a correct interpreter and PIE build), or
- clearly be documented as not supported for native Termux/Android, with guidance to use a different build or a proot‑based Linux environment instead.
What actually happens
- With the unmodified binary:
bash: cannot execute: required file not found due to the non‑existent /lib/ld-linux-aarch64.so.1.
- After setting the interpreter to
/system/bin/linker64: the binary exits with Android 5.0 and later only support position-independent executables (-fPIE) and cannot be started at all.
- This cannot be fixed on the user side by patching the existing ELF; it requires recompiling OpenCode with the correct flags and target.
Analysis / root cause
- The binary shipped by the installer appears to be a regular Linux ELF for
aarch64 with glibc, requesting /lib/ld-linux-aarch64.so.1 as interpreter.
- Termux runs on Android, using
/system/bin/linker64 and a different ABI, and Android ≥ 5.0 rejects non‑PIE executables.
- Even after manually fixing the interpreter path, the OpenCode binary still cannot run, because it does not satisfy Android’s requirement for position‑independent executables.
Why this deserves a dedicated fix
- There are already reports about OpenCode issues on Termux (usually when running inside a proot‑distro like Ubuntu/Debian, with freezes, TUI issues, crashes on the second run, etc.), but those are runtime problems inside a Linux userland.
- In this case, the problem is more fundamental: the official Linux/aarch64 binary is simply incompatible with the native Android ABI (wrong interpreter and non‑PIE), so it is impossible to run it directly in Termux without a full Linux environment in proot.
Suggested fix
-
Provide an official Android/Termux build for aarch64 that:
- is built as PIE (
-fPIE / -pie),
- uses the correct interpreter for Android (for example
/system/bin/linker64, depending on the target ABI),
- is tested in a real Termux environment, not only on standard Linux.
-
Alternatively (until such a build exists), update the documentation and installer to:
- explicitly state that the current Linux/aarch64 binary is not intended to run natively on Termux/Android,
- recommend using OpenCode via a proot‑distro (Ubuntu/Debian) or a remote Linux server when working from Android.
Additional info
- I can attach exact outputs of
file, readelf -l, and patchelf --print-interpreter if needed.
- I’m happy to test any experimental Android/Termux builds (aarch64) and provide feedback.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response Reacted by Murray Wood, Blade Runner , Alestrix, ixi, LY, Anderson Melara and Ue1i7on Reacted by Thybault, Shotaro Nakamura and Sundram Yadav (SirYadav) Activitygithub-actions commented on Jan 25, 2026 This issue might be a duplicate of or closely related to existing issues. Please check:
This appears to be the root cause of several related issues in #7472, #3143, #7843, #8620, and others that manifest as crashes or hangs on ARM64/aarch64 systems and Termux environments.
Feel free to ignore if this addresses a unique aspect of the Termux/Android compatibility not covered by these issues. Reacted by 'Founders' are 'found' to implement. Nsomnia commented on Feb 3, 2026 Indeed. Proot install works but only for one launch which I gotat figure out now. gitawego commented on Feb 14, 2026 cargilcm commented on Mar 4, 2026 Too bad. I can't run from proot on my device. Would love a binary that works natively in termux Nsomnia commented on Mar 4, 2026 > Too bad. I can't run from proot on my device. Would love a binary that works natively in termux
I'm playing with a node mobile version with a bit of free Kimi tokens, got glm 5 free again will maybe get back to it, see my recent pushed to repo if you want a skeleton to work from. cargilcm commented on Mar 5, 2026 I got my wires crossed and was thinking about a jailbroken setup being necessary. I usedhttps://github.com/Charlie6F/opencode_termux_alpine_aarch64/releases and that seems to work though I'm not sure what the default cloud LLM is as the agent works with no configuration so it must be prewired for some provider?! wiilwaalka commented on Mar 22, 2026
Too bad. I can't run from proot on my device. Would love a binary that works natively in termux
I'm playing with a node mobile version with a bit of free Kimi tokens, got glm 5 free again will maybe get back to it, see my recent pushed to repo if you want a skeleton to work from.
I typically use qwen coder because of it's generous free usage, but I've just installed opencode through Volta-managed npm after seeing people complaining about it. I built Volta using Cargo with my glibc-based Rust toolchain by the way, which I set up with Rustup. Thanks to the Termux glibc packages, you can run Rustup and glibc-based toolchains natively on Termux. However, I encountered an issue after installation of opencode, so I asked AI to add BUN_SELF_EXE to the opencode (JS wrapper), and it seems to be working well now. Most of the packages I use in Termux are glibc built with bionic packages runing alongside the glibc ones without conflicts because I have permanently unset LD_PRELOAD, which means I no longer need to run grun every time. I'm okay with giving up the automatic shebang translation because I now use a custom Termux shebang fixer that I made with AI.

Reacted by 'Founders' are 'found' to implement. guysoft commented on Apr 5, 2026 Hey, I did a lot of patching around and I have a working OpenCode on termux, it also has a full github ci/cd. not sure how it would ever make it to mainline, but if you want a package to install it, or build it yourself, there is one here:
https://github.com/guysoft/opencode-termux Reacted by 'Founders' are 'found' to implement. timerloggedout-spec commented on Jun 17, 2026 #709 i posted quick logs there; tracking here now too.
Termux install github-actions commented on Aug 17, 2026 To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|