View previous topic :: View next topic |
Author |
Message |
davidshen84 Guru
Joined: 09 Aug 2008 Posts: 318
|
Posted: Mon Nov 28, 2016 12:12 pm Post subject: grub-mkconfig does not use UUID |
|
|
I made sure I have this line in my /etc/default/grub:
Quote: | # GRUB_DISABLE_LINUX_UUID=true |
But grub-mkconfig still generate boot entries like:
Quote: | linux /boot/vmlinuz-4.8.7-gentoo root=/dev/sdc2 |
Any idea why?
I have my Gentoo installed on a removable drive, if it uses the drive letter, I have to make sure the drive is detected in the correct order. Very annoying...Please help _________________ David Shen |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2056 Location: United Kingdom
|
Posted: Mon Nov 28, 2016 3:07 pm Post subject: |
|
|
davidshen84 wrote: | I made sure I have this line in my /etc/default/grub:
Code: | # GRUB_DISABLE_LINUX_UUID=true |
But grub-mkconfig still generate boot entries like:
Code: | linux /boot/vmlinuz-4.8.7-gentoo root=/dev/sdc2 |
Any idea why? |
If you really have got the hash character in that line, that would explain why. You need to uncomment that line in /etc/default/grub.
EDIT: Whoops, my bad. _________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.
My blog
Last edited by Fitzcarraldo on Sat Dec 31, 2016 8:19 pm; edited 1 time in total |
|
Back to top |
|
|
charles17 Advocate
Joined: 02 Mar 2008 Posts: 3685
|
Posted: Mon Nov 28, 2016 3:52 pm Post subject: Re: grub-mkconfig does not use UUID |
|
|
davidshen84 wrote: | But grub-mkconfig still generate boot entries like:
Quote: | linux /boot/vmlinuz-4.8.7-gentoo root=/dev/sdc2 |
|
But that isn't the whole menuentry, is it?
Something like this? Code: |
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-<here my uuid of /dev/sda6 >' {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 <here uuid of my /dev/sda1>
else
search --no-floppy --fs-uuid --set=root <here uuid of my /dev/sda1>
fi
echo 'Loading Linux 4.4.26-gentoo ...'
linux /vmlinuz-4.4.26-gentoo root=/dev/sda6 ro
} |
|
|
Back to top |
|
|
davidshen84 Guru
Joined: 09 Aug 2008 Posts: 318
|
Posted: Tue Nov 29, 2016 6:09 am Post subject: |
|
|
Yes, the full menuentry is more like the one you given. And the UUID after "--set=root" is actually correct. But I think the kernel only care what you passed in, by using the root=... part. And on my system, it is always the device pass. _________________ David Shen |
|
Back to top |
|
|
TiccTech n00b
Joined: 13 Jun 2004 Posts: 42 Location: Oregon, US
|
Posted: Sat Dec 31, 2016 7:58 pm Post subject: |
|
|
I also ran into this problem today -- I took two older drives out of a file server, and it failed during boot due to /boot/grub/grub.cfg setting root=/dev/sde3 instead of using a UUID. The same UUID was now on /dev/sdc3.
A little digging into /etc/grub.d/10_linux (which appears to be used by grub-mkconfig) led me to this:
Code: | elif test -z "${initramfs}" ; then
# "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's
# no initrd or builtin initramfs, it can't work here.
|
Which I interpret to mean that if you boot your kernel directly from the disk, not from initrd, then you can't use UUIDs.
And sure enough, the two of my Gentoo machines that don't have initrds put root=/dev/sd* on the kernel command line, whereas the other two, which have RAID1 root partitions, and therefore boot with initrd, use root=UUID=*.
So perhaps you should configure your system to use an initrd?
I'm not going to bother -- my device names only change every few years. |
|
Back to top |
|
|
Fitzcarraldo Advocate
Joined: 30 Aug 2008 Posts: 2056 Location: United Kingdom
|
Posted: Sat Dec 31, 2016 8:28 pm Post subject: |
|
|
Looks like you're correct:
Gentoo Wiki - 'GRUB2/Config Variables' wrote: |
Variable...............................Default..Description
GRUB_DISABLE_LINUX_UUID..false.......If true, ${GRUB_DEVICE} is passed in the root parameter on the kernel command line.
..........................................................If false, ${GRUB_DEVICE_UUID} is passed in the root parameter on the kernel command line when an initramfs is available. |
_________________ Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC systemd-utils[udev] elogind KDE on both.
My blog |
|
Back to top |
|
|
=DvD= Veteran
Joined: 25 Mar 2004 Posts: 1353
|
Posted: Fri Jan 06, 2017 9:28 am Post subject: |
|
|
Same problem here.
Without initramfs we should be able to pass the PARTUUID to the kernel tho
Solved modifing the output of grub-mkconfig with sed
Code: | grub-mkconfig | sed 's/root=\/dev\/sda9/root=PARTUUID=3278f49b-fb89-4b39-9c0d-09c012946e20/g' > /boot/grub/grub.cfg |
|
|
Back to top |
|
|
Josef.95 Advocate
Joined: 03 Sep 2007 Posts: 4689 Location: Germany
|
Posted: Sat Nov 09, 2019 1:08 pm Post subject: |
|
|
>=sys-boot/grub-2.04 has now PARTUUID support :)
Code: | # grep UUID /etc/default/grub
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
GRUB_DISABLE_LINUX_UUID=true
GRUB_DISABLE_LINUX_PARTUUID=false | works for me with grub-mkconfig -o /boot/grub/grub.cfg |
|
Back to top |
|
|
389292 Guru
Joined: 26 Mar 2019 Posts: 504
|
Posted: Sat Nov 09, 2019 3:50 pm Post subject: |
|
|
Grub supports PARTUUID now, unfortunately switch_root (part of busybox) does not, and it complicates encrypted installs without LUKS headers on the drive.. |
|
Back to top |
|
|
Andry77 Tux's lil' helper
Joined: 03 Mar 2006 Posts: 77
|
Posted: Wed Jan 29, 2020 1:16 pm Post subject: |
|
|
Josef.95 wrote: | >=sys-boot/grub-2.04 has now PARTUUID support
Code: | # grep UUID /etc/default/grub
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
GRUB_DISABLE_LINUX_UUID=true
GRUB_DISABLE_LINUX_PARTUUID=false | works for me with grub-mkconfig -o /boot/grub/grub.cfg |
I had the same problem. Josef.95 thanks for the hint. |
|
Back to top |
|
|
|