Date: Thu, 28 Dec 2006 13:28:44 -0700 (MST) From: "M. Warner Losh" <imp@bsdimp.com> To: freebsd-hackers@freebsd.org, erik.udo@gmail.com, olli@lurza.secnetix.de Subject: Re: Init.c, making it chroot Message-ID: <20061228.132844.-579333856.imp@bsdimp.com> In-Reply-To: <200612281237.kBSCbE2n047391@lurza.secnetix.de> References: <4592C91C.2040801@gmail.com> <200612281237.kBSCbE2n047391@lurza.secnetix.de>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200612281237.kBSCbE2n047391@lurza.secnetix.de> Oliver Fromme <olli@lurza.secnetix.de> 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. : It shouldn't be too difficult to port it, though: : : http://www.dragonflybsd.org/cvsweb/src/sbin/init/init.c : : The chroot() patch has been committed with r1.6. It uses : kenv to specify the chroot directory, so it can easily be : set by the loader(8), e.g. using a custom boot menu. : : Best regards : Oliver : : 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. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061228.132844.-579333856.imp>