runit: initiate shutdown on receiving SIGPWR - #39
Open
jchook wants to merge 1 commit into
Open
Conversation
This is a port of Debian's runit patch 0013-Shutdown-when-runit-init-receices-SIGPWR.patch by Dmitry Bogatov <KAction@debian.org> (Debian bug #923924), shipped in Debian since runit 2.1.2-27, adapted to this tree's const sig_* constants and handler signatures, with two fixes over the Debian version: - on fork() failure the pwrfail handler retries in a loop like the existing ctrlaltdel handler, instead of falling through to wait_pid(&wstat, -1), which would reap an arbitrary child. - stage children unblock and uncatch SIGPWR before execve, matching the treatment of the other caught signals; Debian's patch leaves SIGPWR (SIGUSR2 on platforms without it) blocked in the inherited signal mask of every process on the system.
Member
|
PRs should generally be addressed to https://github.com/g-pape/runit, Void used this repo to document our patches when it seemed the upstream was gone, which is no longer the case. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a port of Debian's runit patch to support SIGPWR with a couple fixes.
Container frameworks (e.g. Incus, LXC) use SIGPWR to poweroff containers. runit ignores these, so
incus stophangs until timeout, e.g.incus launch images:voidlinux/current runit-repro incus stop runit-repro # hangs until timeoutThe feature is opt-in so it can be rolled out incrementally or only to stock void container images. To opt-in, add +x
/etc/runit/pwrfail. A one-liner that exits 0 works.Fixes against the original Debian patch (made by Claude Fable):
Original patch by Dmitry Bogatov for Debian bug #923924, shipped in Debian since 2019.
Tested by running the patched runit as PID 1 in an unprivileged PID+user namespace: SIGPWR runs pwrfail, arms stopit, and proceeds through stage 3; without pwrfail present, SIGPWR is a no-op and runit keeps running; stage-2 descendants show a clean SigBlk mask in /proc/pid/status, confirming the second fix.
Closes #2