Subject: Re: PATCH: init(8) - multiuser under chroot
To: None <tech-userlevel@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-userlevel
Date: 08/29/2005 18:41:28
On Fri, 26 Aug 2005, Jachym Holecek wrote:
> > There was also at least one preference expressed for
> > making the chroot one-way, exec'ing the new init found inside the
> > chroot, if possible, rather than something that would be exited on
> > return to single-user.
> 
> Yes -- my opinion on this remains unchanged. The "multidrop" capability
> prove itself useful IRL, I wouldn't like to loose it...

I'd like it to be configurable.  Perhaps yet another sysctl node
to choose between:

  a) don't chroot anything.
  b) init never chroots itself, but does run /etc/rc in a chroot,
     parses ${chroot}/etc/ttys to tell what getty-equivalent programs
     to run, and runs each getty-equivalents in a chroot.
  c) init chroots itself, and then runs everything else without
     further chrooting.
  d) init chroots itself, and then execs /sbin/init inside the
     chroot.

The reason I want option (d) is that the version of init on the
boot media might be stripped down to save space, but I might want a
full-featured version of init during normal operations.  I realise that
option (d) does not allow me to get back to single user mode in the
"real" root without rebooting.

Option (c) doesn't seem to offer any capability that is not available
with option (b), and is missing the ability to get back from multiuser
mode to single-user mode in the "real" root.  So perhaps option (c)
doesn't need to be implemented.

Capability table:
Can run multiuser stuff in chroot:                    - B C D
Can get back to single user mode in the "real" root:  A B - -
Can boot with small init, but run full-featured init: - - - D

--apb (Alan Barrett)