[libvirt] LXC: init problem

Robin Green greenrd at greenrd.org
Mon Jan 11 06:10:34 UTC 2010

I'm trying to install Exherbo Linux in an LXC container using
libvirt. I've basically succeeded, in that I can "virsh console" in
and start sshd, but I haven't managed to boot it starting from
/sbin/init rather than /bin/bash.

If I have the following (I probably should have modified the uuid and
the mac address from the standard example, but that's not relevant):

<domain type='lxc'>
    <type arch='i686'>exe</type>
  <clock offset='utc'/>
    <filesystem type='mount'>
      <source dir='/home/greenrd/exherbo'/>
      <target dir='/'/>
    <interface type='network'>
      <mac address='52:54:00:56:64:42'/>
      <source network='default'/>
      <target dev='veth0'/>
    <console type='pty'>
      <target port='0'/>

and do

virsh --connect lxc:/// start exherbo && virsh --connect lxc:///
console exherbo

nothing appears - then if I press Enter, the container dies.

In pstree all I see that's relevant is:


so it looks like init dies.

If I run init in gdb in the container I just get:

Starting program: /sbin/init 
Usage: init 0123456SsQqAaBbCcUu

Program exited with code 01.

so I suppose it could be wanting a runlevel as argument. I'm guessing
though that /sbin/init is running in a different mode - telinit mode
- as its PID is not 1.

Is there any way to get an instant console from the virsh start
command, so I can see what's going on?


More information about the libvir-list mailing list