Grub2 and multiple boot different ubuntu versions
Tom H
tomh0665 at gmail.com
Thu Mar 25 21:36:50 UTC 2010
> So how would you advise a standard multiboot user to edit this:
>> ### BEGIN /etc/grub.d/00_header ###
<snip>
>> insmod ext2
>> set root='(hd0,8)'
>> search --no-floppy --fs-uuid --set <snipped>
>> if loadfont /usr/share/grub/unicode.pf2 ; then
>> set gfxmode=640x480
>> insmod gfxterm
>> insmod vbe
>> if terminal_output gfxterm ; then true ; else
>> # For backward compatibility with versions of terminal.mod that don't
>> # understand terminal_output
>> terminal gfxterm
>> fi
>> fi
>> insmod ext2
>> set root='(hd0,8)'
>> search --no-floppy --fs-uuid --set <snipped>
>> set locale_dir=($root)/boot/grub/locale
>> set lang=en
>> insmod gettext
>> if [ ${recordfail} = 1 ]; then
>> set timeout=-1
>> else
>> set timeout=10
>> fi
<snip>
>> ### BEGIN /etc/grub.d/10_linux ###
>> menuentry "Ubuntu, with Linux 2.6.32-17-generic" --class ubuntu --class gnu-linux --class gnu --class os {
>> recordfail
>> insmod ext2
>> set root='(hd0,8)'
>> search --no-floppy --fs-uuid --set <snipped>
>> linux /boot/vmlinuz-2.6.32-17-generic root=UUID=<snipped> ro quiet splash
>> initrd /boot/initrd.img-2.6.32-17-generic
>> }
<snip>
>> ### END /etc/grub.d/10_linux ###
>> ### BEGIN /etc/grub.d/20_memtest86+ ###
>> menuentry "Memory test (memtest86+)" {
>> insmod ext2
>> set root='(hd0,8)'
>> search --no-floppy --fs-uuid --set <snipped>
>> linux16 /boot/memtest86+.bin
>> }
>> menuentry "Memory test (memtest86+, serial console 115200)" {
>> insmod ext2
>> set root='(hd0,8)'
>> search --no-floppy --fs-uuid --set <snipped>
>> linux16 /boot/memtest86+.bin console=ttyS0,115200n8
>> }
>> ### END /etc/grub.d/20_memtest86+ ###
>> ### BEGIN /etc/grub.d/30_os-prober ###
>> menuentry "Windows 7 (loader) (on /dev/sda1)" {
>> insmod ntfs
>> set root='(hd0,1)'
>> search --no-floppy --fs-uuid --set <snipped>
>> chainloader +1
>> }
>> menuentry "Ubuntu, Linux 2.6.31-20-generic (on /dev/sda5)" {
>> insmod ext2
>> set root='(hd0,5)'
>> search --no-floppy --fs-uuid --set <snipped>
>> linux /boot/vmlinuz-2.6.31-20-generic root=UUID=<snipped> ro quiet splash
>> initrd /boot/initrd.img-2.6.31-20-generic
>> }
<snip>
>> menuentry "Ubuntu, linux 2.6.24-27-generic (on /dev/sda7)" {
>> insmod ext2
>> set root='(hd0,7)'
>> search --no-floppy --fs-uuid --set <snipped>
>> linux /boot/vmlinuz-2.6.24-27-generic root=UUID=<snipped> ro quiet splash
>> initrd /boot/initrd.img-2.6.24-27-generic
>> }
<snip>
>> ### END /etc/grub.d/30_os-prober ###
> to simply edit out the memtest bits? Would I take the chance of deleting a:
>> }
>> menuentry "Memory test (memtest86+) (on /dev/sda7)" {
>> insmod ext2
>> set root='(hd0,7)'
>> search --no-floppy --fs-uuid --set <snipped>
>> linux /boot/memtest86+.bin
>> }
> to see if it works or not?
> You see, it will take quite a bit of work to do that, and a single
> mistake could bork grub2 in the process. Plus, how do you keep it updated?
The first line that you are proposing to delete is already one line too many! :)
I keep a grub.cfg in /root and "vi /root/grub.cfg" to add and remove
entries before copying it to /boot/grub.
> While I very much respect your advise & opinions, I seriously doubt that
> modifying grub2 is easier than the former menu.lst and/or 'not much of a
> hassle'. Note that Tom H had to provide a method simply to eliminate the
> Win7 bits (thanks Tom H!) for the Win7 recovery entries.
I find grub.cfg just as easy to edit manually as menu.lst... (You're welcome!)
This is a small thing, but if you choose
GRUB_TERMINAL=gfxterm
as opposed to
GRUB_TERMINAL=console
in
/etc/default/grub
you end up with two
<begin>
insmod ext2
set root='(hd0,8)'
search --no-floppy --fs-uuid --set <snipped>
</end>
in
/boot/grub/grub.cfg
before the menuentry stanza
so the grub maintainers still have some cleaning up to do in their
scripts - and MIGHT at some point make some changes that will give
more options. Fingers crossed; VERY crossed.
More information about the ubuntu-users
mailing list