Subject: Re: feature request: root file system change
To: Lubomir Sedlacik <salo@Xtrmntr.org>
From: Matt Thomas <matt@3am-software.com>
List: tech-kern
Date: 04/16/2005 14:10:19
Lubomir Sedlacik wrote:
> On Sat, Apr 16, 2005 at 10:17:23PM +0200, Martin Husemann wrote:
> 
>>On Sat, Apr 16, 2005 at 10:06:38PM +0200, Lubomir Sedlacik wrote:
>>
>>>but at this point you already _have_ / mounted, it's the md(4) file
>>>system.  you need to run cgdconfig(8) from somewhere, right?
>>
>>Yes, just like the (temporary) read-only / in single user mode. Some
>>kernel magic would allow the update mount of the real / while the
>>pre-init script runs.
> 
> 
> understood, but wouldn't the "pre-init script" be even more hackish than
> pivot_root(2) at this point?

I guess I'd solve this in a few steps:

1) Add a sysctl group init:

init.rcscript=string   default value would be /etc/rc
init.root=string       default value would be /
init.rcaction=enum     value is a comma separated list containing one or
                 more comma separated value of multiuser,singleuser,rcscript

Before init execs any process it will chroot to the value of
init.root.  It will also open any file path by prefixing it with
init.root.

When init starts up, the default rcaction is rcscript.  after forking
but before execing the rcscript, init will set rcation to multiuser.

This would allow the md root to setup the new root, do
sysctl -w init.rcaction=rcscript init.root=/cgdroot

-- 
Matt Thomas                     email: matt@3am-software.com
3am Software Foundry              www: http://3am-software.com/bio/matt/
Cupertino, CA              disclaimer: I avow all knowledge of this message.