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: Mon, 17 Nov 2014 20:39:37
Message-Id: 20141117203944.GA2580@asterix
In Reply to: Re: [gentoo-user] difficulties with lvm2+systemd+grub2 by wraeth
1 On Sun, Nov 16, 2014 at 12:21:37PM +1100, wraeth wrote:
2 > On Fri, Nov 14, 2014 at 07:43:18PM +0100, Michael Mair-Keimberger wrote:
3 > > Basically my changes in my grub config were already correct, however I
4 > > completely forgot, that, since I wrote my own init script, arg's like
5 > > "root" and "init" simply weren't used by my script...
6 > > If you look at my script, I only check the cmdline for "lvm", so
7 > > setting "init" or "root" haven't any effect at all :D
8 >
9 > Glad you got this part of it sorted! I know how both relieving and
10 > frustrating it can be to find such a simple thing as the solution - it
11 > took me two weeks to realise I was calling 'mpc' and not 'mpd' in my
12 > startup script, explaining why MPD was never running... :-/
13 >
14
15 Thanks!
16 Yeah, it can be really frustration, but it's worth the relieving feeling
17 when you found the bug :)
18
19 > > Regarding dracut: Even though I got it to work, it also just bootet
20 > > openrc and not systemd. Don't know why and I didn't digged further after
21 > > it worked with my own script.
22 >
23 > You could try inspecting dmesg to try and determine why it isn't loading
24 > your chosen init. It could be something as simple as a typo, or if the
25 > filesystem (if you have /usr on a separate partition) isn't available at
26 > the time it's trying to launch init.
27
28 Pretty sure! However, honestly I didn't look further into dracut for now
29 (maybe another day - if I want to know how they work with lvm). BTW,
30 with `dracut --print-cmdline` it prints you an example grub entry for
31 your system, however it's doesn't set "init" and I think (otherwise I
32 guess it would have work here) as long as you didn't already boot into
33 systemd it wouldn't use it too...
34
35 >
36 > > Regarding LVM:
37 > > As mentioned systemd can't mount my lvm partitions from fstab. Those lvm
38 > > partitions should be mounted by UUID, but it seems like systemd can't
39 > > find them, even though there are available afterwards (under
40 > > /dev/vg0/...).
41 >
42 > I've found dracut initrd's can be a little finicky with LVM volumes.
43 > With that in mind, here's the kernel cmdline for one of my systems wich
44 > uses LUKS->LVM->EXT4 for it's root partition. Note that it has explicit
45 > arguments for *all* LV's and not just root.
46 >
47 > BOOT_IMAGE=/vmlinuz-3.17.1-gentoo-r1 root=/dev/mapper/vg1-root ro
48 > rd.luks.uuid=luks-3f93b8aa-cf8b-4312-85d6-d45cffa59780
49 > rd.lvm.lv=vg1/swap rd.lvm.lv=vg1/root resume=/dev/mapper/vg1-swap
50 > rootflags=rw,noatime,data=ordered rootfstype=ext4 quiet
51 >
52 Thanks for sharing.
53 From dracut's manual (man dracut.cmdline), rd.lvm.lv only activates
54 given logical volumes, which should be the same like `vgchange -a y`
55 (however i didn't look what exactly dracut does here).
56 Since I'm already doing `vgchange -a y` in my init script, these logical
57 volumes should be available for systemd.
58 I've also checked for systemd's lvm service (lvm2-lvmetad.service) to
59 make sure it's enabled and starts on boot, but it didn't changed
60 anything.
61
62 However, for now I just read-only mount these lv's directly via my init
63 script and remount them write-able via /etc/local.d/*.start
64 script's (glad to see systemd can make use of these scripts :) )
65
66 > > If I comment them out in /etc/fstab (they are not important) systemd
67 > > boots just fine. I've also set "use_lvmetad = 1" in /etc/lvm/lvm.conf as
68 > > mentioned at the systemd wiki.
69 >
70 > This is a dracut-ism, in that if a static filesystem (as denoted by it's
71 > presence in /etc/fstab) is unmountable, it will assume there are
72 > problems and will drop to recovery. The idea of recovery is to identify
73 > your root partition with a symlink to the device node, after which you
74 > *should* be able to continue.
75 >
76 > ln -s /dev/<root_device> /dev/root
77 >
78 > See [1] for more. That being said, it may continue to drop to recovery -
79 > I've found the dracut recovery console to be a little temperamental with
80 > things like that...
81 >
82 > [1]: http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
83
84 Hmm, not sure about that. I think you misunderstood me ;)
85 I wasn't drop into dracut's (or in this case in my initramfs) rescue
86 shell (if you meant that). I was drop into systemd maintaince mode,
87 which means after it couldn't mount these other lv's it stops all
88 services, keep / read only and ask for the root password. Done that I
89 was still able to remount / and all other partitions...
90 It seems like fstab's static filesystem are mandatory for systemd ;)
91 >
92 > Cheers;
93 > --
94 > wraeth <wraeth@×××××××××.au>
95 > GnuPG Key: B2D9F759
96
97 --
98 greetings
99 Michael Mair-Keimberger

Attachments

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