Consider using 'bwrap' dynamically instead of a fixed "/usr/bin/bwrap" path

Resolved 💬 3 comments Opened Mar 25, 2026 by lkk160042 Closed Mar 27, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

codex-cli 0.116.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.4

What platform is your computer?

Linux (Ubuntu 22.04, x86_64)

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

bash

What issue are you seeing?

In codex-rs/linux-sandbox/src/launcher.rs , SYSTEM_BWRAP_PATH is hardcoded to /usr/bin/bwrap. As a result, even when a newer bwrap is installed at /usr/local/bin/bwrap, it is not used.

This leads to errors such as:

bwrap: Unknown option --argv0

when running sandboxed tools like apply_patch or exec_command.

It may be helpful to resolve the bwrap path dynamically instead of relying on a fixed path. For example:

const PRIMARY_SYSTEM_BWRAP_PATH: &str = "/usr/local/bin/bwrap";
const FALLBACK_SYSTEM_BWRAP_PATH: &str = "/usr/bin/bwrap";

fn system_bwrap_path() -> &'static Path {
    if Path::new(PRIMARY_SYSTEM_BWRAP_PATH).is_file() {
        Path::new(PRIMARY_SYSTEM_BWRAP_PATH)
    } else {
        Path::new(FALLBACK_SYSTEM_BWRAP_PATH)
    }
}

What steps can reproduce the bug?

bwrap: Unknown option --argv0 error occurs even with latest bwrap in /usr/local/bin path.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #15340
  • #15412
  • #15291
  • #15718

Powered by Codex Action

viyatb-oai contributor · 5 months ago

The bwrap PATH lookup fix merged in #15791 and is available in 0.117.0-alpha.25. If you're installing bwrap outside /usr/bin (for example Nix, Homebrew on Linux, or /usr/local/bin), can you try 0.117.0-alpha.25 or newer and confirm Codex picks it up from PATH?

If it still fails, please share which bwrap and codex --version.

lkk160042 · 5 months ago

Thanks @viyatb-oai