Re: [PATCH] Implement stage 4 (execve handoff)

From: Ryan Finnie <ryan_at_finnie.org>
Date: Fri, 01 Aug 2014 18:44:10 -0700

On 08/01/2014 03:20 AM, Gerrit Pape wrote:
> On Tue, Jul 29, 2014 at 12:01:36PM -0700, Ryan Finnie wrote:
>> This patch adds stage 4, an optional stage which is run after stage 3.
>> If /etc/runit/4 is found and executable, runit will execve() into it,
>> giving it control of PID 1. Finnix (http://www.finnix.org/) uses runit
>> as its init system, and uses this patch as a way to pivot root back into
>> a ramdisk upon shutdown, so it may cleanly umount the union mount which
>> houses runit.
>
> Hi Ryan, I'm not sure how interesting this is for general use. It's
> the first time I hear about the need for a stage 4.
>
> And actually I wouldn't call it so, because runit no longer runs but got
> replaced. Finally, when considering an updated version, documentation
> is missing ;).

I admit, even I can't think of a use for it outside of LiveCDs such as
Finnix. On a normal system, you're usually fine with remounting the
root filesystem read-only, syncing, and cutting power, all of which can
be done in Stage 3. With a LiveCD, the root filesystem is usually a
union mount between a ramdisk and a CDROM, so I wanted a PID 1 handoff
to pivot_root into ramdisk, so I could umount the union and the CD so
the CD could be cleanly ejected. (There are other ways around this
which other LiveCDs use, but they often employ tricks which don't always
work.) Still, it's a small functionality patch and is backwards
compatible with all current usage.

I maintain this patch in a Finnix-specific port of the Debian package,
and only thought about upstreaming it because I need to rebase it after
each Debian package update. So far this has only happened once, last
week (thanks BTW for including my diet/PowerPC fix), so it's not a big
inconvenience.

If you don't want to include this upstream, no worries. If you do, I'd
be happy to write documentation updates to cover it.

RF




Received on Sat Aug 02 2014 - 01:44:10 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:44:18 UTC