Subject: Re: PATCH: init(8) - multiuser under chroot
To: None <tech-userlevel@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-userlevel
Date: 05/17/2005 10:49:31
On Sun, 15 May 2005, Jachym Holecek wrote:
> The patch below implements this by having init(8) create and watch the
> "init.root" sysctl node (more details follow in the init.8 part of diff):
> 
>   * In multi-user boot, /etc/rc is run and waited for as usual.
> 
>     If value of the "init.root" sysctl node is not equal to "/" after
>     that, /etc/rc will be run inside a chroot(2) indicated by sysctl.
>     [That is: we'll run ${init.root}/etc/rc under chroot.]

OK, so we run /etc/rc twice.  The first /etc/rc, running in the real
root filesystem, mounts the chroot filesystem, sets sysctl init.root
to the name of the chroot directory, and exits.  Then init runs
${chroot}/etc/rc inside the chroot directory.  This seems simple enough.

>   * Due to limited interface of gettyent() and friends, we use /etc/ttys
>     and _not_ ${chroot}/etc/ttys.

Can we fix this by adding a way of passing an alternative file name
to getttyent() and friends?

--apb (Alan Barrett)