You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Linux][Ubuntu 26.04] Tool sandbox preflight fails although bubblewrap namespace test succeeds #5052
On Ubuntu 26.04, Copilot CLI tool calls fail during sandbox initialization with:
Bubblewrap: network.proxy requires unprivileged user and network namespaces, which this host refused (unshare --user --net exited with exit status: 1).
This happens even though a direct bubblewrap test using user and network namespaces succeeds. The failure occurs before the requested tool command runs.
The same userns_create transition followed by CAP_SYS_ADMIN denial appeared for both observed attempts.
Expected behavior
Copilot CLI should successfully initialize its tool sandbox on this Ubuntu/AppArmor setup, or report a precise actionable cause if the sandbox preflight relies on an unshare path that is blocked while bubblewrap itself can create the required namespaces.
Is this a known compatibility issue with Ubuntu's restricted unprivileged user namespaces, or is there a supported configuration/workaround that does not require weakening AppArmor restrictions globally?
Why it fails. For a sandbox with network access, Copilot CLI does not only call bwrap. Its preflight also runs unshare --user --map-current-user --keep-caps --net -- sh -c :. Your audit log and your plain unshare --user --map-root-user test show that Ubuntu's AppArmor policy denies this: bwrap has an AppArmor profile that allows user namespaces, and unshare has none. Your direct bwrap test passes for that reason. This is the same denial, so the preflight is correct to refuse.
What the sandbox needs for network access on Linux:
bwrap (bubblewrap) 0.5.0 or later
slirp4netns
util-linux 2.35 or later (unshare and nsenter)
iptables, ip6tables, iptables-restore and ip6tables-restore
read/write access to /dev/net/tun
unprivileged user and network namespaces for every tool above, not only bwrap. Check kernel.apparmor_restrict_unprivileged_userns, user.max_user_namespaces and user.max_net_namespaces.
A workaround that does not weaken AppArmor globally. Give unshare its own profile that allows user namespaces, in /etc/apparmor.d/unshare:
abi <abi/4.0>,
include <tunables/global>
profile unshare /usr/bin/unshare flags=(unconfined) {
userns,
include if exists <local/unshare>
}
Then run sudo apparmor_parser -r /etc/apparmor.d/unshare. This allows user namespaces for unshare only, and the sysctl stays at 1. I have not tested this on Ubuntu 26.04, so please tell us if it works.
Better error. The error you saw names only the first problem. A future version will list all of the requirements above in the error, so you can see everything at once.
Activity
caarlos0 commentedon Oct 15, 2026
Thanks for the detailed report.
Why it fails. For a sandbox with network access, Copilot CLI does not only call
bwrap. Its preflight also runsunshare --user --map-current-user --keep-caps --net -- sh -c :. Your audit log and your plainunshare --user --map-root-usertest show that Ubuntu's AppArmor policy denies this:bwraphas an AppArmor profile that allows user namespaces, andunsharehas none. Your directbwraptest passes for that reason. This is the same denial, so the preflight is correct to refuse.What the sandbox needs for network access on Linux:
bwrap(bubblewrap) 0.5.0 or laterslirp4netnsunshareandnsenter)iptables,ip6tables,iptables-restoreandip6tables-restore/dev/net/tunbwrap. Checkkernel.apparmor_restrict_unprivileged_userns,user.max_user_namespacesanduser.max_net_namespaces.A workaround that does not weaken AppArmor globally. Give
unshareits own profile that allows user namespaces, in/etc/apparmor.d/unshare:Then run
sudo apparmor_parser -r /etc/apparmor.d/unshare. This allows user namespaces forunshareonly, and the sysctl stays at1. I have not tested this on Ubuntu 26.04, so please tell us if it works.Better error. The error you saw names only the first problem. A future version will list all of the requirements above in the error, so you can see everything at once.