Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle SIGPWR signal (shutdown) #2

Open
Anachron opened this issue Mar 23, 2019 · 7 comments
Open

Handle SIGPWR signal (shutdown) #2

Anachron opened this issue Mar 23, 2019 · 7 comments

Comments

@Anachron
Copy link

LXC/LXD sends sigpwr signal to Pid 1 but it doesn‘t listen to it, thus stopping LXC/LXD from stopping the container correctly.

@Anachron
Copy link
Author

There is already a patch for runit to react on SIGPWR here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=923924

@faulesocke
Copy link

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.

@CameronNemo
Copy link

This should be moved to https://github.com/void-linux/runit . @ericonr

@Duncaen Duncaen transferred this issue from void-linux/void-runit Aug 16, 2020
@ericonr
Copy link
Member

ericonr commented Aug 26, 2020

For the pretty patch from Debian, see here

@Duncaen
Copy link
Member

Duncaen commented Sep 11, 2020

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, and chmod 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.

void-linux/void-packages#20098 (comment)

@ghost
Copy link

ghost commented Jan 25, 2021

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.

@amak79
Copy link

amak79 commented Oct 5, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants