Linux sandbox fails with `bwrap: loopback: Failed RTM_NEWADDR` even though `unshare -Urn` and manual `bwrap --unshare-net` succeed
What version of Codex CLI is running?
codex-cli 0.116.0
What subscription do you have?
business
Which model were you using?
gpt-5.4
What platform is your computer?
Linux 6.8.0-106-generic x86_64 x86_64
What terminal emulator and version are you using (if applicable)?
Konsole on Kubuntu 24.04
What issue are you seeing?
Codex sandboxed commands fail before execution begins, which makes even basic reads look blocked.
What steps can reproduce the bug?
Run:
codex --sandbox workspace-write --ask-for-approval on-request
Then any sandboxed shell command may fail immediately.
Minimal direct repro:
codex sandbox linux true
On my machine this fails with:
bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
What is the expected behavior?
codex sandbox linux true should succeed on a host where unprivileged user+network namespaces and bubblewrap loopback setup are otherwise working.
Additional information
I narrowed this down to something specific in Codex's Linux sandbox / bubblewrap invocation.
These checks succeed on the same host:
unshare -Urn true
unshare -Urn sh -c 'ip link set lo up && ip addr show lo'
bwrap --unshare-net --uid 0 --gid 0 --ro-bind / / sh -c 'ip link show lo'
But this still fails:
codex sandbox linux true
with:
bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted
Relevant environment notes:
- Initially /proc/sys/kernel/apparmor_restrict_unprivileged_userns was 1
- Setting it to 0 removed one blocker, but Codex still fails
- unshare -Urn works after that
- newuidmap / newgidmap are installed
- systemd-run --user -p PrivateNetwork=yes true succeeds
This suggests the host kernel can do the required namespace setup, but Codex's specific bwrap invocation is still failing.
bwrap --version
bubblewrap 0.9.0
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