Subject: re: feature request: root file system change
To: Matt Thomas <matt@3am-software.com>
From: matthew green <mrg@eterna.com.au>
List: tech-kern
Date: 04/18/2005 23:53:12
   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


this sounds like an OK idea except that i'd like to be able to free
any memory allocated to the (first) root etc. and chroot won't do that.


.mrg.