Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

GRUB: The Grand Unified Boot Loader

Debian Packages: grub

Grub (the GRand Unified Bootloader) is a boot loader designed to address the limitations of lilo. It makes up for numerous deficiencies in many PC BIOSs while providing full-featured command line and graphical interfaces. Grub recognises fdisk partitions, can dynamically read Linux ext2fs, and MSDOS FAT16 and FAT32 filesystems, and can boot multiboot-compliant kernels (such as GNU Mach), as well as standard Linux and MS/Windows kernels.

A good introduction to grub is available from http://www.gnu.org/software/grub/grub.html and a good guide to multi-boot setup is http://www.tldp.org/HOWTO/Multiboot-with-GRUB.html. This latter resource looks at multi-booting four operating systems although the information is still useful if all you want is to multiboot just two.

To switch from lilo to grub simply install it with:

  # wajig install grub
  # grub-install /dev/hda
  # update-grub

This creates a /boot/grub/menu.lst file which you might like to review just to make sure it looks okay. For most simple situations it should be fine.

For a dual boot with MS/Windows/NT on the first partition and Linux on the second (like Mint), you may need to change the default locations of Linux. Look at /boot/grub/menu.lst to see if the following two lines have been changed:

# kopt=root=/dev/hda1 ro
# groot=(hd0,0)
to
# kopt=root=/dev/hda2 ro
# groot=(hd0,1)
Also, add to the end of the file:
title           Windows NT
rootnoverify    (hd0,0)
makeactive
chainloader     +1

Once it looks okay, run update-grub then reboot!

When installing new kernels you can have the new kernel automatically added to the menu by adding the following lines to /etc/kernel-img.conf (and in fact making the file look the same as) :

  # Turn off Lilo stuff
  do_symlinks = no
  do_bootloader = no

  # Initrds are OK for GRUB
  do_initrd = yes

  # Run cool GRUB stuff
  postinst_hook = /sbin/update-grub
  postrm_hook = /sbin/update-grub

If you start having problems booting, at the grub menu type c to get the command line. Try:

  root (hd0,4)     (/dev/hda5)
  kernel /boot/vmlinuz-2.4.18-bf2.4 root=/dev/hda5 ro
  boot

More information on using grub is available from the Linux Journal.

Copyright © Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Graham Williams is the developer of open source software including rattle and wajig.
He is the author of Data Mining with Rattle and Essentials of Data Science.
This web site is hosted by Togaware, free and open source software since 1984.