From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1R56u0-0002EK-Pl for garchives@archives.gentoo.org; Sun, 18 Sep 2011 02:14:41 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 24F1521C0E3; Sun, 18 Sep 2011 02:14:28 +0000 (UTC) Received: from mail-gy0-f181.google.com (mail-gy0-f181.google.com [209.85.160.181]) by pigeon.gentoo.org (Postfix) with ESMTP id 8C83821C02A for ; Sun, 18 Sep 2011 02:13:31 +0000 (UTC) Received: by gyd10 with SMTP id 10so5071283gyd.40 for ; Sat, 17 Sep 2011 19:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=Sa9MZ2eHtkCarh+fC6k9IoU2mR94USvqniq3mHvwdc8=; b=MMQgTOwiVmq7xd1Mm8YErFhpQM8QM2g5NuRXoy1DW64htAcq2PtXY3tbnCMx16Xqto EqrspgjJ0A3C1po9Nfbu4KOmTOcQhEByJnFL19mAp81OWqQzNM5VHDLcLUjLMtqI3P4u KfGyFIMIpjNXAa+IyDFTvPivLtTExTBr+KWhc= Received: by 10.236.153.36 with SMTP id e24mr3198857yhk.36.1316312011031; Sat, 17 Sep 2011 19:13:31 -0700 (PDT) Received: from [192.168.2.5] (adsl-65-0-89-228.jan.bellsouth.net. [65.0.89.228]) by mx.google.com with ESMTPS id o23sm12770144yhk.3.2011.09.17.19.13.29 (version=SSLv3 cipher=OTHER); Sat, 17 Sep 2011 19:13:30 -0700 (PDT) Message-ID: <4E7553C8.8080508@gmail.com> Date: Sat, 17 Sep 2011 21:13:28 -0500 From: Dale User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110917 Firefox/6.0.2 SeaMonkey/2.3.3 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Making a init thingy. Step two I guess. References: <4E74FCC5.5070000@gmail.com> <4E750693.7020602@gmail.com> <4E750E87.4010201@gmail.com> <4E751EDB.4070303@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Archives-Salt: X-Archives-Hash: f69787faafa28359e21061949f1e5b21 Michael Mol wrote: > On Sat, Sep 17, 2011 at 6:27 PM, Dale wrote: >> Mark Knecht wrote: >> I think there are only a few that has that flag, at least that I would put >> in the init thingy anyway. Maybe this is something that the devs will work >> on if it can be done. May be a big if there. >> >> That is the guide I am trying to go by but I think I am missing something. >> This is the script they have posted: >> >> #!/bin/busybox sh >> >> # Mount the /proc and /sys filesystems. >> mount -t proc none /proc >> mount -t sysfs none /sys >> >> # Do your stuff here. >> echo "This script mounts rootfs and boots it up, nothing more!" >> >> # Mount the root filesystem. >> mount -o ro /dev/sda1 /mnt/root >> >> # Clean up. >> umount /proc >> umount /sys >> >> # Boot the real thing. >> exec switch_root /mnt/root /sbin/init >> >> That doesn't really make much sense to me. First it mounts the stuff then >> umounts it right after that. Huh? Is the relevant part the "mount -o ro >> /dev/sda1 /mnt/root" ? Then the exec switch_root part after that? The rest >> seems to cancel each other out. >> >> Looking forward to that light bulb moment here. ;-) > Here's how I read it. > > First, it mounts /proc and /sys, since just about anything is going to > need at least one of those. > > Second, it mounts your (desired) / filesystem at /mnt/root. > > Third, it unmounts /proc and /sys. > > Fourth, it switches out / with the filesystem it already mounted at > /mnt/root. This is similar (idential) to chroot. At the _same_ time, > it launches your init script. > > Your init script launches and sees a / without a /proc or a /sys. The > / it sees is what _was_ /mnt/root only moments before. The stuff that > was originally at / is no longer accessible. (Which, incidentally, is > why you unmount /proc and /sys; nothing would be able to get to those > particular mounted filesystems, since everything else gets to see the > world with /mnt/root/ as the /. > > Your init script (the one at /sbin/init), seeing itself in a fresh, > needs-to-be-booted system, mounts /proc, /sys, etc...everything the > init script is configured to do. > Ahhhhh. I see now. So, it mounts proc and sys but that is in the init then it mounts the real root outside the init. Then it umounts the proc and sys under the init and then switches to the real root and starts init there. Where does /usr and /var come in here? Isn't the init supposed to mount that too? Do I add that myself? If so, when to fsck get ran? Dale :-) :-)