Bug#958397: Missing 60-block.rules breaks grub-installer

Pascal Hambourg pascal at plouf.fr.eu.org
Tue Apr 21 14:19:36 BST 2020

Package: udev-udeb
Version: 241-7~deb10u3
Control: found -1 232-25+deb9u12
Control: unarchive 852323
X-Debbugs-CC: steve at einval.com


Udev has a rule with OPTIONS+="watch" to generate an event and update 
symlinks in /dev/disk/ when a block device is written to. In Jessie, the 
rule was in /lib/udev/rules.d/60-persistent-storage.rules. In Stretch 
and Buster, it was moved to /lib/udev/rules.d/60-block.rules. However
/lib/udev/rules.d/60-block.rules was *not* included in :

- the initramfs hook script /usr/share/initramfs-tools/hooks/udev, 
therefore in the initramfs built by update-initramfs

- the udev-udeb package

- the Debian installer initrd.gz (I guess it uses udev-udeb)

The most visible consequence is in the Debian installer. When a device 
is formatted, symbolic links pointing to that device in /dev/disk/ are 
not updated immediately. Then if the symlink pointing to the root device 
in /dev/disk/by-uuid/ is missing or wrong, update-grub/grub-mkconfig 
puts the root device name instead of the UUID in the root= kernel 
parameter (see /etc/grub.d/10_linux). Drive and partition device names 
are unreliable and may change at each boot, causing the boot to fail.

The following bugs may be related to this issue :

Steps to reproduce the issue :

Boot the Debian installer.
Select "advanced options" > "Expert install".
Follow steps up to "Partition disks".
Select manual partitioning.
Create or select and format a partition for /.
Do not create or use any swaps.
Install the base system.
Skip "Configure the package manager" and "Select and install software".
Install the GRUB boot loader.
Jump into a shell.
Check the symlink pointing to the root partition in /dev/disk/by-uuid/ 
is missing or wrong.
Check that /target/boot/grub/grub.cfg "linux" lines have
root=/dev/<partition> instead of root=UUID=<uuid>.

Suggested fix :

The issue could be worked around by executing "udevadm trigger" to 
update symlinks at a proper time after formatting the root filesystem 
and before installing GRUB. This is actually what seems to happen at the 
"select and install software" step. But I think is is easier, safer and 
cleaner to include /lib/udev/rules.d/60-block.rules and fix the root 
cause than to rely on executing "udevadm trigger" at the proper time.

More information about the Pkg-systemd-maintainers mailing list