Linux Cookbook

 < Day Day Up > 

12.10.1 Problem

You want to change the look of the GRUB menu, and customize options such as timeouts and default boot entries.

12.10.2 Solution

Make your customizations in /boot/grub/menu.lst. (Some systems use grub.conf.)

There are two sections: the global settings and the boot stanzas. Colors, timeouts, and default boot entries are defined in the global section.

This is a complete sample menu.lst, including global configuration options:

##GRUB configuration for windbag, created 10-22-2003 ## global settings ## default num default 0 ## timeout sec timeout 5 # Pretty colors color cyan/blue white/blue # Display a splash screen splashimage (hd0,0)/boot/splash.xpm.gz foreground bbbbbb background 000000 ### Boot menu ## default title Libranet GNU/Linux, kernel 2.4.21 root (hd0,0) kernel /boot/vmlinuz-2.4.21 root=/dev/hda1 ro hdb=scsi hdc=scsi ## new 2.6 test kernel title Libranet GNU/Linux, kernel 2.6.3-test1 root (hd0,0) kernel /boot/bzImage-2.6.3-test1 root=/dev/hda1 ro ## Stock Red Hat 9 title Red Hat 9 root (hd0,4) kernel /boot/vmlinuz-2.4.22-1 root=/dev/hda5 ro initrd /boot/initrd-2.4.22-1.img

12.10.3 Discussion

These are definitions for the global configuration options:

default 0

Sets your default boot entry. Stanzas are read in order, starting from zero, so default 0 selects the first one.

timeout 5

Specifies how long to wait before the default entry boots.

color cyan/blue white/blue

Configures the colors for the GRUB boot menu. cyan/blue defines the foreground and background colors. white/blue defines the highlight colors for lines of text selected by the cursor. The available colors are listed in the GRUB manual and info grub.

splashimage (hd0,0)/boot/splash.xpm.gz

foreground bbbbbb

background 000000

Yes, you can replace the splash screen that came with your distribution with an image of your choosing. (See Recipe 12.16 for how to create the image.) Use the splashimage option to set the filepath to the image. You'll also need to configure the foreground and background colors for the fonts, using standard HTML hex color codes.

Another default choice is default saved. When you use default saved, you must also add savedefault to the boot stanzas, like this:

title Libranet GNU/Linux, kernel 2.4.21 root (hd0,0) kernel /boot/vmlinuz-2.4.21 ro root=/dev/hda1 savedefault

This makes the last item booted the default for the next boot. Many distributions configure the boot stanzas to include savedefault, but they don't add default saved, so it doesn't work.

12.10.4 See Also

  • The GRUB Manual (http://www.gnu.org/software/grub/manual/grub.html)

  • info grub

  • Recipe 12.16

     < Day Day Up > 

    Категории