Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 724474 - sys-kernel/dracut patch required for sys-fs/lvm2-2.02.187-r2 because it fails to activate any logical volumes
Summary: sys-kernel/dracut patch required for sys-fs/lvm2-2.02.187-r2 because it fails...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Patrick McLean
URL:
Whiteboard:
Keywords: PATCH, PullRequest
Depends on:
Blocks:
 
Reported: 2020-05-21 17:34 UTC by Liam Dennehy
Modified: 2020-08-07 16:59 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
rdsosreport.txt (rdsosreport-broken.txt,386.58 KB, text/plain)
2020-05-21 17:35 UTC, Liam Dennehy
Details
emerge --info sys-kernel/dracut-049-r3 (emergeinfo-dracut-049-r3,6.25 KB, text/plain)
2020-05-22 20:54 UTC, Liam Dennehy
Details
emerge --info sys-fs/lvm2-2.02.187-r2 (emergeinfo-lvm2-2.02.187-r2,5.99 KB, text/plain)
2020-05-22 20:55 UTC, Liam Dennehy
Details
dracut.patch (dracut.patch,883 bytes, text/plain)
2020-05-23 14:58 UTC, Alexander Tsoy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Liam Dennehy 2020-05-21 17:34:40 UTC
Trying to boot with initramfs and all possible cmdline args (rd.auto,rd.lvm,rd.lvm.vg etc) causes no LVs to activate and root to not be discovered.

Using sys-fs/lvm2-2.02.184-r5 causes no issues. 

Reproducible: Always

Steps to Reproduce:
1. Using sys-fs/lvm2-2.02.187-r2 compile initramfs using sys-kernel/dracut-049-r3
2. Boot with any relevant dracut.cmdline flags (rd.auto=1,rd.lvm=1,rd.lvm.vg=<vg> etc)

Actual Results:  
dracut-initqueue times out waiting for root. All LVs remain inactive.

lvm lvdisplay shows:
  LV Status              NOT available


Expected Results:  
LVs in criteria of cmdline (or all LVs) actived

lvm lvdisplay shows:
  LV Status              available
Comment 1 Liam Dennehy 2020-05-21 17:35:18 UTC
Created attachment 640772 [details]
rdsosreport.txt
Comment 2 Jonas Stein gentoo-dev 2020-05-22 18:57:19 UTC
Thank you for the report. We need to have all information at hand before ticket assignment. That is why I ask you to 
* paste the emerge info 
as described on https://wiki.gentoo.org/wiki/Attach_the_logs_to_the_bug_ticket
Please reopen this ticket (Status:UNCONFIRMED) afterwards.
Comment 3 Liam Dennehy 2020-05-22 20:54:46 UTC
Created attachment 640936 [details]
emerge --info sys-kernel/dracut-049-r3
Comment 4 Liam Dennehy 2020-05-22 20:55:23 UTC
Created attachment 640938 [details]
emerge --info sys-fs/lvm2-2.02.187-r2
Comment 5 Liam Dennehy 2020-05-22 20:56:29 UTC
Unsure if cause is dracut not using lvm2 correctly, or lvm2 changed api so included emerge-info from both packages.
Comment 6 Alexander Tsoy 2020-05-23 13:41:21 UTC
udev should not run lvm2-pvscan@.service inside initramfs. Corresponding line should be removed from /lib/udev/rules.d/69-dm-lvm-metad.rules (see /usr/lib/dracut/modules.d/90lvm/module-setup.sh).

Please show the output of:

lsinitrd <path_to_initramfs> lib/udev/rules.d/69-dm-lvm-metad.rules | grep 'SYSTEMD_WANTS'
lsinitrd <path_to_initramfs> etc/lvm/lvm.conf | grep use_lvmetad


From your logs:

