Init.c, making it chroot

Oliver Fromme olli at
Fri Dec 29 09:19:23 PST 2006

M. Warner Losh wrote:
 > Oliver Fromme <olli at> writes:
 > : Erik Udo wrote:
 > :  > How can i make init chroot after executing /etc/rc, and executing 
 > :  > /etc/rc again in the chrooted enviroment?
 > :  > 
 > :  > For this to work, i'd like to know at what point do i call chroot(), 
 > :  > becouse init.c uses fork() at the point where it runs the rc script.
 > :  > 
 > :  > The thing is, i want to run a whole system in a chrooted enviroment in 
 > :  > this livecd i'm making. But the command "chroot /mnt/root /etc/rc" 
 > :  > returns after the /etc/rc has been run, dropping me back from the 
 > :  > chrooted enviroment. And if it doesn't, init never starts the multiuser 
 > :  > mode.
 > : 
 > : That's exactly the problem I had when I created a combined
 > : DVD-ROM with FreeBSD and DragonFly BSD on it.  For them to
 > : share the same ISO-9660, at least one of them needed to be
 > : chrooted.  I decided to add the feature to DragonFly BSD's
 > : init(8) because the DragonFly people seemed to be easier to
 > : convince of the usefulness.  ;-)   Indeed, the feature was
 > : committed quickly.  I didn't try to send-pr a similar patch
 > : for FreeBSD.
 > You do the FreeBSD developer community a disservice with this
 > attitude.  We've been talking about needing something like this for a
 > while.

I'm sorry, I must have missed that then.  Would you point
me to the URL of a thread discussing that, or a subject I
could grep for?  When I first mentioned it (2 or 3 years
ago), nobody was interested.

When I needed a solution, I needed the chroot feature in
either of the two BSDs, but not necessarily in both.  And
most importantly, I needed it quickly because the publisher
had a deadline.  I mentioned the issue in both lists, and
Matt responded and assisted quickly, so the feature went
into DragonFly.  At that moment I simply didn't have enough
time to try to convince the people on this side of the
borderline ;-) that the feature might also be useful for
FreeBSD.  My immediate problem was solved.

If you look at the archives and at the PR database you will
see that I have submitted quite a lot of things to the
FreeBSD project.  And there are quite many submissions
that stay in the PR database (open or closed) without a
chance of getting committed, because they're not deemed
to be useful, or nobody is interested in them, or no
responsible person shows up, or it ends up in a bikeshed
discussion, or I don't know what else.

Don't worry, I'll continue to submit code, when I have
the time to do so, and if I see at least a slim chance
that a committer will pick it up.

 > : PS:  I see NetBSD has a similar feature, too.  Maybe
 > : FreeBSD should join the crowd and adopt it.  ;-)
 > Please, don't come into the FreeBSD forums and talk trash on FreeBSD
 > when you've not even tried to get a change into the base system.

I have tried.

Best regards

PS:  I'll write another mail in a few minutes, in reply to
your patch.

Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD:
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

 > Can the denizens of this group enlighten me about what the
 > advantages of Python are, versus Perl ?
"python" is more likely to pass unharmed through your spelling
checker than "perl".
        -- An unknown poster and Fredrik Lundh

More information about the freebsd-hackers mailing list