Problem halting/restaring a lxc container from within

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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??

Thanks in advance,
David Fernandez


-- lxc.xml file --

<domain type='lxc'>
  <name>lxc</name>
  <memory>524288</memory>
  <os>
    <type>exe</type>
    <init>/sbin/init</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>
    <filesystem type='mount'>
      <source dir='/var/lib/lxc/lxc/rootfs'/>
      <target dir='/'/>
    </filesystem>
    <interface type='network'>
      <source network='default'/>
    </interface>
    <console type='pty'/>
  </devices>
</domain>


_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux