diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in --- grub-2.04.orig/util/grub-mkconfig.in 2019-08-18 15:43:15.196000000 +0200 +++ grub-2.04/util/grub-mkconfig.in 2019-08-18 15:43:33.498000000 +0200 @@ -133,6 +133,21 @@ # Device containing our userland. Typically used for root= parameter. GRUB_DEVICE="`${grub_probe} --target=device /`" + +# Rewrite to sane LVM node (Code from PLD Linux geninitrd): +# /dev/mapper/sys-rootfs -> /dev/sys/rootfs +# /dev/mapper/blodnatt-blah--bleh -> /dev/blodnatt/blah-bleh +# /dev/mapper/vg--meaw-root -> /dev/vg-meaw/root +case "$GRUB_DEVICE" in + /dev/mapper/*-*) + LVM2_LV_NAME='' LVM2_VG_NAME='' + eval $(lvs --noheadings --nameprefixes "$GRUB_DEVICE" 2>/dev/null) + if [ -n "$LVM2_VG_NAME$LVM2_LV_NAME" ]; then + GRUB_DEVICE=/dev/$LVM2_VG_NAME/$LVM2_LV_NAME + fi + ;; +esac + GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true