惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
Microsoft Security Blog
Microsoft Security Blog
T
The Exploit Database - CXSecurity.com
Hacker News - Newest:
Hacker News - Newest: "LLM"
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
Martin Fowler
Martin Fowler
博客园 - 司徒正美
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
H
Heimdal Security Blog
O
OpenAI News
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
C
CXSECURITY Database RSS Feed - CXSecurity.com
Spread Privacy
Spread Privacy
博客园_首页
H
Help Net Security
阮一峰的网络日志
阮一峰的网络日志
Project Zero
Project Zero
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Help Net Security
Help Net Security
I
InfoQ
L
Lohrmann on Cybersecurity
V
V2EX
Y
Y Combinator Blog
V
Vulnerabilities – Threatpost
G
Google Developers Blog
S
Secure Thoughts
I
Intezer
Blog — PlanetScale
Blog — PlanetScale
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
有赞技术团队
有赞技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Vercel News
Vercel News
www.infosecurity-magazine.com
www.infosecurity-magazine.com
N
News and Events Feed by Topic
S
Schneier on Security
NISL@THU
NISL@THU
B
Blog RSS Feed
F
Full Disclosure
U
Unit 42
Google DeepMind News
Google DeepMind News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
博客园 - 【当耐特】
G
GRAHAM CLULEY

J.D. Hodges

RDP Slow on LAN? Fix the Remote Desktop 56 Kbps Trap Mac Prices Went Up June 2026: What Changed and What to Buy How to Set Up a SSH Connection in Claude Code Desktop How to Enable Wake-on-LAN on Synology NAS | Quick Guide Is the BCBS Settlement Payment Email Legit? (May 2026) How to Fix the VMware Workstation "mksSandbox" Crash (ISBRendererComm Error) - J.D. Hodges How to Check Codex Usage: CLI Status Line and Web Page How to Check Your Codex Usage on ChatGPT (Plus and Pro) MacBook Neo GPU vs Snapdragon X2, Radeon, Arc, RTX 5060 ThinkPad History: IBM 700C to Lenovo AI Workstations Codex /goal: How It Works, Setup, and What I Tested The BeBox: BeOS Hardware, Photos, and the Apple Deal That Wasn't Unable to Load Usage Limits in Claude? Use /usage Mother-In-Law Method for Claude Code Review (Honest Take) Best Laptop for Claude Code (2026) Best Way to Cook Corn on the Cob | Milk and Butter Boil Best Computer for ChatGPT (2026) | Laptops, Desktops, Budget Picks How to Use GPT-5.5 Today via Your Codex Subscription Remove McAfee WebAdvisor on Windows: Stop the Popup WD19TBS Mouse Lag Fix: Dell Firmware Update Worked Claude Opus 4.6 vs 4.7 Max: WordPress Task Graded Claude Code Opus 4.7: Terminal + VS Code Upgrade Instructions Claude Code Rate exceeded. - J.D. Hodges Chuwi MiniBook X vs MacBook Neo: The $399 Laptop That Refuses to Throttle - J.D. Hodges Meta Muse Spark: The Honest Scorecard (3 Wins Out of 20) Who Reads This Blog? Traffic by OS - J.D. Hodges Can MacBook Neo Run Claude Code? $599 Benchmark Test Minisforum MS-01 Proxmox Review: 2 Months Off-Grid on Solar Claude vs ChatGPT vs Gemini for Coding: Real Benchmark Results Claude Code /buddy: How to Preview, Hatch, and Reroll Your Terminal Pet Claude code source code analysis - J.D. Hodges
Codex Sandbox Error on Ubuntu 24.04: The AppArmor Fix
J.D. H. · 2026-04-24 · via J.D. Hodges

How to Fix Codex Sandbox Errors on Ubuntu 24.04

TL;DR: Codex sandbox errors on Ubuntu 24.04 almost always trace back to one thing on freshly installed boxes: AppArmor blocking bwrap. A five-line /etc/apparmor.d/bwrap profile fixed it on my system. If you’re hitting the same wall, paste your error into Claude Code and let it walk you through. 💪

The Symptom: Codex Sandbox Hangs on Ubuntu 24.04

