pvscan in udev rules - systemd and bookworm

andrew bezella abezella at archive.org
Sat May 25 02:44:03 CEST 2024


On Tue, 2022-09-06 at 15:07 -0700, andrew bezella wrote:
[...]
> when a logical volume exists on a metadevice then that lv was being
> activated soon after the completion of `mdadm --assemble --scan --
> config=/tmp/fai/mdadm-from-examine.conf`.  this caused the subsequent
> `mdadm -W --stop` loop to fail when it reached that md:
> (CMD) mdadm -W --stop /dev/md5 1> /tmp/RhKvizyXZk 2> /tmp/DrTvcNhaf6
> Executing: mdadm -W --stop /dev/md5
> (STDERR) mdadm: Cannot get exclusive access to /dev/md5:Perhaps a
> running process, mounted filesystem or active volume group?
> mdadm -W --stop /dev/md5 had exit code 1
> (STDERR) mdadm: Cannot get exclusive access to /dev/md5:Perhaps a
> running process, mounted filesystem or active volume group?
> Command had non-zero exit code
> 
[...]
> if/when FAI migrates to systemd this may raise its head again.

hello -

this did pop up again with bookworm, where `/lib/udev/rules.d/69-
lvm.rules` is now running the `pvscan` and `vgchange`. commit
64f85a3[1] explicitly looks for `$NFSROOT/etc/udev/rules.d/69-lvm-
metad.rules` to patch. the patch wouldn't apply anyway as the logic has
changed considerably. however, it now respects the value of
`event_activation` in lvm.conf:
# If event_activation=0 in lvm.conf, this pvscan
# (using checkcomplete) will do nothing, so that
# no event-based autoactivation will be happen.

this means that an nfsroot-hook similar to the following can be used:
#!/bin/sh

echo "[$(date +'%Y-%m-%dT%H:%M:%S%z')]: disable lvm event-based autoactivation"
$ROOTCMD sed --in-place --expression='s/# event_activation = 1$/event_activation = 0/' /etc/lvm/lvm.conf

i haven't tested this extensively but it fixes the issue i encountered
with existing logical volumes on a raid1 array. it restores the
previous behavior of FAI with buster and (patched) bullseye nfsroots
and may be a prerequisite for LVM on RAID with preserve_reinstall[2]. i
am unsure if it is a general-enough fix to include upstream but i hope
it helps if someone else has a similar issue.

andy

   1. https://github.com/faiproject/fai/commit/64f85a332864b64b44904319
      9c499f6e43cf5f42
   2. https://lists.uni-koeln.de/pipermail/linux-fai/2023-
      November/013090.html

-- 
andrew bezella <abezella at archive.org> internet archive


More information about the linux-fai mailing list