Closed mmanjos closed 6 months ago
hmm... it looks like there's a similar issue opened up with LXD
Never use security.privileged for this kind of stuff, it prevents the use of AppArmor namespaces on top of making your host system extremely vulnerable to attacks.
Never use security.privileged for this kind of stuff, it prevents the use of AppArmor namespaces on top of making your host system extremely vulnerable to attacks.
Thanks - that was just there for testing to see if it would make a difference. Using security.privileged: "false"
doesn't fix this issue. (I was trying to disable anything security or apparmor related to try to find the source of this regression on a lab server)
As a workaround, moving this environment to mainline kernel 6.8.0-060800-generic
has temporarily solved this issue and I'm able to run docker inside of lxc containers created by incus again.
Sounds like some new AppArmor feature that's only in the Ubuntu kernel. I'll have to take a look.
If that's the case, we'll be closing this issue as we have little interest in doing special handling for distro specific kernel experiments.
Fair enough - thanks for taking a peek. It does feel like they introduced a change into 24.04 at the last minute (I've been testing nightlies of 24.04 for a while now and everything has worked great with Incus, right up until this recent upgrade with the final release of Noble)
Tests so far:
The issue with this denial:
[ 355.928870] audit: type=1400 audit(1714427935.547:331): apparmor="DENIED" operation="pivotroot" class="mount" namespace="root//incus-docker_<var-lib-incus>" profile="runc" name="/var/lib/docker/overlay2/9a3dc7e25b7fb1f6b0bfed217133862d024a62f2d84c6d70b527a5fa2567360f/merged/" pid=9480 comm="runc:[2:INIT]" srcname="/var/lib/docker/overlay2/9a3dc7e25b7fb1f6b0bfed217133862d024a62f2d84c6d70b527a5fa2567360f/merged/"
Is that it apparently occurs within the generated runc
profile, not our own profile, so this isn't something that can be fixed on our end.
The apparmor runc
profile only exists on Ubuntu 24.04 and is there only to deal with Ubuntu's odd default of blocking unpriv userns unless a profile says otherwise.
One way to resolve the mess is to undo what Ubuntu did:
echo 0 > /proc/sys/kernel/apparmor_restrict_unprivileged_userns
ln -s /etc/apparmor.d/runc /etc/apparmor.d/disable/
(in the container)Closing as this whole thing is because of Ubuntu-specific changes causing wide ranging regressions (requirement of AppArmor for anything to use userns) and their attempted fixes for this situation (apparmor profile for runc) then further getting things to run into AppArmor bugs/issues.
Required information
incus info
Issue description
I'm trying to run docker inside a simple lxc container, using a config that worked on an early development release kernel of 24.04. I've rebuilt the system to 24.04 final and it appears something has broken container nesting on this latest kernel.
My incus container config has:
When I try to start any docker container from within this incus container, I get:
$ docker run -it alpine /bin/sh docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error jailing process inside rootfs: pivot_root .: permission denied: unknown. ERRO[0000] error waiting for container:
And the parent host generates an audit message:
[ 2834.188006] audit: type=1400 audit(1714097921.411:1252): apparmor="DENIED" operation="pivotroot" class="mount" namespace="root//incus-test_<var-lib-incus>" profile="runc" name="/var/lib/docker/overlay2/38b1e498be70b0eff840bc92770eef7ebaa1c2b3caea9bf0f93bf5ff53088c28/merged/" pid=26921 comm="runc:[2:INIT]" srcname="/var/lib/docker/overlay2/38b1e498be70b0eff840bc92770eef7ebaa1c2b3caea9bf0f93bf5ff53088c28/merged/"
I've tried disabling the new ubuntu-specific Unprivileged user namespace restrictions by setting
kernel.apparmor_restrict_unprivileged_userns=0
but it did not help