Subject: Re: PATCH: init(8) - multiuser under chroot
To: Jachym Holecek <>
From: Simon J. Gerraty <>
List: tech-userlevel
Date: 09/05/2005 10:14:07
On Mon, 5 Sep 2005 12:29:55 +0200, Jachym Holecek writes:
>> >  a) don't chroot anything.
>> >  b) init never chroots itself, but does run /etc/rc in a chroot,
>> Unless someone has fixed a bunch of stuff in the kernel, then at least
>> the part of /etc/rc that handles fsck / and mounting it rw, needs to be 
>> unchrooted.
>Hmm, do you recall what part of the kernel was involved?

If you are already chrooted the fsck and remount of / will fail
because the device is busy, using the actual raw device won't help.
The kernel makes a speciall allowance for / to allow this operation at
boot but that won't work once you're chrooted.

Attempting to remount the boot device within the chroot env would also
require some very scary changes to the kernel.

>  1. init runs /etc/rc (no chrooting)

Yep, that's key.

>  2. sysctl init.chroot is checked and if not equal to "/",
>     we continue under chroot (beginning with ${chroot}/etc/rc).

Your scheme sounds fine.

I don't have a sysctl since my behavior is hard coded - which is why I
moved the bulk of rc processing to a script that does run chrooted,
but my approach obviously is for a specific embedded system.