Closed Damenly closed 3 months ago
Monitoring should be ALWAYS started when you are properly switched to the rootfs with existing /etc/lvm directory with its configuration and other directories available.
If these are NOT present - your ramdisk and switch to rootfs is certainly doing something very wrong.
Thus we cannot fix this in lvm2 - your system is in invalid state - and you should fix your startup sequence - probably check your dependencies for services.
Note - if you don't want to have /etc writable - you can rebuild lvm2 with location of this directory elsewhere - see the configure option - although be aware that users of such system will be confused when they will try to locate such files...
Thanks for your suggestion. I've realized that I forgot to add the directory creation after the feature enabled. BTW, Is it more recommended to send patches to linux-lvm@redhat.com other than github in 2024?
Sending patches with github is perfectly fine. However we try to handle patches & suggestions from all possible sources...
Our openQA recently reported lvm2-monitor.service fails to start since system.devices is enabled[1]. The cause is that lvm2-monitor.service,
lvm vgchange --monitor y
always tries to create /etc/lvm/devices/ even /etc/ is not ready to be written, journal_check-full_journal.log:Aug 04 14:42:49.238243 localhost systemd[1]: Starting Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling... ... Aug 04 14:42:49.249029 localhost lvm[1013]: Failed to create /etc/lvm/devices 2 Aug 04 14:42:49.249029 localhost lvm[1013]: Failed to set up devices. ... Aug 04 14:42:49.255674 localhost kernel: BTRFS info (device vda3 state M): enabling auto defrag Aug 04 14:42:49.255685 localhost kernel: BTRFS info (device vda3 state M): use lzo compression, level 0 ...
NOTE: this issue could happen on not only btrfs, but also other fses on slow matchines. It could be more frequent if /etc is a mountpoint which means a larger delay after sysroot.
Before this commit, if system.devices is enabled, every command which calls setup_devices_file() always creates /etc/lvm/devices/ unconditionally. However, not all of devices dir creations are necessary. We only need to create the directory before devices file creation.
Link: https://bugzilla.suse.com/show_bug.cgi?id=1228854