Gentoo Archives: gentoo-dev

From: Rich Freeman <rich0@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Warn users not to do separate /usr partition without proper initramfs in the handbook?
Date: Thu, 11 Aug 2011 12:21:16
Message-Id: CAGfcS_kqBJrDhgeX62F=K7Kn+2t_M71nox_b4pVBQp3zB=WtvQ@mail.gmail.com
In Reply to: Re: [gentoo-dev] Warn users not to do separate /usr partition without proper initramfs in the handbook? by Dale
1 On Thu, Aug 11, 2011 at 2:04 AM, Dale <rdalek1967@×××××.com> wrote:
2 > I understand that Fedora is wanting to do this.  What I don't understand is
3 > why.  It seems it is udev that is wrecking this havoc.
4
5 Well, the answer is a bit more nuanced.
6
7 First, keep in mind that in a "typical" linux distro the end user does
8 not build their own kernel (sure, there is usually a way to do it, but
9 the distro doesn't encourage this). Instead you get a
10 one-size-fits-all kernel with just about everything compiled into
11 modules. This invariably requires an initramfs to boot, since you
12 can't tell what drivers will be needed to mount root. So, anybody
13 with a mainstream distro already has an initramfs.
14
15 Now that you have everything in modules, how do you figure out which
16 modules to load/etc? Well, in the end udev becomes the best tool for
17 this. Then the question comes up, if you're going to use udev to
18 configure your mouse, why not use it to configure even the most
19 essential boot-time devices and avoid re-inventing the wheel?
20
21 So, now the big distros are in the state they're currently in - they
22 end up needing /usr mounted anyway due to the evolution of udev. It
23 sort-of crept up on them.
24
25 Now, what Fedora is currently proposing is to turn this from a "bug"
26 into a "feature." As long as we need to have /usr around anyway - why
27 not get rid of /bin, /lib, and so on. What they plan to do is move
28 all these files under /usr, with compatibility links in the other root
29 directories. Then you can mount /usr as read-only (or maybe even run
30 it from nfs), and every single executable/library on the system is
31 better protected from accidental modification. This requires
32 initramfs support, but they already have an initramfs and so they just
33 have to add a few lines to mount it (dracut already parses /etc/fstab
34 to mount root and has just about all the userspace logic in place to
35 do what mount already does on a booted system, so it can probably just
36 do little more than a mount /usr to accomplish this).
37
38 Since most distros are already using an initramfs, they also have
39 leveraged this to add additional features, like identifying root
40 devices by UUID, allowing root on LVM+raid or NFS, or iSCSI, or
41 whatever. Also, LUKS support is pretty common - you can install
42 Ubuntu and check a box and everything gets encrypted.
43
44 So, basically other distros already need to support initramfs, and
45 they just keep going down a path of leveraging this further. It all
46 stems from their original decision to make one kernel to rule them
47 all, and make it modular so that it doesn't eat up half of RAM in
48 doing so.
49
50 > I saw it mentioned somewhere that a /run directory can be created.  Since it
51 > would likely be small, I wouldn't mind that.  I'd be fine if the same files
52 > were installed in both /usr/*bin and /run.
53
54 So, I believe the purpose of /run is to be a future location for what
55 currently goes in places like /var/run - this is state information,
56 sockets, etc that have no meaning after a reboot. Most likely it
57 would be implemented as a tmpfs or something along those lines. It
58 would not contain copies of anything in /usr/bin/etc. Then /var
59 becomes a place for caches that have meaning between reboots (spools,
60 etc).
61
62 Rich

Replies