From eb4f744820832aff3d6da1bba14f12e91a5b3535 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 29 Nov 2023 09:09:57 +0100 Subject: [PATCH] Upstream db_persist udev rule from dracut Setting db_persist is required for dm devices so that their properties are carried over on switch-root from the initrd to the rootfs. This logic has always lived in dracut (https://github.com/dracutdevs/dracut/blob/master/modules.d/90dm/11-dm.rules). However, this means that other initramfs generators each have to implement and maintain the same rule which leads to unnecessary duplication. Instead, let's make the rule part of the upstream lvm rules, which will ensure that generated initramfses will just work if they make sure the lvm udev rules are installed, without having to figure out that they have to add an extra rule themselves on top. Identical rule in Arch Linux's lvm2 package: https://gitlab.archlinux.org/archlinux/packaging/packages/lvm2/-/blob/main/11-dm-initramfs.rules?ref_type=heads --- udev/10-dm.rules.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/udev/10-dm.rules.in b/udev/10-dm.rules.in index 94c4140c0..db4ee771d 100644 --- a/udev/10-dm.rules.in +++ b/udev/10-dm.rules.in @@ -51,6 +51,11 @@ KERNEL!="dm-[0-9]*", GOTO="dm_end" # is not recommended. ACTION=="remove", GOTO="dm_end" +# Persist device state on transition from the initrd. This means all udev device +# properties are kept in the udev database even when it is cleaned up on +# switch-root. +OPTIONS+="db_persist" + # Decode udev control flags and set environment variables appropriately. # These flags are encoded in DM_COOKIE variable that was introduced in # kernel version 2.6.31. Therefore, we can use this feature with