Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partition: Mask DM/LVM rules, don't stop udev #106

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jrha
Copy link
Member

@jrha jrha commented Feb 9, 2024

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.

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 quattor#105.
@jrha
Copy link
Member Author

jrha commented Feb 9, 2024

This solution works fine for us at RAL, but it's not been exhaustively tested.

@jrha
Copy link
Member Author

jrha commented Feb 9, 2024

In theory systemd-udev uses inotify to watch /usr/lib/udev/rules.d/ and /etc/udev/rules.d, but we could also throw a udevadm control --reload-rules && udevadm trigger in there to be sure.

@jrha jrha added this to the 24.next milestone Jul 25, 2024
@jrha jrha modified the milestones: 24.10, 25.next Oct 29, 2024
@iddecker
Copy link

iddecker commented Nov 8, 2024

We are having the same issue at UGent when trying to use the /dev/disk/by-path names for disk devices.

With your change, the install hangs when trying to run lvm. Adding udevadm control --reload-rules && udevadm trigger when masking and unmasking the rules seems to fix that.

I don't really know what would be different in our setup that causes this issue to show up here.

Something to note: in Partition.pm, the code that is generated checks for the partition in /proc/partitions. The /dev/disk/... paths will never be in there, so the grep will never match anything. This will need something like

--- /usr/lib/perl/NCM/./Partition.pm    2021-05-10 11:41:46.000000000 +0200
+++ ./Partition.pm      2024-10-31 18:00:47.366800468 +0100
@@ -618,11 +618,14 @@
     # This will make the partitioning phase much faster.
     # Partitions are also wiped before they are removed.
     print <<EOF;
-if grep -q $self->{devname} /proc/partitions
+DISKDEV=`readlink -f /dev/$self->{devname}`
+if [[ "\$DISKDEV" =~ "/dev/" ]] ; then
+if grep -q \${DISKDEV#/dev/} /proc/partitions
 then
     wipe_metadata $path
     parted $devpath -s rm $n
 fi
+fi
 EOF
 }

to actually check for the correct partition. A different approach might be to check if the path exists in /dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Pausing udev makes /dev/disk/by-* unusable for installations
2 participants