I have just finished jumping through the hoops required to understand grub2. I installed it in one of my Slackware partitions & used it for quite a while by editing /boot/grub/grub.cfg. I know that isn't recommended, but if you realise that it will be overwritten when "update-grub" is run & keep a backup, you can do that.
In order to use it as designed, you can start by editing "/etc/default/grub". There are a number of settings in there that can be changed & it is fairly well annotated. There is even a setting to turn off passing "root=UUID=whatever", but if you do, it passes "root=/dev/sdXY". There is nothing to have it pass "root=LABEL=whatever", unfortunately. The actual menu entries are read from the files in "/etc/grub.d". The files in that directory that are executable are added to /boot/grub/grub.cfg when "update-grub" is run. On my system, I have 00_header, 05_debian_theme, 10_linux & 40_custom executable, so it does not probe for other OSes, via 30_os-prober. I have one ubuntu & two Slackware partitions on this harddrive & full backups on a USB harddrive. If I ran 30_os-prober, it would add all my backups to my grub.cfg; I didn't want that, so I edited 40_custom to add my Slackware partitions like this:
Code:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Slackware-Current Desktop" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
linux /generic root=LABEL=primary ro 4
initrd /initrd.gz
}
menuentry "Slackware-Current Command Line" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
linux /generic root=LABEL=primary ro
initrd /initrd.gz
}
menuentry "Slackware-Current Unmodified" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
linux /generic root=LABEL=current ro
initrd /initrd.gz
}
Once I have files modified as above, I run "update-grub" & get a new grub.cfg, which looks like this:
Code:
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
insmod vbe
insmod vga
}
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 74205868-6a68-4b7e-afa5-48da485b84b0
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 74205868-6a68-4b7e-afa5-48da485b84b0
set locale_dir=($root)/boot/grub/locale
set lang=en
insmod gettext
if [ "${recordfail}" = 1 ]; then
set timeout=-1
else
set timeout=4
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.35-22-generic' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set 74205868-6a68-4b7e-afa5-48da485b84b0
linux /boot/vmlinuz-2.6.35-22-generic root=/dev/sda2 ro quiet splash
initrd /boot/initrd.img-2.6.35-22-generic
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Slackware-Current Desktop" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
linux /generic root=LABEL=primary ro 4
initrd /initrd.gz
}
menuentry "Slackware-Current Command Line" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
linux /generic root=LABEL=primary ro
initrd /initrd.gz
}
menuentry "Slackware-Current Unmodified" {
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
linux /generic root=LABEL=current ro
initrd /initrd.gz
}
### END /etc/grub.d/40_custom ###
You can unset the executable bit on 10_linux & manually add your ubuntu partition to the 40_custom file. That way you could use "root=LABEL=XXXX" with no hassles.
Regards,
Bill
Edit: Well, I didn't search well enough, did I? I've spent part of my afternoon following the instructions in post #2 & they work perfectly. Follow them & pay very little attention to what I have posted. I still have to use 40_custom for my other partitions, but maybe, with the stuff I read this afternoon, I can modify 30_os-prober to do what I want. Regards again, Bill