On 14/03/2016 17:49, Jan Bramkamp wrote:
The correct solution would be to teach s6-svscan about SIGPWR and proxy it to .s6-svscan/SIGPWR.
This. SIGPWR is not a "traditional" signal to use to ask for a normal shutdown, and it is a design mistake in lxc-stop to use it. SIGPWR has very specific semantics: "the power went down, we are now running on UPS, please shut down as soon as possible", which is not exactly the same thing as "please shut down cleanly" - even if in practice the implementation would likely be the same. The traditional signal to ask for a reboot is SIGINT. There is no traditional signal to ask for a shutdown. - sysvinit "shutdown" only sends a command to init via /dev/initctl, which is the equivalent of using s6-svscanctl to send a command to s6-svscan via its control fifo. - suckless init uses SIGUSR1 for "poweroff" and cannot handle "halt" - busybox init uses SIGUSR1 for "halt" and SIGUSR2 for "poweroff" - I don't even want to know what systemd does. A DBus message, probably. So, there's no real historical precedent here, and there are a few signals to choose from - but SIGPWR is not a good choice, and lxc should be fixed. The correct workaround is indeed to use the -s option to s6-svscan and write appropriate .s6-svscan/SIG* scripts to handle various signals in a personalized way. -- Laurent
