o debootstrap aninhado no contêiner LXC falha ao montar proc por causa do apparmor

1

O comando que é executado dentro de um contêiner amd64 LXC:

debootstrap --arch armhf --foreign --variant=buildd --components=main,restricted,universe,multiverse vivid /var/lib/schroot/chroots/vivid-armhf http://ports.ubuntu.com/ubuntu-ports

Eventualmente falha assim:

W: Failure trying to run:  mount -t proc proc /proc
W: See //debootstrap/debootstrap.log for details

O syslog no host tem isso:

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"

E é realmente impossível montar:

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:/#

O que precisa ser adicionado à configuração do contêiner LXC para permitir essa montagem?

    
por Velkan 07.12.2015 / 14:43

1 resposta

0

Novo perfil:

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 -> /**,
}
EOM

Na configuração do contêiner:

lxc.aa_profile = lxc-default-with-proc-mounting

Atualizar perfis:

sudo systemctl reload apparmor

Reinicie o contêiner.

    
por Velkan 07.12.2015 / 15:06