On Mon, Dec 07, 2009 at 03:02:53AM -0600, Tony Risinger wrote:
hello,
i am trying to use libvirt with LXC, and having some issues...
everything seems ok when using lxc-* tools. host box is Arch Linux.
ultimately i'm getting this error in the domain log:
.....
05:45:31.353: debug : lxcControllerMain:380 : EPOLLHUP from fd 7
i was getting this last night in #virt:
.....
20:49:57.545: error : lxcFdForward:230 : read of fd 7 failed: Input/output error
libvir: Linux Container error : read of fd 7 failed: Input/output error
I believe this essentially says that the container has shutdown.
-----CONFIGURATION
# host ptmx symlinked to pts/ptmx
[root@PHS-001 vps]# ls -l /dev/ptmx
lrwxrwxrwx 1 root root 8 2009-12-08 04:40 /dev/ptmx -> pts/ptmx
# guest ptmx symlinked to pts/ptmx
[root@PHS-001 vps]# ls -l /vps/dom/ubuntu/root/dev/ptmx
lrwxrwxrwx 1 root root 8 2009-12-06 04:11
/vps/dom/ubuntu/root/dev/ptmx -> pts/ptmx
Avoid doing this - libvirt will set that up as part of the container
bootstrapping processs.
# guest config...
# i have tried the legacy <console type='pty' /> with same results
# i dont fully understand this, why do i need to specify a host/source pty?
[root@PHS-001 vps]# cat /vps/def/exec/sys/ubuntu.xml
<domain type='lxc'>
<name>ubuntu</name>
<memory>500000</memory>
<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>
<filesystem type='mount'>
<source dir='/vps/dom/ubuntu/root'/>
<target dir='/'/>
</filesystem>
<console type='pty'>
<source path='/dev/pts/4'/>
Leave out the <source> here - that's auto-generated when the container
starts
<target port='0'/>
</console>
</devices>
</domain>
-----PROCEDURE
[root@PHS-001 vps]# LIBVIRT_DEBUG=1 libvirtd --daemon
05:42:46.121: debug : virInitialize:278 : register drivers
.....
[root@PHS-001 vps]# virsh -c lxc:/// define /vps/def/exec/sys/ubuntu.xml
Domain ubuntu defined from /vps/def/exec/sys/ubuntu.xml
[root@PHS-001 vps]# virsh -c lxc:/// define /vps/def/exec/sys/ubuntu.xml
Domain ubuntu defined from /vps/def/exec/sys/ubuntu.xml
[root@PHS-001 vps]# virsh -c lxc:/// start ubuntu
Domain ubuntu started
[root@PHS-001 vps]# virsh -c lxc:/// console ubuntu
error: Unable to get domain status
error: internal error Unable to get cgroup for ubuntu
-----LOGS
# /var/log/libvirt/lxc/ubuntu.log
05:45:31.126: debug : virCgroupMakeGroup:450 : Make group /libvirt/lxc
05:45:31.126: debug : virCgroupMakeGroup:462 : Make controller
/cgroup/1534/libvirt/lxc/
05:45:31.211: debug : lxcContainerStart:832 : clone() returned, 1536
05:45:31.353: debug : lxcControllerMain:380 : EPOLLHUP from fd 7
i've tried endless variations of the <devices> section, but i just
cant seem to get anything going with libvirt/LXC once i move the root
to a new location for a system container. same container works fine
with lxc-* tools (although i manually make a bridge). any help is
appreciated,
Rather that going straight for a full OS, try just setting up a trivial
busybox root environment which just takes you intoa busybox shell.
eg, in /sbin/init just have
#!/sbin/busybox
sh
(Obviously install busybox in /sbin inside the root env too :-)
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|