troglobit / finit

Fast init for Linux. Cookies included
https://troglobit.com/projects/finit/
MIT License
633 stars 63 forks source link

Handle SIGPWR like SIGUSR2 #142

Closed jackuess closed 3 years ago

jackuess commented 3 years ago

This seems to be inline with Busybox init, SysV init and, according to the comments in code, the intended behaviour of Finit.

The effect is that SIGPWR will lead to Finit issuing the syscall reboot with cmd parameter set to RB_POWER_OFF (rather than RB_AUTOBOOT), which in turn will lead to a halt rather than a reboot. The effect of the above inside a PID namespace other than the initial PID namespace is that wait inside the parent of Finit will report that Finit was killed with a SIGINT signal rather than SIGHUP.

troglobit commented 3 years ago

Thanks, great catch this, looks good!

winkmichael commented 3 years ago

Good find, glad to see this is getting fixed. We run into it from time to time, but never understood it.

echo 1 > /proc/sys/kernel/sysrq echo b > /proc/sysrq-trigger

Has been our occasional work around! haha