Archive

Posts Tagged ‘grub2’

How to: Edit the boot menu in Grub V2, Ubuntu 9.10 Karmic

Editing the boot menu in Grub version 2 is a little bit different compared to Grub version 1. The problem is Ubuntu Karmic 9.10 comes with Grub 2. That means a fresh install of Ubuntu 9.10 changes your old grub to version 2. And version 2 of Grub dont have menu.lst. Menu.lst is the file we have to edit if we want to change something permanently in the bootmenu.

Instead of menu.lst Grub V2 uses grub.cfg. The path normally is

/boot/grub/grub.cfg

NOTE: you can use the grub-mkconfig utility to generate a grub.cfg file for you. Other operating systems can be detected and will be added to the configuration only if os-prober is also installed. os-prober is currently only avaible in Debian and Ubuntu.

GRUB 2 uses new bashish scripting language that is used to build menus. At startup file grub.cfg will be read and executed.



Please note that partition numbering has been changed to start from 1 (in grub legacy it started from 0).

Example menu entrys can be found in docs/grub.cfg in the source or in the Debian/Ubuntu package in /usr/share/doc/grub-pc/examples/grub.cfg.

Here is an simple example:

# Timeout for menu
set timeout=10

# Set default boot entry as Entry 0
set default=0

# Entry 0 - Load Linux kernel
menuentry "My Linux Kernel on (hd0,1)" {
    set root=(hd0,1)
    linux /vmlinuz root=/dev/hda1
    initrd /initrd
}

# Entry 1 - Chainload another bootloader
menuentry "Chainload my OS" {
    set root=(hd0,3)
    chainloader +1
}

PS: The improper editing of the file grub.cfg can leave you with an unbootable system.

Categories: Mobiles Tags: , , , , ,