diff --git a/rear-remove-lvmdevices-bz2145014.patch b/rear-remove-lvmdevices-bz2145014.patch new file mode 100644 index 0000000..87d4b72 --- /dev/null +++ b/rear-remove-lvmdevices-bz2145014.patch @@ -0,0 +1,46 @@ +commit ad720ad788be1d653da31be36fca5e886e314ddb +Author: Pavel Cahyna +Date: Thu Aug 24 11:41:25 2023 +0200 + + Remove the lvmdevices file at the end of recovery + + The file /etc/lvm/devices/system.devices restricts LVM to disks with + given (hardware) IDs (serial numbers, WWNs). See lvmdevices(8). + + Unfortunately, when restoring to different disks than in the original + system, it will mean that LVM is broken in the recovered system (it + won't find any disks). Therefore it is safer to remove the file to + force the old behavior where LVM scans all disks. This used to be the + LVM default (use_devicesfile=0). + +diff --git a/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh +new file mode 100644 +index 00000000..a51e6bca +--- /dev/null ++++ b/usr/share/rear/finalize/GNU/Linux/230_remove_lvmdevices.sh +@@ -0,0 +1,25 @@ ++# Adapted from 260_rename_diskbyid.sh ++ ++# Remove /etc/lvm/devices/system.devices ++# The file restricts LVM to disks with given (hardware) IDs (serial ++# numbers, WWNs). See lvmdevices(8). ++# Unfortunately, when restoring to different disks than in the original ++# system, it will mean that LVM is broken in the recovered system (it ++# won't find any disks). Therefore it is safer to remove the file to ++# force the old behavior where LVM scans all disks. This used to be the ++# LVM default (use_devicesfile=0). ++ ++# There may be other files under /etc/lvm/devices, but they are not used ++# by default ++ ++local file=/etc/lvm/devices/system.devices ++local realfile ++ ++realfile="$TARGET_FS_ROOT/$file" ++# OK if file not found ++test -f "$realfile" || return 0 ++mv $v "$realfile" "${realfile}.rearbak" ++LogPrint "Renamed LVM devices file $realfile to ${realfile}.rearbak ++to prevent LVM problems in the recovered system, verify that the file ++is correct after booting the recovered system and move it back, or ++regenerate it using vgimportdevices." diff --git a/rear.spec b/rear.spec index 370bdba..217009a 100644 --- a/rear.spec +++ b/rear.spec @@ -50,6 +50,7 @@ Patch59: rear-usb-uefi-part-size-bz2228402.patch Patch60: rear-luks-key-bz2228779.patch Patch61: rear-uefi-usb-secureboot-bz2196445.patch Patch62: rear-vg-command-not-found-bz2121476.patch +Patch63: rear-remove-lvmdevices-bz2145014.patch # rear contains only bash scripts plus documentation so that on first glance it could be "BuildArch: noarch" # but actually it is not "noarch" because it only works on those architectures that are explicitly supported.