#939092 lvm2: Spurious(?) failure of lvm2-pvscan systemd unit

Package:
lvm2
Source:
lvm2
Description:
Linux Logical Volume Manager
Submitter:
Nikolaus Rath
Date:
2019-09-19 20:27:03 UTC
Severity:
normal
#939092#5
Date:
2019-09-01 08:59:04 UTC
From:
To:
After upgrading to buster, I noticed that, according to `systemctl
status` my system is always in degraded mode:

# systemctl status | head
● vostro.rath.org
    State: degraded
     Jobs: 0 queued
   Failed: 1 units
    Since: Sun 2019-09-01 09:49:57 BST; 5min ago
   CGroup: /

It turns out that this is because of:

# systemctl | grep lvm2
  lvm2-monitor.service             loaded active exited    Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
● lvm2-pvscan@253:0.service        loaded failed failed    LVM event activation on device 253:0
  lvm2-pvscan@253:6.service        loaded active exited    LVM event activation on device 253:6
  system-lvm2\x2dpvscan.slice      loaded active active    system-lvm2\x2dpvscan.slice
  lvm2-lvmpolld.socket             loaded active listening LVM2 poll daemon socket

# systemctl status lvm2-pvscan@253:0.service | cat
● lvm2-pvscan@253:0.service - LVM event activation on device 253:0
   Loaded: loaded (/lib/systemd/system/lvm2-pvscan@.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2019-09-01 09:49:58 BST; 6min ago
     Docs: man:pvscan(8)
  Process: 738 ExecStart=/sbin/lvm pvscan --cache --activate ay 253:0 (code=exited, status=5)
 Main PID: 738 (code=exited, status=5)

Sep 01 09:49:59 vostro.rath.org lvm[738]:   /dev/sde: open failed: No medium found
Sep 01 09:49:59 vostro.rath.org lvm[738]:   /dev/sdf: open failed: No medium found
Sep 01 09:49:59 vostro.rath.org lvm[738]:   /dev/sdg: open failed: No medium found
Sep 01 09:49:59 vostro.rath.org lvm[738]:   Cannot change VG vg0 while PVs are missing.
Sep 01 09:49:59 vostro.rath.org lvm[738]:   Consider vgreduce --removemissing.
Sep 01 09:49:59 vostro.rath.org lvm[738]:   Cannot process volume group vg0
Sep 01 09:49:58 vostro.rath.org systemd[1]: Starting LVM event activation on device 253:0...
Sep 01 09:49:58 vostro.rath.org systemd[1]: lvm2-pvscan@253:0.service: Main process exited, code=exited, status=5/NOTINSTALLED
Sep 01 09:49:58 vostro.rath.org systemd[1]: lvm2-pvscan@253:0.service: Failed with result 'exit-code'.
Sep 01 09:49:58 vostro.rath.org systemd[1]: Failed to start LVM event activation on device 253:0.

I do not think there is an actual problem here, because vg0 is running
correctly - presumably as a result of the second pvscan unit:

# systemctl status lvm2-pvscan@253:6.service
● lvm2-pvscan@253:6.service - LVM event activation on device 253:6
   Loaded: loaded (/lib/systemd/system/lvm2-pvscan@.service; static; vendor preset: enabled)
   Active: active (exited) since Sun 2019-09-01 09:49:59 BST; 7min ago
     Docs: man:pvscan(8)
  Process: 863 ExecStart=/sbin/lvm pvscan --cache --activate ay 253:6 (code=exited, status=0/S
 Main PID: 863 (code=exited, status=0/SUCCESS)

Sep 01 09:49:59 vostro.rath.org lvm[863]:   /dev/sdd: open failed: No medium found
Sep 01 09:49:59 vostro.rath.org lvm[863]:   /dev/sde: open failed: No medium found
Sep 01 09:49:59 vostro.rath.org lvm[863]:   /dev/sdf: open failed: No medium found
Sep 01 09:49:59 vostro.rath.org lvm[863]:   /dev/sdg: open failed: No medium found
Sep 01 09:49:59 vostro.rath.org lvm[863]:   6 logical volume(s) in volume group "vg0" now acti
Sep 01 09:49:58 vostro.rath.org systemd[1]: Starting LVM event activation on device 253:6...
Sep 01 09:49:59 vostro.rath.org systemd[1]: Started LVM event activation on device 253:6.



It would be very nice to not have the system always report to be in
degraded mode though. Do you have any idea what might be happening here?

#939092#12
Date:
2019-09-19 19:33:31 UTC
From:
To:
The relevant .service file /lib/systemd/system/lvm2-pvscan@.service has:

ExecStart=/sbin/lvm pvscan --cache --activate ay %i

According to pvscan(8) this should result in:

       pvscan --cache -aay device...

       This  begins by performing the same steps as above.  Afterward, if the VG for the specified PV
       is complete, then pvscan will activate LVs in the VG (the same as vgchange -aay  vgname  would
       do.)

So it seems the service file is correct, and the bug is in pvscan. It should not return with an error if the VG is not yet complete.

Hope this helps!

Cheers,
-Nikolaus

#939092#17
Date:
2019-09-19 20:24:58 UTC
From:
To:
The following workaround suppresses the bogus error, but probably also ignores legitimate problems:

Create /etc/systemd/system/lvm2-pvscan@.service from /lib/systemd/system/lvm2-pvscan@.service but use:

# Leading dash means to ignore exit status, necessary because
# of https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933647
ExecStart=-/sbin/lvm pvscan --cache --activate ay %i


Best,
-Nikolaus