Skip to content

Bubblewrap sandbox fails inside container for commands on bind-mounted host paths #14976

Closed

Description

@JannikWolff

What version of Codex CLI is running?

v0.115.0

What subscription do you have?

Plus

Which model were you using?

gpt-5.4 medium

What platform is your computer?

Linux 5.15.0-76-generic x86_64 x86_64

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

No response

What issue are you seeing?

On a shared filesystem without sudo, I run Codex CLI inside an Apptainer container (1.4.1) to restrict Codex read access to the host.

Since Codex 0.115.0, reading a file from a bind-mounted path into the container fails before file access with a bubblewrap error.

This does not occur with Codex 0.114.0, so it appears related to the Linux sandbox change in 0.115.0, where bubblewrap became the default on Linux (#13996, @viyatb-oai).

What steps can reproduce the bug?

  1. Start an Apptainer container with a bind-mounted host directory.
  2. Start Codex CLI inside the container.
  3. Ask Codex to read a file in the bind-mounted directory.
  4. Observe that the command fails before file access with: bwrap: Can't bind mount /oldroot/ on /newroot/: Unable to mount source on destination: Invalid argument

Running the same read through Codex CLI’s ! shell escape succeeds.

What is the expected behavior?

No response

Additional information

A native way to restrict Codex CLI filesystem read access, as discussed in #2847, would provide a workaround by allowing Codex to run directly on the host without relying on nested container sandboxing for read isolation.

Activity

  1. added
    bug
    on Mar 17, 2026
  2. added
    CLI
    sandbox
    on Mar 17, 2026
  3. github-actions commented on Mar 17, 2026

    @github-actions
    Contributor
  4. removed
    CLI
    on Mar 17, 2026
  5. zb-dvlpr commented on Mar 17, 2026

    @zb-dvlpr

    Can confirm that this is happening at my end too. codex-cli 0.115.0

  6. jocado commented on Mar 19, 2026

    @jocado

    I'm hitting the same issue with 0.115.0

  7. loicgasser commented on Mar 26, 2026

    @loicgasser

    This is an issue for linux users:

    Image
  8. viyatb-oai commented on Mar 27, 2026

    @viyatb-oai
    Contributor

    @loicgasser This should be fixed in Codex 0.117.0 by #15693, which fixes compatibility with older system bubblewrap versions that do not support --argv0.

    Please update to 0.117.0 and let us know if you're still seeing this.

  9. JannikWolff commented on Apr 22, 2026

    @JannikWolff
    Author

    @viyatb-oai: The problem still exists: in v0.122.0, it's possible to run Codex CLI in a container with the legacy landlock, but not with the bwrap sandbox (then, bind-mounts to the host don't work). However, the legacy landlock will be discontinued soon. Why was the issue closed?

  10. smocherla-brex commented on May 20, 2026

    @smocherla-brex

    +1 on the above , bwrap doesn't seem to work when the root is overlayfs backed

    bwrap: Can't bind mount /oldroot/ on /newroot/: Unable to mount source on destination: Operation not permitted
    

    with errors like. Adding explicit sandbox mounts and permissions like below works but it is still tedious to add the paths I care about.

    default_permissions = "container-scoped"
    
      [permissions.container-scoped.filesystem]
      ":minimal" = "read"
      "/home/owner" = "read"
    
      [permissions.container-scoped.filesystem.":workspace_roots"]
      "." = "write"
    
      [permissions.container-scoped.network]
      enabled = false
    
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

    bugsandbox

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions