codex exec fails on Android (Termux): "lock() not supported" in acquire_app_server_startup_lock

Open Beginner friendly
#26,277 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
android, rust

Research direction

Start in app-server-transport/src/transport/unix_socket.rs at acquire_app_server_startup_lock, then compare the existing Android guards in codex-rs/core/src/installation_id.rs and codex-rs/arg0/src/lib.rs. Done means codex exec can initialize on Android without the lock() not supported error while the startup-lock file remains open.

Written by the indexing model from the issue text.

Description

app-server bug CLI exec

Problem

When running codex exec on Android (Termux), the following error occurs at startup:

Error: failed to initialize in-process app-server client: lock() not supported

Root cause: acquire_app_server_startup_lock in
app-server-transport/src/transport/unix_socket.rs calls file.lock()
unconditionally. On Android, flock(2) is unsupported on the /data
partition (returns ENOTSUP), which surfaces as "lock() not supported".

Reproduction:

  • Environment: Android (target_os = "android"), Termux (aarch64), Node v24
  • Command: codex exec "echo hello" (inside a git repo)
  • Error: Error: failed to initialize in-process app-server client: lock() not supported

Fix

Add #[cfg(not(target_os = "android"))] before file.lock()?;:

-    file.lock()?;
+    #[cfg(not(target_os = "android"))]
+    file.lock()?;

The identical guard is already applied in two other places in this codebase:

  • codex-rs/core/src/installation_id.rs:32-33
  • codex-rs/arg0/src/lib.rs:329-330

The AppServerStartupLock struct still holds the file open for the process
lifetime (UDS path cleanup on drop). Only the advisory lock acquisition is
skipped on Android.

A branch with this fix is available at:
bash0816:fix/android-startup-lock-unix-socket

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.