linux: codex报错:沙箱内执行命令失败了(bwrap 网络命名空间错误),需要以非沙箱方式查看当前工作区内容以判断脚手架现
一,报错信息:
Would you like to run the following command?
Environment: local
Reason: 沙箱内执行命令失败了(bwrap 网络命名空间错误),需要以非沙箱方式查看当前工作区内容以判断脚手架现状。
$ pwd && ls -la
› 1. Yes, proceed (y)
2. Yes, and don't ask again for commands that start with `pwd` (p)
3. No, and tell Codex what to do differently (esc)
或:
Reason: The sandboxed shell fails to start (bwrap loopback error). Allow running read-only inspection of the workspace outside the sandbox?
二,原因
Codex 依赖 bubblewrap (bwrap) 来构建隔离的沙箱环境,但这需要系统允许普通用户创建“用户命名空间”(User Namespaces)。
你的系统当前禁止了这一行为,导致沙箱无法启动。
三,解决:
# 临时开启全局非特权 userns(立即生效)
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
# 写入配置文件,使其永久生效
echo "kernel.apparmor_restrict_unprivileged_userns=0" | sudo tee /etc/sysctl.d/60-apparmor-userns.conf
浙公网安备 33010602011771号