Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] systemd and initramfs
Date: Tue, 20 Aug 2013 06:55:03
Message-Id: CADPrc83V4pfECT3i47f8Yk4CV-HJ3H43esTtMgf9jqbCfizE_w@mail.gmail.com
In Reply to: Re: [gentoo-user] systemd and initramfs by Helmut Jarausch
1 On Tue, Aug 20, 2013 at 1:44 AM, Helmut Jarausch
2 <jarausch@××××××××××××××××.de> wrote:
3 > On 08/19/2013 04:55:29 PM, Mike Gilbert wrote:
4 >>
5 >> On Mon, Aug 19, 2013 at 5:58 AM, Helmut Jarausch
6 >> <jarausch@××××××××××××××××.de> wrote:
7 >> > Hi,
8 >> >
9 >> > what binaries and libraries have to be put into an initramfs for a
10 >> > system
11 >> > booting with init=/usr/lib/systemd/systemd ?
12 >> > (I am building the initramsfs myself)
13 >> >
14 >>
15 >> You need to get your root filesystem and /usr mounted. Just keep that
16 >> goal in mind and start adding files to support it.
17 >>
18 >> There doesn't need to be anything systemd-specific.
19 >>
20 >
21 > I am not sure about "timing".
22 >
23 > Initially the kernel has only the "mini" /usr partition contained within the
24 > initramfs.
25 > Then it switches to "real root" and only then it tries to mount the "real"
26 > /usr partition.
27 > Does this all happen before the kernel hands control over to the init
28 > process (i.e. systemd) ?
29
30 No, the kernel has a mini filesystem (doesn't matter which directory
31 structure has inside), and it executes the init script (or binary
32 program) in the root of the initramfs. This init program/script is the
33 responsible for mounting the real root and other partitions, and
34 handling control over to systemd (or OpenRC, or whatever).
35
36 Dracut is able to create an initramfs (with the systemd Dracut module)
37 that executes systemd inside the initramfs, which mounts /usr,
38 switches to the real root, and gives control to the "real" systemd
39 instance. At shutdown, the reverse happens: the "real" systemd
40 surrenders control to the initramfs systemd, it umounts everything,
41 and finish the shutdow process.
42
43 If you generate an initramfs with Dracut using the systemd module, the
44 init inside the initramfs is a link to /usr/lib/systemd/systemd.
45
46 Unless you want to learn the ins and outs of using an initramfs (and
47 having a lot of fun and failed boots in the process), I highly
48 recommend using Dracut. It does everything for you.
49
50 Regards.
51 --
52 Canek Peláez Valdés
53 Posgrado en Ciencia e Ingeniería de la Computación
54 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] systemd and initramfs Helmut Jarausch <jarausch@××××××××××××××××.de>
Re: [gentoo-user] systemd and initramfs Tanstaafl <tanstaafl@×××××××××××.org>
Re: [gentoo-user] systemd and initramfs Walter Dnes <waltdnes@××××××××.org>
Re: [gentoo-user] systemd and initramfs "Stefan G. Weichinger" <lists@×××××.at>