Gentoo Archives: gentoo-dev

From: Matthew Summers <quantumsummers@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] /usr vs. initramfs redux
Date: Fri, 05 Aug 2011 13:26:25
Message-Id: CAET+hMQGP-EAqhyXu2HgNz_SbCH_sS=YhsKR9D=R6n9RrA=Obw@mail.gmail.com
In Reply to: Re: [gentoo-dev] /usr vs. initramfs redux by Rich Freeman
1 On Fri, Aug 5, 2011 at 7:42 AM, Rich Freeman <rich0@g.o> wrote:
2 > On Fri, Aug 5, 2011 at 6:16 AM, Marc Schiffbauer <mschiff@g.o> wrote:
3 >> * Robin H. Johnson schrieb am 05.08.11 um 02:46 Uhr:
4 >> [...]
5 >>> That leaves the only reasonable solution as #2. In terms of minimal
6 >>> impact, I propose that we offer users with a static system an absolutely
7 >>> minimal initramfs, that _just_ mounts the required directories.  No
8 >>> modules, no LVM, no MD, no crypto etc - if you want that functionality,
9 >>> go and use genkernel or dracut. If your fstab contains a line like:
10 >>> /dev/sdXN /usr ...
11 >>> Then this initramfs is for you.
12 >>>
13 >>> The minimal initramfs would do the following.
14 >>>
15 >>> 1. Mount devtmpfs/sysfs/procfs as needed to access devices.
16 >>> 2. Mount real_root to /newroot
17 >>> 3. Read /newroot/etc/initramfs.mount and /newroot/etc/fstab
18 >>> 4.1. If /newroot/etc/initramfs.mount does not exist
19 >>>      Assume it contains only: /usr /var
20 >>> 5. Mount the combined items from said files
21 >>> 6. pivot_root.
22 >>>
23 >>
24 >> That sounds like a good compromise to me!
25 >
26 > Why would we build yet another initramfs vs just making dracut work
27 > reliably?  You can already build dracut without support for
28 > lvm+raid+luks/etc.
29 >
30 > If we're going to require an initramfs then we should make sure that
31 > ALL gentoo-provided solutions work before we expand the need for a
32 > mounted /usr.  The genkernel team already mentioned that they plan to
33 > switch to dracut, so we really just need to get dracut working
34 > properly.
35 >
36 > That said, nobody is preventing anybody from re-inventing the wheel if
37 > they wish to do so.  I just wouldn't just offer it up as an example of
38 > a perfectly acceptable migration strategy, when we've had a lvm+raid
39 > howto for years that wouldn't be compatible with it.
40 >
41 > Rich
42 >
43 >
44
45 In point of fact all modern Linux kernels have an initramfs built in
46 now, that when empty is effectively bypassed, so there is no wheel
47 reinvention. To quote the docs [1]
48 "
49 All 2.6 Linux kernels contain a gzipped "cpio" format archive, which is
50 extracted into rootfs when the kernel boots up. After extracting, the kernel
51 checks to see if rootfs contains a file "init", and if so it executes it as PID
52 1. If found, this init process is responsible for bringing the system the
53 rest of the way up, including locating and mounting the real root device (if
54 any). If rootfs does not contain an init program after the embedded cpio
55 archive is extracted into it, the kernel will fall through to the older code
56 to locate and mount a root partition, then exec some variant of /sbin/init
57 out of that.
58 "
59 [1] /usr/src/linux/Documentation/filesystems/ramfs-rootfs-initramfs.txt
60
61 While dracut may help with the process of creating the initramfs, its
62 really not a terribly complicated endeavor, and from further reading
63 (specifically as related to the desired removal of md autodetection),
64 it is the full intention of the kernel upstream that initramfs be the
65 new path forward in handling things such as separate /usr, raid
66 volumes, and so on. Further, dracut will introduce yet another dep in
67 base-system (I am guessing here), that is not more than perhaps a
68 convenience. I note here, that I have not used dracut as the well
69 documented method of creating an initramfs is straight forward enough
70 that I did not require anything too fancy to handle mounting raid1
71 volumes, and providing a recovery environment with networking and ssh.
72
73 This, at least to me, seems like an excellent opportunity to nicely
74 document what can be done with an initramfs (in basic and advanced
75 forms, as there are some really fancy things one can do with
76 initramfs's), and how Gentoo is recommending their usage in the cases
77 outlined by Robin and others.
78
79 So, I am +1 on robbat2's solution and -1 on dracut. That said, I am
80 fully willing to alter my position when presented with a better
81 argument. Lastly, I do have a few minor concerns about how this
82 "default" initramfs will be dealt with, however those can wait.
83 Mainly, I simply desire the flexibility to replace the Gentoo-shipped
84 version with a custom version easily.
85
86 Thanks and kind regards,
87 Matt
88
89 --
90 Matthew W. Summers
91 Gentoo Foundation Inc.

Replies

Subject Author
Re: [gentoo-dev] /usr vs. initramfs redux Rich Freeman <rich0@g.o>
Re: [gentoo-dev] /usr vs. initramfs redux Sven Vermeulen <sven.vermeulen@××××××.be>