[    8.282062] myhost systemd[1]: lvm2-pvscan@8:96.service: Trying to enqueue job lvm2-pvscan@8:96.service/start/fail
[    8.282208] myhost systemd[1]: lvm2-pvscan@8:114.service: Failed to load configuration: No such file or directory
[    8.282688] myhost systemd[1]: lvm2-pvscan@8:114.service: Trying to enqueue job lvm2-pvscan@8:114.service/start/fail
[    8.283247] myhost systemd[1]: lvm2-pvscan@8:146.service: Failed to load configuration: No such file or directory
[    8.283460] myhost systemd[1]: lvm2-pvscan@8:146.service: Trying to enqueue job lvm2-pvscan@8:146.service/start/fail
[    8.283483] myhost systemd[1]: lvm2-pvscan@8:130.service: Failed to load configuration: No such file or directory
[    8.283724] myhost systemd[1]: lvm2-pvscan@8:130.service: Trying to enqueue job lvm2-pvscan@8:130.service/start/fail
[    8.284120] myhost systemd[1]: lvm2-pvscan@8:80.service: Failed to load configuration: No such file or directory
[    8.284468] myhost systemd[1]: lvm2-pvscan@8:80.service: Trying to enqueue job lvm2-pvscan@8:80.service/start/fail
[    8.290130] myhost systemd[1]: lvm2-pvscan@8:0.service: Failed to load configuration: No such file or directory
[    8.293151] myhost systemd[1]: lvm2-pvscan@8:0.service: Trying to enqueue job lvm2-pvscan@8:0.service/start/fail
[    8.380419] myhost systemd[1]: lvm2-pvscan@8:32.service: Failed to load configuration: No such file or directory
[    8.383144] myhost systemd[1]: lvm2-pvscan@8:32.service: Trying to enqueue job lvm2-pvscan@8:32.service/start/fail
[    8.400793] myhost systemd[1]: lvm2-pvscan@8:48.service: Failed to load configuration: No such file or directory
[    8.403611] myhost systemd[1]: lvm2-pvscan@8:48.service: Trying to enqueue job lvm2-pvscan@8:48.service/start/fail
[    8.403651] myhost systemd[1]: lvm2-pvscan@8:64.service: Failed to load configuration: No such file or directory
[    8.406300] myhost systemd[1]: lvm2-pvscan@8:64.service: Trying to enqueue job lvm2-pvscan@8:64.service/start/fail
[    8.406334] myhost systemd[1]: lvm2-pvscan@8:16.service: Failed to load configuration: No such file or directory
[    8.408644] myhost systemd[1]: lvm2-pvscan@8:16.service: Trying to enqueue job lvm2-pvscan@8:16.service/start/fail
Comment 7 Alexander Tsoy 2020-05-23 13:43:46 UTC
Also I don't see any changes in udev rules between lvm2-2.02.184 and 2.02.187:

$ git diff v2_02_184..v2_02_187 udev/ | cat
diff --git a/udev/69-dm-lvm-metad.rules.in b/udev/69-dm-lvm-metad.rules.in
index 2ff8ddc31..d51006496 100644
--- a/udev/69-dm-lvm-metad.rules.in
+++ b/udev/69-dm-lvm-metad.rules.in
@@ -110,7 +110,6 @@ LABEL="systemd_background"
 #  other |    X     |      X      |       X        |                   |   X
 ACTION!="remove", ENV{LVM_PV_GONE}=="1", RUN+="(BINDIR)/systemd-run (LVM_EXEC)/lvm pvscan --cache $major:$minor", GOTO="lvm_end"
 ENV{SYSTEMD_ALIAS}="/dev/block/$major:$minor"
-ENV{ID_MODEL}="LVM PV $env{ID_FS_UUID_ENC} on /dev/$name"
 ENV{SYSTEMD_WANTS}+="lvm2-pvscan@$major:$minor.service"
 GOTO="lvm_end"
Comment 8 Liam Dennehy 2020-05-23 14:32:01 UTC
lsinitrd doesn't respect the lib -> lib64 symlink so needed to adjust the requested command:

host ~ # lsinitrd /boot/initramfs-5.4.38-gentoo.img lib64/udev/rules.d/69-dm-lvm-metad.rules | grep -nC2 'SYSTEMD_WANTS'
98-# In this case, we simply set up the dependency between the device and the pvscan
99-# job using SYSTEMD_ALIAS (which sets up a simplified device identifier that
100:# allows using "BindsTo" in the sytemd unit file) and SYSTEMD_WANTS (which tells
101-# systemd to start the pvscan job once the device is ready).
102-# We need to set these variables for both "add" and "change" events, otherwise
--
111-ACTION!="remove", ENV{LVM_PV_GONE}=="1", RUN+="/bin/systemd-run /sbin/lvm pvscan --cache $major:$minor", GOTO="lvm_end"
112-# No LVM pvscan in dracut - lvmetad is not running yet
113:ENV{SYSTEMD_WANTS}+="lvm2-pvscan@$major:$minor.service"
114-GOTO="lvm_end"
115-

