Re: Having Grub2 use UUID instead of (hd0,1)?
>> Hmm, didn't need to do anything special. The default config for grub2 in
>> squeeze and sid has this:
>> ,----[ /etc/default/grub ]
>> | # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
>> | #GRUB_DISABLE_LINUX_UUID=true
> That's not what I'm asking about. My kernels use UUID just fine and I
> don't want that to change. I'm asking about having Grub use the UUID
> instead of (hd0,1), etc.
> In other words, and I should have done this initially, look at this
> snippet from /boot/grub/grub.cfg:
> ### BEGIN /etc/grub.d/00_header ###
> set default=0
> insmod ext2
> set root=(hd1,1)
> search --no-floppy --fs-uuid --set 85f5c3de-852d-43bf-a8cd-9001efb0d93c
> Lines 4 and 5 seem to be in conflict with each other. Why have a "set
> root=(hd1.1)" line when the "search" line that follows specifies the
> correct UUID? My question was, how can I tell the scripts to not issue
> the "set root" line and just use the "search" line with the UUID? Will
> Grub2 work with just the UUID (it would seem the Ubunutu folks should
> have solved this already)? To me it seems that using UUID should be
> preferred.
> While I like the probing features and automatic configuration in
> general, I'd prefer that the more critical settings be overridden by my
> required static defaults.
>From /usr/lib/grub/grub-mkconfig_lib (which is sourced by all files in
/etc/grub.d):
<start>
# If there's a filesystem UUID that GRUB is capable of identifying, use it;
# otherwise set root as per value in device.map.
echo "set root=`${grub_probe} --device ${device} --target=drive`"
if fs_uuid="`${grub_probe} --device ${device} --target=fs_uuid 2>
/dev/null`" ; then
echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
fi
<end>
If you do not want the "set root..." line, comment it out.
If you want the "set root" line to use UUIDs, change "--target=drive"
to "--target=fs_uuid" (and possibly add "UUID=" after "root=" like the
"linux" line).
You _might_ also have to add an "insmod fs_uuid" line above the "set root=" one.
Reply to: