Gentoo Archives: gentoo-dev

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] /usr vs. initramfs redux
Date: Fri, 05 Aug 2011 00:46:59
Message-Id: robbat2-20110805T001955-101571826Z@orbis-terrarum.net
In Reply to: Re: [gentoo-dev] Warn users not to do separate /usr partition without proper initramfs in the handbook? by Rich Freeman
1 I've mainly said out of this discussion until now, because I've been
2 quite busy.
3
4 The root problem here is that there are starting to be a lot of cases
5 where rule run by udev require that /usr [1] and potentially /var [2] or
6 more are available when the udev rule runs.
7
8 To the best of my knowledge, udev has no way of knowing that the
9 relevant directory structures might not yet be available.
10
11 Moving the binaries out of /usr into / is a band-aid at best, and
12 potentially a giant nightmare because we have to trace down every binary
13 run by every rule. Then data-files also need to be considered.
14
15 There are only two solutions available, one of which has two variants.
16 1. Allow udev to delay running a rule until the volumes are available.
17 2. Ensure /usr and /var are available when udev starts, two possible
18 ways:
19 2.1. Merge /usr and /var to /.
20 2.2. Initramfs to mount them.
21
22 Gregkh et al can speak to #1, and I think they will concur with me that
23 it's not a reasonable change to put in udev (it belongs in whatever is
24 starting the services and mounting those directory structures).
25
26 That leaves the only reasonable solution as #2. In terms of minimal
27 impact, I propose that we offer users with a static system an absolutely
28 minimal initramfs, that _just_ mounts the required directories. No
29 modules, no LVM, no MD, no crypto etc - if you want that functionality,
30 go and use genkernel or dracut. If your fstab contains a line like:
31 /dev/sdXN /usr ...
32 Then this initramfs is for you.
33
34 The minimal initramfs would do the following.
35
36 1. Mount devtmpfs/sysfs/procfs as needed to access devices.
37 2. Mount real_root to /newroot
38 3. Read /newroot/etc/initramfs.mount and /newroot/etc/fstab
39 4.1. If /newroot/etc/initramfs.mount does not exist
40 Assume it contains only: /usr /var
41 5. Mount the combined items from said files
42 6. pivot_root.
43
44 This initramfs explicitly needs to be rebuilt extremely seldom, because
45 it reads everything from the real root. (Having the debug interface like
46 genkernel initramfs would be nice in case the user breaks their fstab,
47 but isn't required).
48
49 There's a couple of other tweaks/improvements that might be useful, like
50 supporting UUIDs and LABELs for devices.
51
52 [1]:
53 Besides the binaries run from /usr, I've seen broken rules because they
54 failed USB/PCI identification, because /usr/share/misc/pci.ids and
55 /usr/share/misc/usb.ids were on /usr.
56
57 [2]:
58 These are the ones on my desktop that reference /var:
59 app-admin/system-config-printer-common: /lib/udev/udev-configure-printer
60 sys-fs/udev: /lib/udev/udev-acl
61 sci-geosciences/gpsd: /lib/udev/gpsd.hotplug
62 /lib/udev/rules.d/90-alsa-restore.rules:
63 - alsactl restore needs /var/lib/alsa/asound.state
64
65
66
67
68 On Thu, Aug 04, 2011 at 12:00:09PM -0400, Rich Freeman wrote:
69 > On Thu, Aug 4, 2011 at 11:46 AM, Greg KH <gregkh@g.o> wrote:
70 > > Also, again, this is an upstream issue, based on the packages you have
71 > > installed, not anything that has changed in the distro itself.  Upstream
72 > > is also working to resolve the issue already, by mounting /usr from the
73 > > initramfs, to keep this sane, so people shouldn't really have to worry
74 > > about this too much, unless they don't use an initramfs...
75 >
76 > Agree. The news was a little shocking to me actually - I had no idea
77 > people were doing this. I suspect it just happened as things like
78 > udev went from enhancements used when you inserted something in a
79 > pcmcia slot to core features used to get everything from your hard
80 > drive to your mouse to work.
81 >
82 > The more I think about it, the more it seems like we're stuck going
83 > the initramfs route unless we want to become Gentoo vs the world.
84 > Dropping support for udev clearly isn't going to be a practical
85 > option, and the number of changes we'd have to make to get it and its
86 > dependencies out of /usr is going to be a challenge.
87 >
88 > I suspect that in the end we're either going to end up requiring
89 > initramfs, or we're going to end up implementing what is otherwise in
90 > dracut in openrc to get those drives mounted much earlier.
91 >
92 > Gentoo is a bit unusual in not requiring initramfs in the first place.
93 > We can get away it mostly because everybody customizes their
94 > kernels/grub/etc anyway. If you're a binary distro and want a one
95 > bzImage/grub.conf fits all then you need a fancy initramfs to make it
96 > work.
97 >
98 > Rich
99 >
100
101 --
102 Robin Hugh Johnson
103 Gentoo Linux: Developer, Trustee & Infrastructure Lead
104 E-Mail : robbat2@g.o
105 GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85

Replies

Subject Author
Re: [gentoo-dev] /usr vs. initramfs redux Marc Schiffbauer <mschiff@g.o>
Re: [gentoo-dev] /usr vs. initramfs redux William Hubbs <williamh@g.o>