Gentoo Archives: gentoo-user

From: thegeezer <thegeezer@×××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] systemd and initramfs
Date: Wed, 21 Aug 2013 07:06:28
Message-Id: 521466E5.3080005@thegeezer.net
In Reply to: Re: [gentoo-user] systemd and initramfs by "Canek Peláez Valdés"
1 On 08/21/2013 02:13 AM, Canek Peláez Valdés wrote:
2 > On Tue, Aug 20, 2013 at 7:32 PM, Walter Dnes <waltdnes@××××××××.org> wrote:
3 >> On Tue, Aug 20, 2013 at 01:54:26AM -0500, Canek Peláez Valdés wrote
4 >>> No, the kernel has a mini filesystem (doesn't matter which directory
5 >>> structure has inside), and it executes the init script (or binary
6 >>> program) in the root of the initramfs. This init program/script is the
7 >>> responsible for mounting the real root and other partitions, and
8 >>> handling control over to systemd (or OpenRC, or whatever).
9 >>>
10 >>> Dracut is able to create an initramfs (with the systemd Dracut module)
11 >>> that executes systemd inside the initramfs, which mounts /usr,
12 >>> switches to the real root, and gives control to the "real" systemd
13 >>> instance. At shutdown, the reverse happens: the "real" systemd
14 >>> surrenders control to the initramfs systemd, it umounts everything,
15 >>> and finish the shutdow process.
16 >> A possibly stupid question from a non-user of initramfs... why not
17 >> simply treat the initramfs as "the real system"? This would avoid the
18 >> hand-off to a second fs at start-up, and the reverse process at
19 >> shutdown.
20 you need as much memory as your / partition if you want to do this. it
21 is a good way of making a livecd if you know you are guaranteed the
22 memory, as once booted it no longer requires the cd (faster reads).
23 this boot time ramfs is released once unmounted so even if you have a
24 100MB initrd you get this memory back after boot normally.
25 not sure how unionFS works these days, previously i was using AUFS2 as
26 union didn't provide enough good features for me. but the premise is to
27 mount ramfs as readonly and then mount real_root as writable over the
28 top. again you stil have memory issues doing this; while memory is
29 cheap not all boards (intel atom) support huge amounts of memory.
30
31 > If I understand correctly, because it's a ramfs, as its name implies
32 > (it lives on your RAM). You don't want it to hold all your system,
33 > only the necessary parts to mount the filesystems necessary to boot.
34 >
35 >> There would be no need to worry about keeping files synced in
36 >> 2 different locations, because there would only be one location.
37 > The worry about falling out of sync, although justified, I think it's
38 > a little overreacted; even for things like LVM2 and NFS, how many
39 > times changes the metadata or format used by different versions?
40 > Normal filesystems present no problems: almost all of them are
41 > future-proof.
42 It happened to me just last week with LVM, and it wasn't a metadata
43 issue, it was a user space program/ service loaded service running issue.
44 > update LVM2
45 > kernel remains the same
46 > reboot
47 > initramfs finds all PVS and activates VG
48 > main system init
49 > /etc/init.d/lvm2 start
50 > error can't read from USB PVS
51 > login to system with missing PVS
52 > /etc/init.d/lvm2 restart
53 > all PVS listed
54 > reboot several times to verify it wasn't just a stuck service, exactly
55 the same
56 > now ok but restarting a boot service manually required (!)
57 I updated the initramfs and rebooted and all problems went away
58
59 > And (as Allan suggested) you can (easily and automagically) regenerate
60 > the initramfs everytime sometimes inside it changes.
61 >
62 >> If
63 >> necessary, one could use UnionFS http://en.wikipedia.org/wiki/Unionfs to
64 >> make the hard drive and userspace stuff all look like part of the
65 >> initramfs.
66 > No unionfs has been accepted in the mainline kernel, although several
67 > have been proposed. It's a hard problem, and nothing has satisfied the
68 > kernel devs until now.
69 >
70 > The initramfs has several advantages: it's supported directly by the
71 > kernel, it works the same from embedded systems to big iron servers,
72 > and it just works.
73 >
74 > I just installed two systems (a server and a desktop) to systemd
75 > directly, and Dracut just worked. And I like that now my kernels have
76 > *EVERYTHING* as a module (that can be compiled as module). Even the
77 > filesystems!
78 >
79 > Regards.

Replies

Subject Author
Re: [gentoo-user] systemd and initramfs Tanstaafl <tanstaafl@×××××××××××.org>