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

Open 💬 4 comments Opened Jun 4, 2026 by bash0816

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

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