Skip to content

apply_patch and managed sandbox fail with Bubblewrap loopback/userns errors on Ubuntu 24.04 #29908

Description

@legka

Summary

apply_patch and ordinary managed sandbox commands fail before the requested command can run. The failure appears to come from Bubblewrap sandbox setup, not from repository file permissions.

Environment

  • OS: Ubuntu 24.04
  • Kernel: 6.17.0-35-generic
  • Bubblewrap: 0.9.0
  • kernel.unprivileged_userns_clone = 1
  • kernel.apparmor_restrict_unprivileged_userns = 1
  • /usr/bin/bwrap is a normal executable, not setuid, with no file capabilities

No local usernames, workspace paths, repository paths, or secrets are included in this report.

Observed behavior

apply_patch fails before it can read a file in the configured writable workspace. The same sandbox failure can also occur for simple sandboxed commands such as id, uname, or which bwrap.

Error from apply_patch:

fs sandbox helper failed with status exit status: 1:
bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted

Minimal diagnostics

Outside the managed sandbox, Bubblewrap itself is present:

bubblewrap 0.9.0

Minimal Bubblewrap tests fail:

bwrap --ro-bind / / true
# bwrap: setting up uid map: Permission denied

bwrap --unshare-net --ro-bind / / true
# bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted

Expected behavior

apply_patch should be able to edit files under the configured writable workspace root, or Codex should provide a supported fallback edit path that still enforces workspace-write restrictions without requiring host-wide security changes.

Actual behavior

The file-edit path is unusable because the sandbox helper depends on Bubblewrap/user namespace/network namespace behavior blocked by the host security configuration.

Request

Please make the apply_patch / managed sandbox path robust on Ubuntu systems with AppArmor unprivileged user namespace restrictions, or provide a supported fallback that does not require changing host-wide sysctl/security settings.

Applied devbox recurrence — July 6, 2026

A Codex user on Applied devboxes reported that both apply_patch and general command execution became blocked after the local Bubblewrap sandbox could not read /proc/sys/kernel/overflowuid; /proc/sys/crypto/fips_enabled also returned an unexpected error. Codex escalated or used in-place editing fallbacks. Restarting the devbox restored operation, suggesting an unhealthy or disconnected proc mount rather than repository permissions.

Source: https://openai.enterprise.slack.com/archives/C08MGJXUCUQ/p1783397892149239

This is the same user-visible failure family—managed commands and apply_patch fail before the requested operation—but a different host-level trigger from the original loopback/user-namespace reproduction. Diagnostics should capture the Codex/CLI build, devbox image and kernel, mount namespace state, /proc mount health, the exact Bubblewrap command/error, and whether the failure began after a benchmark or sandbox lifecycle event. A restart is a recovery, not a fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIIssues related to the Codex CLIbugSomething isn't workingsandboxIssues related to permissions or sandboxingtool-callsIssues related to tool calling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions