Bug#774082: systemd: system with LVM and lvmetad does not bot after upgrade to jessie

Peter Rajnoha prajnoha at redhat.com
Thu Apr 23 09:40:33 UTC 2015


On 04/23/2015 11:04 AM, Michael Biebl wrote:
> Looking at the udev rule shipped by Debian's lvm2 package, it has:
> 
> 69-lvm-metad.rules:ACTION!="remove", ENV{LVM_PV_GONE}=="1",
> RUN+="/bin/systemd-run /sbin/lvm pvscan --cache $major:$minor",
> GOTO="lvm_end"
> 

That rule is to cover immediate removal of the PV by erasing
it's PV header directly (e.g. by running "dd"). So when the
device is still in the system, but it loses the PV abruptly.

In systemd environment, there should also be this rule
which updates lvmetad for each new PV that appears in the system:

  ENV{SYSTEMD_WANTS}="lvm2-pvscan@$major:$minor.service"

Make sure lvm2 is compiled with "--enable-udev-systemd-background-jobs",
this one is used by default since lvm2 v2.02.115, but you
need to enable that explicitly for previous versions... Otherwise
there would be a rule like:

RUN+="$env{LVM_SBIN_PATH}/lvm pvscan --background --cache --activate ay
--major $major --minor $minor", ENV{LVM_SCANNED}="1"

Which does not play well with systemd environment (long story behind
that...). Simply, any command where we need to be sure that is not
killed after a timeout in systemd/udev, we need to run it as a service
(which is done by the ENV{SYSTEMD_WANTS}=... trick).

-- 
Peter



More information about the pkg-lvm-maintainers mailing list