bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted

Resolved 💬 5 comments Opened Mar 31, 2026 by Eubuleus-pl Closed Apr 7, 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.117.0

What subscription do you have?

Plus

Which model were you using?

_No response_

What platform is your computer?

Ubuntu 24.04

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

GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)

What issue are you seeing?

Problem:
The default Linux sandbox backend fails even for a trivial command:

codex sandbox linux /bin/pwd

Error:
bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted

Relevant host state:
kernel.unprivileged_userns_clone = 1
user.max_user_namespaces = 30935
kernel.apparmor_restrict_unprivileged_userns = 1

Additional checks:
unshare -Ur /bin/true -> write failed /proc/self/uid_map: Operation not permitted
unshare -n /bin/true -> unshare failed: Operation not permitted

Workaround:
Enabling the legacy Landlock backend makes the sandbox work again:

codex --enable use_legacy_landlock sandbox linux /bin/pwd

This succeeds and prints the working directory.

Expected:
Codex should work on a standard Ubuntu 24.04 install without requiring users to relax system-wide namespace/AppArmor protections, or it should
automatically fall back to the Landlock backend when bubblewrap cannot initialize.

What steps can reproduce the bug?

Uploaded thread: 019d43b5-9a1c-7db3-b2a2-b9003e446ed3

What is the expected behavior?

Codex should work on a standard Ubuntu 24.04 install without requiring users to relax system-wide namespace/AppArmor protections, or it should
automatically fall back to the Landlock backend when bubblewrap cannot initialize.

Additional information

_No response_

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 4 months ago

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

  • #15057
  • #15982
  • #15496
  • #14919
  • #15957

Powered by Codex Action

viyatb-oai contributor · 4 months ago

@Eubuleus-pl can you try installing bubblewrap (https://developers.openai.com/codex/concepts/sandboxing#prerequisites) and using 0.118.0?

weathon · 24 days ago

I asked codex to fix it, codex sait it worked if it use apply_patch outside the sandbox, and I just put it in AGENTS.md and it worked

weathon · 8 days ago

This made mine work as well: ask it to find the executable of vscode extension has a bin of apply_patch ask codex to use that