FS#75552 - [lvm2] dmevent is not disabled in initramfs

Attached to Project: Arch Linux
Opened by eternalfloof (eternalfloof) - Monday, 08 August 2022, 18:07 GMT
Last edited by Christian Hesse (eworm) - Thursday, 11 August 2022, 08:32 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Christian Hesse (eworm)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The following line currently exists in /usr/lib/initcpio/install/lvm2
sed -i '/^\smonitoring =/s/1/0/' "${BUILDROOT}/etc/lvm/lvm.conf"

This line doesn't do anything because the sed pattern doesn't match.
The line it's trying to modify in /etc/lvm/lvm.conf is # monitoring = 1
and the leading # causes the pattern to not match.

This means that any lvm operation in early boot will try to talk to dmeventd and fail to do so.

I propose changing the line to be the following sed command:
sed -i 's/^\(\s\+\)#\? monitoring = [[:digit:]]\+\s*$/\1monitoring = 0/' "${BUILDROOT}/etc/lvm/lvm.conf"

Additional info:
* package version(s) 2.03.16-1
Commit which introduced the original line: https://github.com/archlinux/svntogit-packages/commit/ad603bd38d20cacf9f76168980c680c191462358

Steps to reproduce:
pacman -S lvm2
add lvm2 to the HOOKS section in /etc/mkinitcpio.conf
Build the initramfs mkinitcpio -P
Unpack the initramfs with cpio -id < your_initramfs
Navigate to etc/lvm/lvm.conf and note that the conf has not been changed - it is still a commented out # monitoring = 1
This task depends upon

Closed by  Christian Hesse (eworm)
Thursday, 11 August 2022, 08:32 GMT
Reason for closing:  Fixed
Additional comments about closing:  lvm2 2.03.16-2
Comment by Toolybird (Toolybird) - Thursday, 11 August 2022, 07:47 GMT
Upstream appears to have changed the line in question here [1]

[1] https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ca38251b
Comment by Christian Hesse (eworm) - Thursday, 11 August 2022, 07:58 GMT
Your pattern expects a space between (optional) hash and literal word "monitoring". Guess it requires an extra question mark, no?