shutdown busybox and start another PID1 process

Laurent Bercot ska-dietlibc at skarnet.org
Sun Aug 10 07:38:34 UTC 2014


On 2014-08-10 08:07, James Bowlin wrote:
> BTW: I use the start-time of processes to find all the processes
> that need to be killed.  Using pid is unreliable because it can
> wrap on 32-bit systems.

  The *only* way to be 100% sure they are no remaining processes at
some point in a system's lifetime is to kill them all - like aliens,
or zombies. Trying to be smarter or more gentle than that is a
losing battle: any process can sneakily fork while you're not
looking and leave a child running somewhere.

  So unless you are doing something demented like ptracing every
single fork in your pid 1 (Upstart does this, and I think systemd
does too, but I haven't checked yet), which any homo sapiens sapiens
will refuse to do, you can try and be nice to processes that your
supervision system (even if it is sysvinit) is tracking, and kill
them politely, but after that, you *have to* nuke the system from
orbit: kill -9 -1. Process 1 (and under Linux, the shell that
performed the kill command if kill is a builtin) will go on, like
Lot walking out of Sodom, and you can rebuild from there.

  This page may be relevant:
  http://skarnet.org/software/s6/s6-svscan-1.html
(especially the "stage 3 init" part).

  Note that neither sysvinit (which busybox init is a variant of)
nor runit will run your scripts as process 1, and runit will not
allow you to exec into another process 1 (there is a discussion
on the supervision at list.skarnet.org list about a possible future
"stage 4" to make it do just that); but s6 can already do both.

-- 
  Laurent (currently working on s6 2.0, which will make all of
this much simpler.)



More information about the busybox mailing list