Skip to content

Codex CLI fails on native Termux (Android) - authentication, request, and lock failures #11809

@wallentx

Description

@wallentx

What version of Codex CLI is running?

codex-cli 0.98.0

What subscription do you have?

Plus

Which model were you using?

All

What platform is your computer?

Linux 6.1.145-android14-11-gb812b232b095-ab14605088 aarch64 unknown

What terminal emulator and version are you using (if applicable)?

Termux 0.119.0-beta.3

What issue are you seeing?

Codex CLI does not function correctly on **native Termux / Android**. There are multiple related failure modes.

---

### 1) Authentication fails

Both authentication flows fail:

- **Sign in with ChatGPT**
- **Sign in with Device Code**

The failure manifests as:

`Stream disconnected before completion: error sending request for url (https://chatgpt.com/backend-api/codex/responses)`

`strace` indicates resolver-related activity and DNS traffic toward `127.0.0.1:53`. This environment does not provide a traditional `/etc/resolv.conf`, which is typical for Android.

Because authentication fails, Codex cannot complete the initial login flow on Termux.

#### Workaround

If `~/.codex/auth.json` is generated on another system and copied into Termux, authentication succeeds.
Similarly, if `auth.json` was created previously, Codex can start.

However:

Once a valid `auth.json` is present, the same request failure appears during interactive use (e.g. `codex exec "hello"` or starting a session).

So the resolver issue affects both:
- authentication
- normal request execution

---

### 2) Startup lock errors (non-fatal)

On startup, Codex emits lock-related errors consistent with file-lock operations not being supported in this environment. The errors are of the form:

`std::fs::TryLockError::Error(err)` where `err.kind() == std::io::ErrorKind::Unsupported`

Importantly:

- These errors do **not** crash the application.
- Codex continues running.
- No obvious functionality appears broken solely due to these startup lock errors.

---

### 3) Session preference does not persist when pressing `p`

When Codex prompts for permission to perform an action, it offers an option to press `p` to auto-accept for the rest of the session.

On Termux:

- Pressing `p` triggers the same lock-related failure.
- The preference does not persist.
- Codex continues prompting instead of remembering the choice.

This appears related to the unsupported lock behavior described above.\

What steps can reproduce the bug?

Authentication failure path

  1. Use Android + Termux (native Termux; no proot/chroot).
  2. Install and run Codex CLI.
  3. Attempt either:
  • "Sign in with ChatGPT"
  • "Sign in with Device Code"
  1. Observe request failure:
    Stream disconnected before completion: error sending request for url (...)

Optional:

  • Run strace and observe resolver-related calls / DNS attempts toward 127.0.0.1:53.

Interactive failure path (after auth workaround)

  1. Copy a valid ~/.codex/auth.json from another system into Termux.
  2. Run codex exec "hello" or start an interactive session.
  3. Observe the same request failure described above.

Lock persistence failure path

If you manage to work around the DNS issues - i.e. have root access and are able to make a /etc/resolv.conf:

  1. Use Android + Termux.
  2. Run Codex CLI until a permission prompt appears.
  3. Press p to auto-accept for the rest of the session.
  4. Observe lock-related error(s) and that the preference does not persist.

What is the expected behavior?

Codex CLI should function on native Termux/Android, including:

  • Successful authentication.
  • Successful request execution.
  • No lock-related errors on startup.
  • Session-level preference toggles (like “auto-accept for rest of session”) should work or degrade gracefully.

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIauthIssues related to authentication and accountsbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions