Não é possível iniciar o contêiner Linux definido XML, montagem cgroup defeituosa

1

Usando o ubuntu 13.04 mais recente; Eu instalei o lxc e várias outras ferramentas

Aqui está minha definição XML:

<domain type='lxc'>
  <name>vm1</name>
  <memory>500000</memory>
  <os>
    <type>exe</type>
    <init>/bin/bash</init>
  </os>
  <vcpu>1</vcpu>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/lib/libvirt/libvirt_lxc</emulator>
    <interface type='network'>
      <source network='default'/>
    </interface>
    <console type='pty' />
  </devices>
</domain>

Eu defino:

virsh --connect lxc:/// define application-test.xml

Mas quando tento começar:

root@lxc:~# virsh --connect lxc:/// start vm1
error: Failed to start domain vm1
error: internal error guest failed to start: PATH=/bin:/sbin TERM=linux container=lxc-libvirt container_uuid=1302678e-0447-79b7-6cc1-db4be64fdaf5 LIBVIRT_LXC_UUID=1302678e-0447-79b7-6cc1-db4be64fdaf5 LIBVIRT_LXC_NAME=vm1 /bin/bash
2013-05-16 14:33:49.930+0000: 1: info : libvirt version: 1.0.2
2013-05-16 14:33:49.930+0000: 1: error : lxcContainerMountCGroups:1893 : Failed to mount cgroup on '/sys/fs/cgroup': No such file or directory
2013-05-16 14:33:49.932+0000: 1866: info : libvirt version: 1.0.2
2013-05-16 14:33:49.932+0000: 1866: error : virLXCControllerRun:1462 : Unable to send container continue message: Broken pipe
2013-05-16 14:33:49.938+0000: 1866: error : virCommandWait:2287 : internal error Child process (ip link del veth1) unexpected exit status 1: Cannot find device "veth1"

E monte:

root@lxc:~# mount
/dev/xvda1 on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
cgroup on /sys/fs/cgroup type cgroup (rw)

Como visto, ele está montado; mas ainda não consegue começar.

Puxando meus cabelos para fora; alguma ideia?

    
por Disco 16.05.2013 / 16:35

1 resposta

0

Eu acho que isso tem mais a ver com o seu rootfs não ser definido corretamente. Onde no seu arquivo XML você montou o rootfs? Eu acho que o erro ocorre porque o arquivo "/ bin / bash" em si não é visível / montado. Eu vinculei abaixo um arquivo DOM.XML de amostra de um dos meus contêineres que deve ilustrar as montagens do rootfs.

Nome do arquivo: originalcopy.xml

 <domain type="lxc">
  <name>originalcopy</name>
  <vcpu placement="static">1</vcpu>
  <cputune>
    <shares>1024</shares>
    <period>10005000</period>
  </cputune>
  <memtune>
    <hard_limit unit="M">1024</hard_limit>
    <soft_limit unit="M">128</soft_limit>
    <min_guarantee unit="M">64</min_guarantee>
  </memtune>
  <blkiotune>
    <weight>800</weight>
  </blkiotune>
  <memory unit="KiB">102400</memory>
  <os>
    <type>exe</type>
    <init>/bin/lxc_defaultinit.sh</init>
  </os>
  <clock offset="utc"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/usr/libexec/libvirt_lxc</emulator>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/"/>
      <target dir="/"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/sbin"/>
      <target dir="/sbin"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/opt"/>
      <target dir="/opt"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/selinux"/>
      <target dir="/selinux"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/bin"/>
      <target dir="/bin"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/lib"/>
      <target dir="/lib"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/tmp"/>
      <target dir="/tmp"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/mnt"/>
      <target dir="/mnt"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/etc"/>
      <target dir="/etc"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/usr"/>
      <target dir="/usr"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/home"/>
      <target dir="/home"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/var"/>
      <target dir="/var"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/root"/>
      <target dir="/root"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/dev"/>
      <target dir="/dev"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/sys"/>
      <target dir="/sys"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/media"/>
      <target dir="/media"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/srv"/>
      <target dir="/srv"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/boot"/>
      <target dir="/boot"/>
    </filesystem>
    <filesystem accessmode="passthrough" type="mount">
      <source dir="/containers/originalcopy/lib64"/>
      <target dir="/lib64"/>
    </filesystem>
    <interface type="bridge">
      <source bridge="br0"/>
    </interface>
    <console type="pty" port="0"/>
  </devices>
</domain>

Como você pode ver, eu montei meus diretórios do sistema de arquivos relacionados ao contêiner na tag do sistema de arquivos. Você precisa fazer o mesmo com seu rootfs (sistema de arquivos raiz). basta substituir o diretório de origem para apontar para o caminho específico em sua máquina. OMI isto deve resolver o problema. Se você tiver alguma dificuldade em criar um rootfs, me avise.

    
por 13.06.2013 / 08:04