Open Anachron opened 5 years ago
There is already a patch for runit to react on SIGPWR here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923924
I believe this is the wrong repository for the issue, open one in https://github.com/void-linux/void-packages/ or directly file a PR there.
This should be moved to https://github.com/void-linux/runit . @ericonr
Regarding the debian patch, here is my comment from another issue:
I'm not completely happy with it, I would like to have a mechanism to completely disable sigpwr for non containers and users who may run a UPS that sends sigpwr but don't want this to shutdown the system or handle in some other way.
This also requires man page updates, we shouldn't just change how init behaves when it is signaled without documenting it and considering edge cases.
I would add
/etc/runit/sigpwr
which is checked for for existence and executable bit. Create it from our core services, andchmod u+x
it if it is a "container" system.This would not change anything for normal users, introduce the wanted behavior for "containers" and allows users with USPs that send a signal to pid 1 to enable it by
chmod u+x
the file.
https://github.com/void-linux/void-packages/pull/20098#issuecomment-601189877
A working Hotfix (if you're not relying on SIGCONT
being sent to init) (for example, for embedding into the lxc template hook):
Set the executable flag on /etc/runit/stopit
and add lxc.signal.halt = SIGCONT
to the lxc configuration file: setting the executable flag causes runit to shutdown on SIGCONT
, and the configuration addition causes LXC to send SIGCONT
signals instead of SIGPWR on non-forced shutdown requests (like the ones by lxc-stop
).
Because /etc/runit/stopit
is just a symlink to /run/runit/stopit
(which in turn is not persistent over reboots), you have set the +x
flag on every reboot. This could be done easily by something like appending chmod +x /run/runit/stopit
to /etc/rc.local
.
I have no idea what this might break though.
The upstream LXC/LXD Void image now modifies /etc/runit/1
to set the mode for /run/runit/stopit
to 100. Unfortunately this won't survive an update to the runit-void package, so using /etc/rc.local
to change the mode is still needed.
In a similar way to LXC, LXD users will also need to change the signal with lxc config set <instance> raw.lxc lxc.signal.halt=SIGCONT
.
LXC/LXD sends sigpwr signal to Pid 1 but it doesn‘t listen to it, thus stopping LXC/LXD from stopping the container correctly.