My Codex setup on a fresh Ubuntu 24.04 VM was unusable. Every codex exec call burned 35K to 54K tokens over 2 or 3 minutes retrying fallback paths, then died. The MCP Codex tool connected in about 3 seconds but could not read local files or fetch URLs. My workaround was cat-ing every file into the prompt. Slow and goofy.

The actual error, once I ran the simplest possible repro:

$ bwrap --dev-bind / / --unshare-net echo ok
bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted

If you see that line on your system, the AppArmor userns restriction is worth checking before anything else.

The Fix: Five Lines of AppArmor

Create /etc/apparmor.d/bwrap with this body:

abi <abi/4.0>,
include <tunables/global>

profile bwrap /usr/bin/bwrap flags=(unconfined) {
  userns,
  include if exists <local/bwrap>
}

Then load it:

sudo apparmor_parser -r /etc/apparmor.d/bwrap

That’s it. The profile shape is the same one Ubuntu ships for flatpak and chrome, scoped to /usr/bin/bwrap.

If you would rather not touch AppArmor at all, codex-cli 0.117.0 has a Landlock-based sandbox you can opt into: codex --enable use_legacy_landlock sandbox linux <cmd>. That uses the kernel’s Landlock LSM instead of bwrap. The catch: on codex-cli 0.117.0 this only applies to the codex sandbox linux subcommand, not to codex exec sandbox modes. For codex exec to work, you still want the AppArmor profile above.

Verify

$ bwrap --dev-bind / / --unshare-net echo ok
ok
$ sudo aa-status | grep bwrap
   bwrap

If the canary still fails, look at the kernel log for AppArmor events on bwrap. Ubuntu logs userns transitions as AUDIT events, not DENIED, so the grep needs to cover both:

sudo journalctl -k | grep -E 'apparmor.*(DENIED|userns_create)'

Tip

If you’re hitting this on your own system, paste the RTM_NEWADDR error and your kernel version into a fresh Claude Code session. It will research the Launchpad bugs, consult Codex via MCP for a second opinion, and walk you through the profile install on your host. That’s how I got here.

Why Ubuntu 24.04 Breaks Codex Sandboxes

Ubuntu 23.10+ sets kernel.apparmor_restrict_unprivileged_userns=1 by default. Bubblewrap needs unprivileged user namespaces to build its sandbox, and the restriction blocks unshare(CLONE_NEWUSER) unless a permitted AppArmor profile applies. The upstream AppArmor project keeps a bwrap-userns-restrict profile in its extras/ directory. Ubuntu’s apparmor package added then reverted then partially reworked it (the dropped step is documented in LP #2072811, where the bwrap restrict profile was removed after it broke Flatpak app saves), so a current 24.04 install has no bwrap profile out of the box. The five-line profile above is what fills that gap.

If you want tighter confinement than a compatibility stub, there is an upstream bwrap-userns-restrict profile that strips capability from bwrap‘s children via profile stacking. Heavier to install and maintain, so I’m leaving it for a later session.

One Gotcha After the Fix

After installing the profile, MCP Codex started reading my local files again. Good. Fetching URLs still failed inside sandbox=read-only with “Could not resolve host.” That was not a profile bug. The read-only preset on my Codex version uses bwrap --unshare-net, which isolates the sandbox from the network on purpose. Switching the call to sandbox=workspace-write made URL fetches work. Your Codex build may map the presets slightly differently, so try both before you blame the profile.

Bottom Line

The fix itself took 30 seconds. Getting to the right five lines was a few hours of Claude Code and Codex trading hypotheses: reading Ubuntu’s userns spec, pulling the upstream profile for comparison, flipping the sysctl as a diagnostic, and verifying each success criterion one at a time. Same CC and Codex loop I use for real work.

If you hit codex sandbox errors on your Ubuntu 24.04 box, hand the error to CC and let it run. You’ll learn the AppArmor model along the way. I hope the fix lands on yours as fast as it did on mine. 👍

Sources and Further Reading

Drafted with Claude and Codex. Sources cited against primary docs where possible. If something here does not match what you are seeing, drop a comment and I will update the post.