GRUB Legacy

From ArchWiki
Jump to navigation Jump to search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end GRand Unified Bootloader (GRUB)

Installing Grub package

First install grub with pacman

pacman -Sy grub

Edit the menu.lst with your settings

nano /boot/grub/menu.lst

Note: Use hd[a-z] for ide and sd[a-z] for scsi and sata

Here is mine for example:

# Config file for GRUB - The GNU GRand Unified Bootloader
# /boot/grub/menu.lst

#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/hda        (hd0)
#  /dev/hdb2       (hd1,1)
#  /dev/hda3       (hd0,2)

#     +-------------------------------------------------+
#          | 640x480    800x600    1024x768   1280x1024
#      ----+--------------------------------------------
#      256 | 0x301=769  0x303=771  0x305=773   0x307=775
#      32K | 0x310=784  0x313=787  0x316=790   0x319=793
#      64K | 0x311=785  0x314=788  0x317=791   0x31A=794
#      16M | 0x312=786  0x315=789  0x318=792   0x31B=795
#     +-------------------------------------------------+

# general configuration:
timeout   5
default   1
color light-blue/black light-cyan/blue
# boot sections follow
# each is implicitly numbered from 1 in the order of appearance below
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.

# (0) Arch Linux
title  Arch Linux  [cpio]
root   (hd0,0)
kernel /vmlinuz26 root=/dev/sda6 ro vga=773
initrd /kernel26.img

title  Arch Linux  [thinkpad]
root   (hd0,0)
kernel /vmlinuz26thinkpad root=/dev/sda6 ro video=vesafb:off acpi_sleep=s3_bios
initrd /kernel26thinkpad.img

Copy the mounts to mtab

grep -v rootfs /proc/mounts > /etc/mtab

Installing the boot loader into Master Boot Record

Now usually there are two ways to install GRUB. One way is to make a boot disk (on a floppy drive, or cd-rom), and the other way is to install grub directly from a running Arch install. If you are upgrading a version of grub you might want to do the latter because its simpler and faster, but the GRUB website states that doing the boot disk method is safer.

Using the grub-install utility

grub-install -root-directory Mount-Point (hdn) 

Installs grub into the MBR of a hard disc. The option gives the path to the kernel-image, if it is not in /, i.e. in /boot.
(hdn) is a disc, where n is the number of the disc, starting with 0.


If you have a separate boot partition mounted at /boot, do one of the following

grub-install --root-directory=/boot '(hd0)'
grub-install --root-directory=/boot sda
grub-install --root-directory=/boot hda

If you don't have a separate boot partition, then just run the command without the --root-directory option

 grub-install /dev/sda

Warning GRUB does not understand the naming schemes hda, sda, etc. It views the disk in terms of (hd0), (hd1), etc. This is why one 'must' be careful when using grub-install.

grub-install tries to map the BIOS drives to hda/sda format, and usually it does this correctly. The way to check if this is done correctly is provided by the command after it has finished installing the bootloader. grub-install will print something along the lines of

(fd0) /dev/fd0
(hd0) /dev/hda

You have to check if this mapping is correct. If it is not correct, go to /boot/grub and edit the '' file so that it is correct. Then re-run the grub-install utility to reinstall GRUB.

Boot loader configuration

The grub configuration is done in this file:

  • (hdn,m) is the partition m on disc n, numbers starting with 0
  • splashimage (hdn,m)/grub/Name.xpm.gz is the splash-image-file
  • default n is the default boot entry, that is choosen after timout for user action
  • timeout m time m to wait in seconds for a user selection, before default is booted
  • password -md5 str encrypted boot password 'str'
  • title str title string 'str' for a boot entry
  • root (hdn,m) base partition, where the kernel is stored to
  • kernel /path ro root=/dev/device initrd /initrd.img use the root option, if the kernel not placed in /
  • makeactive
    chainloader +1
    sets root active and gives booting procedure to its boot-loader (for Windows, f.e.)
  • map (hd0) (hd1)
    map (hd1) (hd0)
    changes primary and secondary disc for a boot, necessary to boot Windows from a secondary disc
  • root (hdn,m,z)
    kernel /boot/loader
    boots the FreeBSD-Partition x
  • default saved remembers each current boot selection and makes it the new default. Place "savedefault" at the end of each boot section, for that you want this feature shall be used.

For those who like eye-candy, there is Graphical GRUB.

Dual booting

These are the two most common ways of configuring the menu.lst file. For more compex uses, click here.

Dual booting with Windows

Add this at the end of your /boot/grub/menu.lst. This assumes that your Windows partition is [s/h]da2.

# (2) Windows XP
title Windows XP
rootnoverify (hd0,1)
chainloader +1

Dual booting with other linux distros

This is done exactly the same way that Arch linux is loaded. Here we assume that the other distro is on partition [s/h]da3.

title Other Linux
root (hd0,2)
kernel /boot/vmlinuz (add other options here as required)
initrd /boot/initrd.img (if the other kernel uses/needs one)

LiLO and GRUB interaction

If you once had used lilo Don't forget to remove it with

pacman -R lilo

as some tasks (f.e. kernel compilation using make all) will make a lilo call, and then lilo is installed over grub. Note that this will not remove lilo from the MBR, but it will be overwritten when you install another bootloader.


  • If you are having problems like grub freezing when you do a grub install, use the command abs to get the PKGBUILDS of the arch base packages and then use the command as root:
cd /var/abs/base/grub/

External Resources