Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
grub-mkconfig does not use UUID
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
davidshen84
Apprentice
Apprentice


Joined: 09 Aug 2008
Posts: 263

PostPosted: Mon Nov 28, 2016 12:12 pm    Post subject: grub-mkconfig does not use UUID Reply with quote

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
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1656
Location: United Kingdom

PostPosted: Mon Nov 28, 2016 3:07 pm    Post subject: Reply with quote

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 OpenRC elogind nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 OpenRC elogind xf86-video-ati. Dual boot Win 7 Pro 64-bit.
KDE on both.

Fitzcarraldo's blog


Last edited by Fitzcarraldo on Sat Dec 31, 2016 8:19 pm; edited 1 time in total
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 2617

PostPosted: Mon Nov 28, 2016 3:52 pm    Post subject: Re: grub-mkconfig does not use UUID Reply with quote

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
View user's profile Send private message
davidshen84
Apprentice
Apprentice


Joined: 09 Aug 2008
Posts: 263

PostPosted: Tue Nov 29, 2016 6:09 am    Post subject: Reply with quote

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
View user's profile Send private message
TiccTech
n00b
n00b


Joined: 13 Jun 2004
Posts: 42
Location: Oregon, US

PostPosted: Sat Dec 31, 2016 7:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


Joined: 30 Aug 2008
Posts: 1656
Location: United Kingdom

PostPosted: Sat Dec 31, 2016 8:28 pm    Post subject: Reply with quote

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 OpenRC elogind nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 OpenRC elogind xf86-video-ati. Dual boot Win 7 Pro 64-bit.
KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
=DvD=
Veteran
Veteran


Joined: 25 Mar 2004
Posts: 1353

PostPosted: Fri Jan 06, 2017 9:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum