shutdown busybox and start another PID1 process

James Bowlin bitjam at gmail.com
Tue Aug 12 04:46:09 UTC 2014


Thanks James for all the great info!  This candy store just gets
sweeter and sweeter.  Were you, by any chance, in physics grad
school in the 1970s?  I'm sorry for the delay in responding.
This was the first post I started to respond to this morning
but the way my interrupts work, it is the last one I'm finishing.

On Mon, Aug 11, 2014 at 11:34 PM, James B said: 
> This is a solved problem. Fatdog64, an 64-bit offshot of Puppy
> Linux (disclaimer: I'm one of the maintainers), does exactly
> this - [...]

I will definitely look at the ISO.  Thanks!  I didn't mean to
claim it was impossible (although maybe I inadvertently did).  I
meant to say that I tried and I could not find a solution.  Kudos
to you for succeeding!

> My latest solution does pivot_root too for cleanliness reason,
> but it is actually unnecessary. You can still be on your
> original aufs root and take off the layer one by one - if
> you're careful - and have a clean unmount.

I was thinking a pivot_root would make it easier to use a
dynamically linked BB but I think the best solution for that is
to use LD_PATH.

Slax does a pivot_root into a BB environment on shutdown, at
least on their live system.  They used pids for sorting processes
though.  This broke out of the box when I was testing it here
because the pids had already wrapped so I replaced pids with
start-time.

    cut -d" " -f22 /proc/$pid/stat

I also use this for a 1/100th of a second timer:

    cut -d" " -f22 /proc/self/stat

I've seen other Live systems use a pivot_root.  It seemed like
the canonical solution.

> If you really want to tell busybox init to quit - the simplest
> thing is to send SIGQUIT to it (kill -3 1). [...]

I never used the BB init so I didn't know much about it.  I
proposed something like this as a solution.  I didn't realize it
has already been done.  This might be of interest to the OP of
this thread.  If they are using BB init, it answers their
question.  We've gone horribly off-topic (probably mostly my
fault) and they may have stopped following the conversation.


Peace, James


More information about the busybox mailing list