GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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) #10504

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
OpenCode binary fails to run natively on Termux / Android aarch64 (wrong interpreter + non‑PIE executable)#10504
Copy link
Assignees
thdxr

Description

@ivannin
ivannin
opened on Jan 25, 2026
Issue body actions

Description

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.

  1. The binary requests a dynamic linker at /lib/ld-linux-aarch64.so.1, which does not exist on Android/Termux.
  2. 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

  1. Install Termux from F‑Droid / Play Store.
  2. Update packages and install diagnostic tools:
    pkg update -y
    pkg install -y file binutils patchelf
  3. Install OpenCode using the official method, for example:
    curl -fsSL https://opencode.ai/install.sh | sh
  4. Try to run the binary:
    /data/data/com.termux/files/home/.opencode/bin/opencode
  5. Observe the shell error:
    bash: /data/data/com.termux/files/home/.opencode/bin/opencode: cannot execute: required file not found

Diagnostics

  1. 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).

  2. 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.

  3. 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.

  4. 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

  1. 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.
  2. 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)

Activity

  1. ivannin
    added
    bugSomething isn't working
    on Jan 25, 2026
  2. github-actions
    assigned
    thdxr
    on Jan 25, 2026
  3. github-actions commented on Jan 25, 2026

    @github-actions
    github-actionsBot
    on Jan 25, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of or closely related to existing issues. Please check:

    • Termux support 🙏 #961: Termux support feature request
    • YOLO script not helpful in Termux  #709: "bash: cannot execute: required file not found" error in Termux (same error message as OpenCode binary fails to run natively on Termux / Android aarch64 (wrong interpreter + non‑PIE executable) #10504)
    • OpenCode crashes with "Aborted" on Termux/Debian on second attempt, [object ErrorEvent] #7472: OpenCode crashes with "Aborted" on Termux/Debian on second attempt
    • [Regression] v1.1.21 OpenTUI fails to initialize in Termux/PRoot (ARM64): "Permission denied" on /proc/self/fd #8620: [Regression] v1.1.21 OpenTUI fails to initialize in Termux/PRoot (ARM64) - binary loading issues
    • [Bug] Opencode crashes on second run in Termux/Proot distro #3143: OpenCode crashes on second run in Termux/Proot distro
    • OpenCode freezes with black screen in Termux proot-distro Ubuntu, cannot exit with Ctrl+C #8959: OpenCode freezes with black screen in Termux proot-distro Ubuntu
    • When installing OpenCode in Debian on Termux, the first launch succeeds but the second fails. #9223: Installation/runtime issues in Debian on Termux
    • [Critical] CLI hangs on second run (Deadlock) on Linux ARM64 (Proot/Container environments) #7843: Critical deadlock on Linux ARM64 in containerized environments
    • opencode crashes with Aborted (core dumped) on NVIDIA GH200 (ARM) #1657: OpenCode crashes on NVIDIA GH200 (ARM/aarch64)
    • opencode crushes with Aborted on NVIDIA GH200 #8086: OpenCode crashes with Aborted on NVIDIA GH200 (aarch64)

    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.
  4. Nsomnia commented on Feb 3, 2026

    @Nsomnia
    Nsomnia
    on Feb 3, 2026
    More actions

    Indeed. Proot install works but only for one launch which I gotat figure out now.

  5. gitawego commented on Feb 14, 2026

    @gitawego
    gitawego
    on Feb 14, 2026
    More actions

    Same issue here

  6. cargilcm commented on Mar 4, 2026

    @cargilcm
    cargilcm
    on Mar 4, 2026
    More actions

    Too bad. I can't run from proot on my device. Would love a binary that works natively in termux

  7. Nsomnia commented on Mar 4, 2026

    @Nsomnia
    Nsomnia
    on Mar 4, 2026
    More actions

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

  8. cargilcm commented on Mar 5, 2026

    @cargilcm
    cargilcm
    on Mar 5, 2026
    More actions

    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?!

  9. wiilwaalka commented on Mar 22, 2026

    @wiilwaalka
    wiilwaalka
    on Mar 22, 2026
    More actions

    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.

    Image

    Reacted by 'Founders' are 'found' to implement.
  10. guysoft commented on Apr 5, 2026

    @guysoft
    guysoft
    on Apr 5, 2026
    More actions

    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.
  11. thdxr
    removed
    bugSomething isn't working
    on May 3, 2026
  12. timerloggedout-spec commented on Jun 17, 2026

    @timerloggedout-spec
    timerloggedout-spec
    on Jun 17, 2026
    More actions

    #709 i posted quick logs there; tracking here now too.
    Termux install

  13. github-actions commented on Aug 17, 2026

    @github-actions
    github-actionsBot
    on Aug 17, 2026 – with GitHub Actions
    Contributor
    More actions

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  14. github-actions
    closed this as not plannedon Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.