The command that is run inside an amd64 LXC container:
debootstrap --arch armhf --foreign --variant=buildd --components=main,restricted,universe,multiverse vivid /var/lib/schroot/chroots/vivid-armhf Eventually fails like that:
W: Failure trying to run: mount -t proc proc /proc
W: See //debootstrap/debootstrap.log for detailsThe syslog on the host has this:
audit: type=1400 audit(1449495124.972:29): apparmor="DENIED" operation="mount" info="failed type match" error=-13 profile="lxc-container-default" name="/var/lib/schroot/chroots/vivid-armhf/proc/" pid=25739 comm="mount" fstype="proc" srcname="proc" flags="rw"
audit: type=1400 audit(1449495124.976:30): apparmor="DENIED" operation="mount" info="failed type match" error=-13 profile="lxc-container-default" name="/var/lib/schroot/chroots/vivid-armhf/proc/" pid=25739 comm="mount" fstype="proc" srcname="proc" flags="ro"And it's really impossible to mount:
user@vm:~$ sudo chroot /var/lib/schroot/chroots/vivid-armhf
/usr/bin/groups: cannot find name for group ID 0
I have no name!@vm:/# mount -t proc proc /proc
mount: proc is write-protected, mounting read-only
mount: cannot mount proc read-only
I have no name!@vm:/#What needs to be added to the LXC container config to allow such mount?
1 Answer
New profile:
sudo tee /etc/apparmor.d/lxc/lxc-default-with-proc-mounting <<EOM
profile lxc-default-with-proc-mounting flags=(attach_disconnected,mediate_deleted) { #include <abstractions/lxc/container-base> mount fstype=proc options=ro -> /**,
}
EOMInto container config:
lxc.aa_profile = lxc-default-with-proc-mountingReload profiles:
sudo systemctl reload apparmorRestart container.