Gentoo Archives: gentoo-user

From: Michael Mair-Keimberger <m.mairkeimberger@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] difficulties with lvm2+systemd+grub2
Date: Wed, 12 Nov 2014 09:53:41
Message-Id: 20141112094758.GE25089@getafix
In Reply to: Re: [gentoo-user] difficulties with lvm2+systemd+grub2 by covici@ccs.covici.com
1 On Tue, Nov 11, 2014 at 05:13:16PM -0500, covici@××××××××××.com wrote:
2 > Michael Mair-Keimberger <m.mairkeimberger@×××××.com> wrote:
3 >
4 > > Hi List,
5 > >
6 > > Today I've started to play around with systemd but so far I couldn't get
7 > > it to boot. I've followed the how to from the gentoo wiki [1], but I
8 > > stuck somehow.
9 > >
10 > > My configuration:
11 > > rootfs is on lvm2 (no encryption or raid). I just use it for being able
12 > > creating snapshot/backups of the running system.
13 > > Grub is on /dev/sda2 which is a simple ext2 partition with a custom
14 > > grub.cfg. A Grub entry looks like that:
15 > >
16 > > ###
17 > > menuentry 'gentoo amd64 gnome' {
18 > > linux /gentoo-3.16.5-n lvm=gentoo_amd64_gnome
19 > > initrd /initrd.cpio.gz
20 > > }
21 > > ###
22 > >
23 > > Don't get confused about the "lvm" flag. This just get passed to my very
24 > > simple custom initramfs which looks like this:
25 > >
26 > > ###
27 > > #!/bin/busybox sh
28 > >
29 > > cmdline() {
30 > > local value
31 > > value=" $(cat /proc/cmdline) "
32 > > value="${value##* $1=}"
33 > > value="${value%% *}"
34 > > [ "$value" != "" ] && echo "$value"
35 > > }
36 > > # Mount the /proc and /sys filesystems.
37 > > mount -t proc none /proc
38 > > mount -t sysfs none /sys
39 > > mount -t devtmpfs none /dev
40 > >
41 > > lvm vgscan
42 > > lvm vgchange -ay vg0
43 > > lvm vgscan --mknodes
44 > >
45 > > # Mount the root filesystem.
46 > > mount -o ro /dev/mapper/vg0-$(cmdline lvm) /mnt/root
47 > >
48 > > # Clean up.
49 > > umount /proc
50 > > umount /sys
51 > > umount /dev
52 > >
53 > > # Boot the real thing.
54 > > exec switch_root /mnt/root /sbin/init
55 > > ###
56 > >
57 > > So far this works great for me. However, with systemd I had some
58 > > difficulties how to correctly configure the system and grub2 in order to
59 > > boot with systemd.
60 > >
61 > > This is what i did so far:
62 > >
63 > > For systemd i've created a new initramfs with genkernel and changed the
64 > > grub config like the following entry:
65 > >
66 > > ###
67 > > menuentry 'gentoo amd64 gnome systemd' {
68 > > linux /gentoo-3.16.5-n root=UUID=1eb94a2b-40d7-4556-9102-0320efd04adc init=/usr/lib/systemd/systemd
69 > > initrd /initramfs-genkernel-x86_64-3.16.5-gentoo
70 > > }
71 > > ###
72 > >
73 > > Systemd installation went without problems (it's a base system without
74 > > any wm's installed atm), but even though the grub2 changes were quite
75 > > easy and I've used the genkernel initramfs instead of mine I still get a
76 > > kernel panic on boot (have a look at the attached picture).
77 > > I've also checked the kernel config for having the required systemd
78 > > configurations enabled.
79 > >
80 > > Anyone has some ideas what might be wrong?
81 > >
82 > > Furthermore I've also have some questions about lvm2+systemd. Hope
83 > > someone can give me some answers :)
84 > >
85 > > First of all, with systemd installed I can't install lvm2 with the
86 > > static use flag anymore, which is mandatory for being able using it for
87 > > a initramfs. Why isn't that possible? How can I use the lvm binaries for
88 > > my initramfs?
89 > >
90 > > This lead me to my second question. At the wiki, the only way to create
91 > > an initramfs for systemd was with genkernel (genkernel --udev --lvm).
92 > > While the command itself is pretty useless (it's `genkernel --udev --lvm
93 > > initramfs` if you want to create the initramfs -> is this a bug??) i
94 > > also would like to use my own initramfs.
95 > > What changes do i have to make in my own initramfs for being able
96 > > booting systemd from it?
97 >
98 > I would use dracut to generate the initramfs and use rd.lvm.vg= to
99 > activate your volume group and specify the init as the exact location
100 > of the systemd binary -- then you don't need static or anything, dracut
101 > will automatically put in the appropriate libraries, and also check the
102 > file systems upon boot. Much better if you need to use systemd.
103 >
104 > Hope this helps.
105
106 Dracut was already mentioned. I'll give it a try later that day. Regarding your
107 "rd.lvm.vg=" flag. I guess should be put into the grub2 entry, shouldn't
108 it?
109
110 Anyway, thanks for sharing :)
111 >
112 > --
113 > Your life is like a penny. You're going to lose it. The question is:
114 > How do
115 > you spend it?
116 >
117 > John Covici
118 > covici@××××××××××.com
119 >
120
121 --
122 greetings
123 Michael Mair-Keimberger

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] difficulties with lvm2+systemd+grub2 "Stefan G. Weichinger" <lists@×××××.at>
Re: [gentoo-user] difficulties with lvm2+systemd+grub2 covici@××××××××××.com