[Lxc-users] lxc-shutdown and guests running upstart

Stéphane Graber stgraber at ubuntu.com
Sun Sep 22 14:28:18 UTC 2013


On Sun, Sep 22, 2013 at 02:00:08PM +0300, Johannes Graumann wrote:
> Hello,
> 
> When setting up a centos lxc container from scratch I ran into the fact that 
> (according to my interpretation of my extensive googling) upstart-running 
> distributions cannot be gracefully coerced into shutting down via "lxc-
> shutdown" ... this is true for both my manual centos and a lxc-fedora 
> generated fedora container ...
> 
> I have not found a way around this. Can anyone share how to configure an 
> upstart guest to listen to a "kill -s INT $pid" and/or "kill -s PWR $pid" as 
> used by lxc-shutdown?
> 
> Thank you for any hints.
> 
> Sincerely, Joh

Hmm, that's surprising, it definitely works fine on Ubuntu.

My guess is that you're missing the upstart job which reacts on SIGPWR
being received by PID1.

Try adding this as /etc/init/shutdown.conf in your container:
"""
# Trigger an immediate shutdown when upstart receives SIGPWR
# this is useful for some UPS monitoring tools and for clean
# shutdown of containers

description "Trigger an immediate shutdown on SIGPWR"
start on power-status-changed

task
exec shutdown -h now "SIGPWR received"
"""

After that lxc-shutdown should work fine.

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130922/bb82fc62/attachment.pgp>


More information about the lxc-users mailing list