On Thu, Jul 05, 2012 at 01:34:00AM +0200, david(a)dit.upm.es wrote:
Hi,
I've been making some tests with libvirt and LXC and found some problems
when halting/restarting a LXC container from within.
Basically, on a Ubuntu 12.04 system with libvirt installed as package
(0.9.8), I've created a basic container image with:
lxc-create -t ubuntu -n lxc
And started it using the libvirt XML listed below and the following command:
virsh -c lxc:// create lxc.xml
I can access the container console normally but when I issue a halt or
reboot command from inside, the container initiates the halt/reboot
execution but it does not finishes it properly.
For example:
$ sudo halt -p
[sudo] password for ubuntu:
Broadcast message from ubuntu@my-container
(/dev/pts/0) at 23:19 ...
The system is going down for power off NOW!
ubuntu@my-container:~$ acpid: exiting
* Asking all remaining processes to terminate... [ OK ]
* All processes ended within 1 seconds.... [ OK ]
* Deconfiguring network interfaces... [ OK ]
* Deactivating swap... [fail]
* Unmounting weak filesystems... [ OK ]
umount: /run/lock: not mounted
mount: / is busy
* Will now halt
The container seems to finish the shutdown process but libvirt does not
seem to be signaled about it (virsh shows the container is still
executing). Something similar happens with reboot.
However, if a start that container with:
lxc-start -n lxc
and do the same test, it works perfectly:
# sudo halt -p
[sudo] password for ubuntu:
Broadcast message from ubuntu@my-container
(/dev/lxc/console) at 23:17 ...
The system is going down for power off NOW!
ubuntu@my-container:~$ acpid: exiting
* Asking all remaining processes to terminate... [ OK ]
* All processes ended within 1 seconds.... [ OK ]
* Deconfiguring network interfaces... [ OK ]
* Deactivating swap... [fail]
umount: /run/lock: not mounted
mount: cannot mount block device
/dev/disk/by-uuid/9b50a43d-98c3-45ad-a540-7fcbc629a418 read-only
* Will now halt
#
Any idea about how to investigate/solve this problem??
I don't know why it doesn't halt - with recent kernels if you issue
the reboot() syscall from within the guest, then init process should
exit which libvirt will treat as halted. There are patches pending
to make reboots work too but that's for a future release
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|