Control: tags -1 + patch
Control: found -1 2.03.31-2
Hello,
We hit this bug on trixie (lvm2 2.03.31-2). Our machines are unattended
industrial servers on remote sites with nobody on hand, with the root VG
on a RAID1 across two disks: when one disk dies and the machine reboots,
it stays in the initramfs shell and someone has to travel to the site.
#1018730 was closed with the objection that the initramfs cannot tell a
missing PV from a slow one. We first worked around it the way proposed
there, a udev rule that runs "vgchange --activation degraded" on an
incomplete VG, and saw that objection hold in practice: on a healthy
machine the NVMe PV shows up before the SATA PV, the VG gets activated
in degraded mode right away, and the SATA legs stay mapped to error
targets ("refresh needed") until someone runs lvchange --refresh.
The merge request below answers it with a bounded wait, the way mdadm
already handles degraded md arrays in the same initramfs: a local-block
script that does nothing until 2/3 of the root delay (max(30, rootdelay)
seconds) is spent, then runs "vgchange --sysinit -aay --activation
degraded" once. On a healthy machine every PV shows up long before
that, the udev rules activate the complete VG and the script is never
reached, since local_device_setup() only runs the local-block scripts
while the root device is missing. When a PV is really gone, the boot
goes on in degraded mode after about 20 seconds. Degraded activation
only activates LVs whose redundancy covers the missing PV: a linear LV
on that PV stays inactive.
Tested on one of our servers with the root VG (vg1: root, swap, varlog,
all raid1) on nvme0n1p2 + sda2, kernel 7.2.11+deb13-rt-amd64, with
the stock 69-lvm.rules and the script installed as
/etc/initramfs-tools/scripts/local-block/lvm2:
1. Both disks present: no change, the VG is activated by the udev rules.
[ 5.33] md/raid1:mdX: active with 2 out of 2 mirrors (x3)
2. SATA disk hidden with modprobe.blacklist=ahci: the machine boots
in degraded mode.
[ 26.47] device-mapper: raid: Failed to read superblock of device
at position 1
[ 26.53] md/raid1:mdX: active with 1 out of 2 mirrors (x3)
[ 32.57] Warning: lvm2: activating incomplete volume groups in
degraded mode
(the warning only reaches the journal when the initramfs output is
flushed; the activation itself happens at 26 s, 20 s after init)
3. Next boot with both disks: the stale legs are recovered by the
kernel on activation, all LVs back to 100% in sync, no manual step.
[ 5.46] md/raid1:mdX: active with 1 out of 2 mirrors (x3)
[ 12.14] md: recover of RAID array mdX
[ 12.15] md: mdX: recover done.
Not covered: a PV that comes back while the system is running after a
degraded boot still needs "lvchange --refresh". That is a separate
problem and outside the initramfs.
The patch is on salsa, against main (2.03.31-2):
https://salsa.debian.org/lvm-team/lvm2/-/merge_requests/26
Regards,
Florent Carli