Differences between revisions 10 and 11
Revision 10 as of 2008-07-20 12:28:41
Size: 3852
Editor: ?OlafurSigurdsson
Comment: fixed spelling
Revision 11 as of 2009-03-16 03:33:53
Size: 3852
Editor: anonymous
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 46: Line 46:
[[Anchor(installation)]] <<Anchor(installation)>>

GRUB


Configuration

The GRUB configuration file is /boot/grub/menu.lst. In some places you will see references to /etc/grub.conf, but that file does not exist in Debian (at least not in my machine)

It must contain at least these lines:

 default=0
 timeout=30
 # To boot the default kernel
 title Debian Linux
 root (hd0,1)
 kernel /boot/vmlinuz root=LABEL=/
 initrd /boot/initrd.img

Quick command overview

  • default: the default OS to boot if you do not hit any key (surprised?). Note the first is the 0.

  • timeout: the time in seconds to wait before the default OS is booted.

  • title: the text that is going to appear in the menu. Starts a OS section until other title line is found.

  • root: the partition where /boot directory is. All paths will be relative to this partition, so we do not need to especify it for each file

  • kernel: the linux kernel image to load along with all the options for it

  • initrd: the initrd image to boot the kernel with.

Please note that the root command is not related to the root parameter for the linux kernel. root specifies the partition to look relative paths . If you have a /boot partition in (hd0,0) then

 root (hd0,0)
 kernel ''vmlinuz root=LABEL=''

Is the same as

 kernel (hd0,0)/vmlinuz

GRUB device and partition naming

Grub uses numbers to name hard disk and partitions begining with 0. This is a bit confusing for the linux user used to call hda1 the first disk - first partition. A simple table illustrates it:

linux

grub

First IDE bus, master

hda

hd0

First IDE bus, master, first primary partition

hda1

hd0,0

First IDE bus, slave, first extended partition

hdb5

hd1,4

Installation

To install grub as the master boot system for the system, just exec:

 # grub-install /dev/hda

No more, no less. From now you only need to edit /boot/grub/menu.lst

Examples

Linux

If you do not know where /boot lives, just exec grub and try to find a file, example:

 grub> kernel (hd0,1)/bo

And press tab, if boot is found in that partition the line will be completed. This works also on the boot menu. For example, I have windoze in hda1, a //boot partition on hda2, and // is in hda3

 grub> kernel (hd0,0)/vm (<- I press TAB here)
 Error 15: File not found

 grub> kernel (hd0,1)/vm (<- I press TAB again, then completes to vmlinuz)
  Possible files are: vmlinuz-2.6.10-1-k7 vmlinuz

I see /boot is in hd0,1. Then my lines are:

 title Linux
 root (hd0,1)
 kernel /vmlinuz root=/dev/hda3 vga=792
 initrd /initrd.img

Windows on hda1

These are the lines I have to boot windoze, located at hda1

 title ["SuckingXP"]
 rootnoverify (hd0,0)
 makeactive
 chainloader  +1

Windows in other place not in hda1

If the disk order has changed the ms boot system gets confused and refuses to boot. If you have it in hdb1 this can solve the problem:

 title Windoze
  map (hd0) (hd1)
  map (hd1) (hd0)
  rootnoverify (hd1,0)
  makeactive
  chainloader +1

You can do more magic hiding partitions with the command hide. For example, if it's in hda2

 title Windoze
  hide (hd0,0)
  rootnoverify (hd0,1)
  makeactive
  chainloader +1

> note: ms boot system has several critical holes, and its behaviour changes depending in version and patch level

See Also

*GRUB documentation: http://www.gnu.org/software/grub/manual/html_node/index.html *?BuildYourOwnKernel, at the bottom in the Notes section.