Fedora Account System
Red Hat Associate
Red Hat Customer
Description of problem: lxc-stop does not stop all types of containers. Example debian wheezy containers do not stop properly and are killed after 60 second timeout Version-Release number of selected component (if applicable): lxc-1.0.5-3.el7.x86_64 How reproducible: On 2 different installs i have the same issue with debian containers running on centos 7 Steps to Reproduce: 1. lxc-stop -n container_name Actual results: container stops running after a delay of approx 60 seconds Expected results: container should stop running immediately or withing a few seconds aka less than 2 or 3 seconds lxc-stop -n container_name -k seems to work but from what i understand this forces a shutdown similar to cutting the power Additional info: Very annoying issue as in many cases it looks like the container has locked up This causes issues if you ever reboot the host machine as it takes a few minutes if not more to power cycle
This is an issue with SIGPWR handling in the container. The lxc-stop command now issues a SIGPWR signal to the container init and then waits a time out period for the container to gracefully shut down and exit. The container init process must handle that signal and shut down gracefully. If it fails to shut down gracefully before a timeout, lxc-stop will then kill the container. The Debian container (probably sysvinit or lsbinit) has to be configured to handle the SIGPWR signal an initiate a shutdown. Alternative is to simply issue a "lxc-stop -k" or set a very short timeout. But this doesn't do and orderly shutdown in the container. The proper solution is to reconfigure the Debian container to shut down on SIGPWR. That can probably (should probably) be set up in the Debian template but all existing (old) containers will have to be reconfigured manually. The old behavior of lxc-stop pre-1.0 was to unceremoniously kill the container, which can lead to corrupted database and other mayhem from the container not shutting down gracefully. The current lxc-stop is behaving as designed and as expected. The problem is a configuration issue in the container.
Strange... I just now tested a Debian Wheezy container on my Fedora 20 server. Running lxc-stop -n {container} shuts the container down in about 3 or 4 seconds, no problem. Does your container have this line in /etc/inittab? p0::powerfail:/sbin/init 0 Did you install and alternate init system (upstart or systemd)?
I can confirm that on my template in inittab p0::powerfail:/sbin/init 0 was not being added. this is due to the containers having been migrated from an older lxc base. I have added it to existing containers and all is working as expected. So we can consider this resolved. Sorry for the inconvenience