Jump to content
Sign in to follow this  

BL-03: GRUB configuration

Recommended Posts

Browse: [About the FAQ Forum] [Table of Contents] [FAQs] [Contribute] [BL: Bootloaders]


BL-03: GRUB configuration


GRUB stands for "GRand Unified Bootloader" and is one of the many bootloaders available for Linux and other OS's. One thing that must be noted about grub, is the device syntrax. GRUB counts starting from zero. For example, hda is seen as (hd0). The partition hda1 would be seen as (hd0,0), hda2 as (hd0,1), hdb3 as (hd1,2), etc. Under Mandrake, the GRUB configuration file is "/boot/grub/menu.lst". Other distributions may use /etc/grub.conf or /boot/grub/grub.conf though.


Here's an example of a simple configuration

timeout 10
color black/cyan yellow/cyan
i18n (hd0,0)/boot/grub/messages
password linux
default 0
fallback 1

title linux
kernel (hd0,0)/boot/vmlinuz root=/dev/hda1 devfs=mount hdc=ide-scsi resume=/dev/hda2 splash=silent vga=788
initrd (hd0,0)/boot/initrd.img

title windows
root (hd0,1)
chainloader +1


Simple list of options:

  • timeout # : The amount of time, in seconds, for the bootloader to wait before booting the default section.
  • color foreground/background/highlight : Specifies what color to display the menu in. You can prefix blink- to foreground if you want a blinking foreground color.
  • i18n (partition /boot is located)/path/to/msg-file : Specifies path to a text file that will display in the boot menu.
  • default # : The default entry to boot. Note to start counting entries from zero, not 1. The default in the configuration would be "linux", which is called as "0'.
  • fallback # : The entry to boot if the default entry fails.
  • title string : The begining line of a boot entry. String is what will display in the menu for that entry.
  • kernel (partition)/path/to/kernel kernel options : this specifies the kernel image to boot from. kernel options is the line that is passed to the kernel at boot.
  • initrd (partition)/path/to/initrd : The ramdisk image too load at boot.
  • root (partition) : Specifies
  • chainloader +1 : Mechanism for loading unsupported operating systems by loading another boot loader. It is typically used for loading DOS or Windows.
  • password : To specify a password for a lock function.



title Mandrake
kernel (hd0,1)/boot/vmlinuz root=/dev/hda1 vga=788 devfs=mount hdc=ide-scsi splash=silent
initrd (hd0,1)/boot/initrd.img

This example will be labeled "Mandrake" and will load the kernel image (vmlinuz) and ramdisk (initrd.img) image from hda2. root=/dev/hda1" tells the kernel the "/" partition is /dev/hda1 (note it's not using the GRUB naming convention because GRUB does not use this, but only passes it to the kernel). "vga=788" tells the kernel what size Framebuffer to run. The are rest are kernel specific options. In this example, devfs=mount to mount the devfs filesystem, hdc=ide-scsi tells hdc to use SCSI emulation (usually used for cd-burners), and splash=silent instructs bootsplash to hide the booting messages (other option is "verbose").


title Windows XP
root (hd0,0)
chainloader +1

This example will have an entry labeled "Windows XP" and will chainload off of hda1. Windows must be chainloaded so that it may boot itself.


Note on Security:


Because of the way GRUB works, it can be easy for someone to pass bad or harmful options to the kernel during boot. To secure GRUB, a password entry can be used. Firstly, run the command "grub-md5-crypt" to generate an md5sum encryption of your password. For example, the password "linux" md5sum'd can be "$1$AUHMA0$lhDHRrJrV0kAkY7QQw0lW.", and would be entered into menu.lst like so...

password --md5 $1$AUHMA0$lhDHRrJrV0kAkY7QQw0lW.

The password entry could also be a non-encrypted password if you desire, by not appending the --md5

password linux

To make a boot entry require a password to boot, just insert "lock" after the title section. For example, say we want to lock windows from being loaded without a password.

title "Windows"
root (hd0,0)
chainloader +1



There are many more options available for GRUB. Please refer to the GRUB Manual for more info on these options and features.

It is possible for GRUB to use a splashimage for the menu. Unfortunately, Mandrake's rpm for GRUB isn't patched for this. Please refer to http://ruslug.rutgers.edu/~mcgrof/grub-images/ for more information on GRUB splash image support.


Please PM me if you think a feature should be added or noted.

Edited by HJ

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Create New...