From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 28 20:31:34 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5712E16A407 for ; Thu, 28 Dec 2006 20:31:34 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 1629E13C46E for ; Thu, 28 Dec 2006 20:31:34 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kBSKSeAN018270; Thu, 28 Dec 2006 13:28:40 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Thu, 28 Dec 2006 13:28:44 -0700 (MST) Message-Id: <20061228.132844.-579333856.imp@bsdimp.com> To: freebsd-hackers@freebsd.org, erik.udo@gmail.com, olli@lurza.secnetix.de From: "M. Warner Losh" In-Reply-To: <200612281237.kBSCbE2n047391@lurza.secnetix.de> References: <4592C91C.2040801@gmail.com> <200612281237.kBSCbE2n047391@lurza.secnetix.de> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Thu, 28 Dec 2006 13:28:41 -0700 (MST) Cc: Subject: Re: Init.c, making it chroot X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Dec 2006 20:31:34 -0000 In message: <200612281237.kBSCbE2n047391@lurza.secnetix.de> Oliver Fromme 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