#[RESOLVED] grub.cfg keeps adding root=/dev/mapper/root instead of my root=UUID

1 messages · Page 1 of 1 (latest)

swift nova
#

System info

Boot stack: dracut + installkernel + grub (with secureboot shim file)
/etc/fstab
/boot/EFI/Gentoo/grub.cfg
blkid
/etc/default/grub
etc/dracut.conf

grub-mkconfig (GRUB) 2.12
dracut 106
installkernel 60

Background

Issues occurred after updating @world (and nvme firmware via fwupd) but don't believe these are related. Issue persists after reinstalling (which I needed due to some idiocy with /var/db/pkg). An older install on a different machine works fine and does not have the following behavior (but unable to trace why that works).

Description

After decyrpting the system after booting, the console hangs for a few minutes before going to the initramfs debug shell, throwing an error indicating /dev/mapper/root cannot be found. This is due to the mapper device actually being /dev/mapper/luks-blah-blah-blah but GRUB insists on adding the former to my grub.cfg. I use UUIDs in my dracut.conf, fstab, and tried to manually set the GRUB_CMDLINE_LINUX with the correct root=UUID... but this only gets appended after the root=/dev/mapper/root cmdline in the grub.cfg. I can continue booting after a quick dmsetup rename luks-blah-blah root so I know this isn't a different issue (graphics).

I suspect this is due to some weird behavior with how grub-probe is getting the device name, maybe related to thinking my partition is an lvm device rather than luks? I noticed the grub-probe errors between my working and borked system are different. I don't know if this is useful but it is interesting.

# Non-working system
>>> grub-probe /
grub-probe: error: disk `lvm/root' not found.

# Working system
>>> grub-probe /
grub-probe: error: disk `hostdisk//dev/dm-0' not found.
#

Thanks in advance for the help. This has been driving me crazy for the last few days and I've been looking everywhere for a solution.

steady meadow
#

step 1: use ugrd

#

I'm sure there is a setting somewhere but this is just a non issue with ugrd

#

because it doesn't name things using udev

#

depending on whether or not you're using systemd as an init, dracut will behave differently so that matters too

#

setting the root in the dracut config won't even work because the bootloader config takes precedence with dracut

swift nova
# steady meadow step 1: use ugrd

I don't think it's fair to suggest this is an XY problem since the issue seems to be with GRUB, not the initramfs. Building an initramfs which plays nice with this quirk of GRUB seems like a workaround to the actual problem and I would like to understand that better. Having used both dracut and ugrd, I prefer the dracut experience to keep things consistent across distros I work with.

Looking through my past messages it looks like I had this issue before while helping a friend. I
https://discordapp.com/channels/249111029668249601/1058827938847539240/1272905923383267445

I compared my configs on an my own installs and noticed the grub use flags from following this guide years ago. Both my PC and laptop have this added and have had dracut + luks builds which were easy cake to setup.

Maybe it is wrong but if that's the case, I'd love to know what the actual fix is for this because I'm bound to make it again in the future. 🙂
And here I am after predicting my own fate. Again, my old install worked fine so I don't know why this is failing but I don't want to use a workaround when this luks + grub should work.

swift nova
#

Wow, the USE flag change I mentioned a year a go fixed the issue for me. I remember I tried to add this to the wiki but someone told me it was incorrect. So following the wiki steps for a fresh install caused the issue for me again just like my friend observed.

# /etc/portage/package.use/sys-boot
sys-boot/grub device-mapper
#

After re-emerging grub and running grub-mkconfig the root device is using the UUID.

#

[RESOLVED] grub.cfg keeps adding root=/dev/mapper/root instead of my root=UUID

#

Resolving with earlier comment.

swift nova
#

As a side note it looks like the device-mapper use flag is the default now for GRUB but I had disabled it during testing a year ago when it was still optional. I can't remember if it was always the default but my older -device-mapper USE change I was re-using is likely the root cause for this. Feels awesome to be an idiot 🤘

steady meadow
#

i think there may be a hidden grub config option for this

steady meadow