Gentoo Archives: gentoo-user

From: Helmut Jarausch <jarausch@××××××××××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] systemd and initramfs
Date: Tue, 20 Aug 2013 07:03:13
Message-Id: 1376982184.12493.4@numa-i.igpm.rwth-aachen.de
In Reply to: Re: [gentoo-user] systemd and initramfs by "Canek Peláez Valdés"
1 On 08/20/2013 08:54:26 AM, Canek Peláez Valdés wrote:
2 > On Tue, Aug 20, 2013 at 1:44 AM, Helmut Jarausch
3 > <jarausch@××××××××××××××××.de> wrote:
4 > > On 08/19/2013 04:55:29 PM, Mike Gilbert wrote:
5 > >>
6 > >> On Mon, Aug 19, 2013 at 5:58 AM, Helmut Jarausch
7 > >> <jarausch@××××××××××××××××.de> wrote:
8 > >> > Hi,
9 > >> >
10 > >> > what binaries and libraries have to be put into an initramfs for
11 > a
12 > >> > system
13 > >> > booting with init=/usr/lib/systemd/systemd ?
14 > >> > (I am building the initramsfs myself)
15 > >> >
16 > >>
17 > >> You need to get your root filesystem and /usr mounted. Just keep
18 > that
19 > >> goal in mind and start adding files to support it.
20 > >>
21 > >> There doesn't need to be anything systemd-specific.
22 > >>
23 > >
24 > > I am not sure about "timing".
25 > >
26 > > Initially the kernel has only the "mini" /usr partition contained
27 > within the
28 > > initramfs.
29 > > Then it switches to "real root" and only then it tries to mount the
30 > "real"
31 > > /usr partition.
32 > > Does this all happen before the kernel hands control over to the
33 > init
34 > > process (i.e. systemd) ?
35 >
36 > No, the kernel has a mini filesystem (doesn't matter which directory
37 > structure has inside), and it executes the init script (or binary
38 > program) in the root of the initramfs. This init program/script is the
39 > responsible for mounting the real root and other partitions, and
40 > handling control over to systemd (or OpenRC, or whatever).
41 >
42 > Dracut is able to create an initramfs (with the systemd Dracut module)
43 > that executes systemd inside the initramfs, which mounts /usr,
44 > switches to the real root, and gives control to the "real" systemd
45 > instance. At shutdown, the reverse happens: the "real" systemd
46 > surrenders control to the initramfs systemd, it umounts everything,
47 > and finish the shutdow process.
48 >
49 > If you generate an initramfs with Dracut using the systemd module, the
50 > init inside the initramfs is a link to /usr/lib/systemd/systemd.
51 >
52 > Unless you want to learn the ins and outs of using an initramfs (and
53 > having a lot of fun and failed boots in the process), I highly
54 > recommend using Dracut. It does everything for you.
55 >
56
57 Yes, I'd like to generate the initramfs myself and let the kernel store
58 it within
59 its binary on /boot. This has been working just fine with openrc. Now I
60 only need
61 to now the additional requirements when using systemd as init process.
62
63 I'll have a look at what Dracut is doing.
64
65 Thanks to you and Alan,
66 Helmut