From 259de6f94f73167e7dcc95f41be9d3dc614ad1c1 Mon Sep 17 00:00:00 2001 From: James Adams Date: Fri, 9 Feb 2024 11:37:23 +0000 Subject: [PATCH] Partition: Mask DM/LVM rules, don't stop udev While partitions are being created and wiped, mask udev rules related to Device Mapper and LVM to prevent partitions from being activated automatically. This replaces the previous solution of completely stopping udev during these operations, which prevented the use of device names created by the persistent storage rules. Fixes #105. --- src/main/perl/Partition.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/perl/Partition.pm b/src/main/perl/Partition.pm index ec073e2..90ab4d9 100644 --- a/src/main/perl/Partition.pm +++ b/src/main/perl/Partition.pm @@ -625,10 +625,9 @@ sub create_pre_ks # make sure this never matches on anything else $extended_txt .= "_no_msdos_label" if ($self->{holding_dev}->{label} ne MSDOS); - # Avoid LVM/mdadm/etc. autodiscovery kicking in after the partition has - # been created - my $pause_udev = $self->{anaconda_version} >= ANACONDA_VERSION_EL_7_0 ? "udevadm control --stop-exec-queue" : ""; - my $unpause_udev = $self->{anaconda_version} >= ANACONDA_VERSION_EL_7_0 ? "udevadm control --start-exec-queue" : ""; + # Avoid LVM/mdadm/etc. autodiscovery kicking in after the partition has been created + my $mask_udev_rules = $self->{anaconda_version} >= ANACONDA_VERSION_EL_7_0 ? "find /usr/lib/udev/rules.d/ -type f -name \*.rules | grep -E '(dm|lvm)' | xargs basename -a | xargs -I@ touch /etc/udev/rules.d/@" : ""; + my $unmask_udev_rules = $self->{anaconda_version} >= ANACONDA_VERSION_EL_7_0 ? "rm -f /etc/udev/rules.d/*.rules" : ""; print <{devname}\$' /proc/partitions @@ -676,7 +675,7 @@ EOF } print <{type} \$begin \$end while true; do sleep 1 @@ -692,7 +691,7 @@ EOF } print <