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'>
<name>exherbo</name>
<uuid>a4047015-171c-ae56-bc1e-57102d4b86bf</uuid>
<memory>1000000</memory>
<currentMemory>1000000</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='i686'>exe</type>
<init>/sbin/init</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 type='mount'>
<source dir='/home/greenrd/exherbo'/>
<target dir='/'/>
</filesystem>
<interface type='network'>
<mac address='52:54:00:56:64:42'/>
<source network='default'/>
<target dev='veth0'/>
</interface>
<console type='pty'>
<target port='0'/>
</console>
</devices>
</domain>
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:
├─libvirt_lxc───libvirt_lxc
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?
--
Robin