Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 382877 - Grub-1.99-r2 does not use UUID for setting root
Summary: Grub-1.99-r2 does not use UUID for setting root
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-13 20:17 UTC by Peter Asplund
Modified: 2011-09-14 21:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Asplund 2011-09-13 20:17:30 UTC
Grub 2 doesn't use UUID for setting the root fs for the "linux line" (last line below) even though it has been set to do so in the config file (/etc/defaults/grub)

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel
#GRUB_DISABLE_LINUX_UUID=true

Resulting grub.cfg:

menuentry 'GNU/Linux, with Linux 3.0.3-gentoo' --class gnu-linux --class gnu --class os {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd2,msdos1)'
    search --no-floppy --fs-uuid --set=root 0fbf4cbc-e910-4607-a91d-9a4995498b53
    echo    'Läser in Linux 3.0.3-gentoo ...'
    linux   /vmlinuz-3.0.3-gentoo root=/dev/sdc5 ro  
}

I have my boot disk on its own partition:
$ grub2-probe -t fs_uuid /boot/
0fbf4cbc-e910-4607-a91d-9a4995498b53

and the root disk:
$ grub2-probe -t fs_uuid /
cf869dfa-1fae-47bf-a678-bbc5128c4df3

or using blkid (removing partitions not of interest):
$ blkid 
/dev/sdc1: LABEL="boot" UUID="0fbf4cbc-e910-4607-a91d-9a4995498b53" TYPE="ext2" 
/dev/sdc2: LABEL="Swap" UUID="138a24a0-64a0-4c02-9c48-b5cafae186a1" TYPE="swap" 
/dev/sdb1: UUID="4E7E79F57E79D5E5" TYPE="ntfs" 
/dev/sdc3: LABEL="portage" UUID="f8561fd7-f45e-4098-a465-ae55a3472659" TYPE="ext2" 
/dev/sdc6: LABEL="home" UUID="cd057f76-9c6e-4e0a-9308-6dfad0803f57" SEC_TYPE="ext2" TYPE="ext3" 
/dev/sdc5: LABEL="root" UUID="cf869dfa-1fae-47bf-a678-bbc5128c4df3" TYPE="ext3"

Reproducible: Always

Steps to Reproduce:
1. run grub2-mkconfig --no-floppy -o /boot/grub/grub.cfg
2. check resulting file
3. see that uuid has not been used on 'linux /vmlinuz/' line
Actual Results:  
menuentry 'GNU/Linux, med Linux 3.0.3-gentoo' --class gnu-linux --class gnu --class os {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd2,msdos1)'
    search --no-floppy --fs-uuid --set=root 0fbf4cbc-e910-4607-a91d-9a4995498b53
    echo    'Läser in Linux 3.0.3-gentoo ...'
    linux   /vmlinuz-3.0.3-gentoo root=/dev/sdc5 ro  
}

Expected Results:  
menuentry 'GNU/Linux, med Linux 3.0.3-gentoo' --class gnu-linux --class gnu --class os {
    load_video
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd2,msdos1)'
    search --no-floppy --fs-uuid --set=root 0fbf4cbc-e910-4607-a91d-9a4995498b53
    echo    'Läser in Linux 3.0.3-gentoo ...'
    linux   /vmlinuz-3.0.3-gentoo root=/dev/disk/by-uuid/cf869dfa-1fae-47bf-a678-bbc5128c4df3 ro  
}
Comment 1 Peter Asplund 2011-09-13 20:35:43 UTC
I was actually expecting
    "linux   /vmlinuz-3.0.3-gentoo root=UUID=cf869dfa-1fae-47bf-a678-bbc5128c4df3 ro"

on the line, but I'm not sure about the correct syntax. There seems to be some different alternatives when reading Arch's wiki or the Ubuntu forum.
Comment 2 Mike Gilbert gentoo-dev 2011-09-13 22:03:30 UTC
You need have an initramfs for grub to use the UUID option. You can see this on line 186 of /etc/grub.d/10_linux.

Also, your initramfs must contain code to mount using a UUID for this to actually work.

sys-kernel/genkernel or sys-kernel/dracut can create a suitable initramfs.
Comment 3 Peter Asplund 2011-09-14 21:06:05 UTC
Yes, I realized this an hour after writing the bug.. I'm sorry =)

But another thing! Why does grub use both root=(hd*,*) and the "search" command? Shouldn't it only use the one the user has set in the config?
Comment 4 Mike Gilbert gentoo-dev 2011-09-14 21:14:52 UTC
(In reply to comment #3)
> But another thing! Why does grub use both root=(hd*,*) and the "search"
> command? Shouldn't it only use the one the user has set in the config?

My guess: it probably searches in case the drive detection order gets mixed up.