host ~ # lsinitrd /boot/initramfs-5.4.38-gentoo.img etc/lvm/lvm.conf
global {
locking_type = 4
use_lvmetad = 0
}
Comment 9 Alexander Tsoy 2020-05-23 14:58:23 UTC
Created attachment 641156 [details]
dracut.patch

Turned out this is actually an old bug, so it maybe not what caused problem on your system. Anyway, could you try attached patch? If the problem persist, then please attach a new rdsosreport.txt.
Comment 10 Alexander Tsoy 2020-05-23 17:07:52 UTC
(In reply to Alexander Tsoy from comment #9)
> Created attachment 641156 [details]
> dracut.patch
I submitted this patch upstream [*]. To test it you can just drop it into "/etc/portage/patches/sys-kernel/dracut/" and re-emerge dracut.

[*] https://github.com/dracutdevs/dracut/pull/821
Comment 11 Liam Dennehy 2020-05-23 21:52:14 UTC
(In reply to Alexander Tsoy from comment #10)
> (In reply to Alexander Tsoy from comment #9)
> > Created attachment 641156 [details]
> > dracut.patch
> I submitted this patch upstream [*]. To test it you can just drop it into
> "/etc/portage/patches/sys-kernel/dracut/" and re-emerge dracut.
> 
> [*] https://github.com/dracutdevs/dracut/pull/821

Splendid, boots nicely now.

Looking at the patch I presume it as an assignment vs append issue? Also glad I anonymised my logs, didn't realise they'd end up on github ;-)

Took me ages to bisect the actual source component as it coincided with a bump from kernel 5.4.28 to 5.4.38 immediately after a major hardware upgrade, so thanks for the quick response here once I nailed it down!
Comment 12 Alexander Tsoy 2020-05-23 22:16:23 UTC
(In reply to Liam Dennehy from comment #11)
> Splendid, boots nicely now.
Nice! Thanks for testing.

> Looking at the patch I presume it as an assignment vs append issue?
Yeah, 69-dm-lvm-metad.rules was changed long ago, but dracut code was not adapted to it.

I wonder why I cannot reproduce this bug. Maybe it's a race somewhere and it's more likely to happen with multiple volume groups. Note that in the dracut environment lvm is activated via 64-lvm.rules, which should be processed before 69-dm-lvm-metad.rules.
Comment 13 Larry the Git Cow gentoo-dev 2020-08-07 16:59:36 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ccf6576c110503b33b71af18649d54568fe208a

commit 0ccf6576c110503b33b71af18649d54568fe208a
Author:     Alexander Tsoy <alexander@tsoy.me>
AuthorDate: 2020-08-05 00:18:41 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2020-08-07 16:59:23 +0000

    sys-kernel/dracut: Revbump 050, multiple upstream fixes
    
    * fix LVM activation
    * workaround for BTRFS mounts on slow machines
    * install NetworkManager initque/finished hook
    * POSIX shell compatibility fixes
    * remove deprecated "syslog" parameter from systemd units
    
    Closes: https://bugs.gentoo.org/724474
    Closes: https://bugs.gentoo.org/734166
    Signed-off-by: Alexander Tsoy <alexander@tsoy.me>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    Closes: https://github.com/gentoo/gentoo/pull/17004

 sys-kernel/dracut/dracut-050-r2.ebuild             | 171 +++++++++++++++
 .../050-btrfs-force-preload-btrfs-module.patch     |  30 +++
 ...sh-quote-variables-in-parameter-expansion.patch | 111 ++++++++++
 ...lvm-fix-removal-of-pvscan-from-udev-rules.patch |  26 +++
 ...ager-ensure-that-nm-run.sh-is-executed-wh.patch |  48 ++++
 ...-systemd-remove-obsolete-syslog-parameter.patch | 241 +++++++++++++++++++++
 6 files changed, 627 insertions(+)