|
|
Log in / Subscribe / Register

Changing Fedora's shutdown timeouts

Changing Fedora's shutdown timeouts

Posted Jan 28, 2023 3:38 UTC (Sat) by mathstuf (subscriber, #69389)
In reply to: Changing Fedora's shutdown timeouts by intelfx
Parent article: Changing Fedora's shutdown timeouts

PID 1 only receives signals for which it installs handlers. It's a bit special in that way. When "random executable X" is launched directly in a container with a PID namespace, it becomes that namespace's PID 1 and since SIGKILL handlers are generally only done in programs *expecting* to be PID 1, these processes therefore become unkillable.


to post comments

Changing Fedora's shutdown timeouts

Posted Jan 28, 2023 12:49 UTC (Sat) by izbyshev (subscriber, #107996) [Link] (3 responses)

There are no "SIGKILL handlers" (and SIGSTOP handlers). It's impossible to change signal disposition for SIGKILL and SIGSTOP[1], as intelfx pointed out, so no init process (whether global or from a pid namespace) can change the effects of these signals. They can't be sent to the global init because the kernel explicitly disallows that[2]. For pid namespace inits, SIGKILL and SIGSTOP are allowed if sent from an ancestor pid namespace[3].

[1] https://elixir.bootlin.com/linux/v6.1.8/source/kernel/sig...
[2] https://elixir.bootlin.com/linux/v6.1.8/source/kernel/sig...
[3] https://elixir.bootlin.com/linux/v6.1.8/source/kernel/sig...

Changing Fedora's shutdown timeouts

Posted Jan 28, 2023 16:30 UTC (Sat) by kleptog (subscriber, #1183) [Link] (2 responses)

Thanks. I'd just like to say I find the PID1 signal handling somewhat underdocumented. The clearest thing I could find was this LKML message[1] from 2008.

[1] https://lwn.net/Articles/312721/

So it's true that init processes cannot be killed by unhandled signals, and that usually what prevents containers inits from dying on SIGTERM. But that's not what protects them from SIGKILL, that's handled on the other end. What happens if a container init receives a SIGSEGV due to a memory fault but has no handler installed wasn't immediately clear to me (I think the force mechanism will cause it to die anyway, not sure).

Changing Fedora's shutdown timeouts

Posted Feb 5, 2023 19:45 UTC (Sun) by flussence (guest, #85566) [Link] (1 responses)

IIRC in a namespace, if PID1 is SIGKILLed (or just exits some other way), what happens is every *other* PID in there gets SIGKILLed.

And that's part of the contract which "Container-init must behave like global-init to processes within the container" from that link entails - when you kill PID1 on bare metal the system stops.

Changing Fedora's shutdown timeouts

Posted Feb 26, 2023 16:30 UTC (Sun) by nix (subscriber, #2304) [Link]

> And that's part of the contract which "Container-init must behave like global-init to processes within the container" from that link entails

This seems to conflict badly with the reality which has random programs running as PID 1 in single-service containers. Hardly any of these programs are expecting ever to suddenly become an init...


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds