MountainX wrote:My system is booting successfully using labels now.
So what happens on the next kernel update? Seems like we are going to need to edit those /etc/grub.d/ files so that a label-based grub.cfg is generated.
Has anyone figured out how to do that?
I got a solution for this here:
http://ubuntuforums.org/showthread.php? ... ost9585964
I'll post it below so this thread is complete. This thread is the one that really took me a long way toward the solution, so it should contain the complete discussion. Here's what I did with the help of drs305 and others:
I hope others comment in regard to whether all these steps are necessary and accurate. But this IS WORKING for me.
1. changed /etc/defaults/grub
uncommented this line and used quotes around true:
2. changed /etc/grub.d/10_linux as follows:
Code: Select all
auto_label="`e2label ${GRUB_DEVICE_BOOT} 2>/dev/null`"
linux_root_device_thisversion="LABEL=${auto_label}"
cat << EOF
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
3. changed /usr/lib/grub/grub-mkconfig_lib as follows. I know this code could be improved by including it in a proper conditional, but I didn't know how to do that. So it just executes always.
Code: Select all
# 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_label="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
#echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
#fi
auto_label="`e2label ${device} 2>/dev/null`"
echo "search --no-floppy --label ${auto_label} --set root"
Those changes generate perfect (as far as I'm concerned) stanzas in grub.cfg. And my test machine boots as expected.
Code: Select all
menuentry "Linux Mint 9, 2.6.32-21-generic (/dev/sda1) -- recovery mode" --class linuxmint --class gnu-linux --class gnu --class os {
recordfail
insmod ext2
set root='(hd0,1)'
search --no-floppy --label my_label --set root
echo 'Loading Linux 2.6.32-21-generic ...'
linux /boot/vmlinuz-2.6.32-21-generic root=LABEL=my_label ro single
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-2.6.32-21-generic
}
my /etc/fstab also uses labels. Here's an example (although this exact example is from another machine)
Code: Select all
LABEL=home_volume /home ext4 noatime,acl,user_xattr 1 2
LABEL=root_volume / ext4 noatime,acl,user_xattr 1 1
LABEL=swap_volume swap swap defaults 0 0
LABEL=boot_volume /boot ext2 noatime,acl 1 2