Difference between revisions of "GRUB"

From ArchWiki
Jump to: navigation, search
(add grub2 page)
Line 14: Line 14:
== Installing Grub2 package ==
== Installing Grub2 package ==
First install grub3 with pacman
First install grub2 with pacman
  pacman -Sy grub2
  pacman -Sy grub2

Revision as of 15:43, 3 December 2008

Template:Article summary start Template:Article summary text

Template:Article summary heading Template:I18n entry Template:Article summary end

General Warining

The next generation of the GRand Unified Bootloader (GRUB2) is still under development and therefore all usual points apply. GRUB2 may fry you computer, burn your house, or eat your cat. You've been warned! For most people, except those with more exotic configurations, GRUB2 should just work.

Installing Grub2 package

First install grub2 with pacman

pacman -Sy grub2

Edit the grub2 configuration file with your settings. The 'old' menu.lst is replaced by a new file called grub.cfg

nano /boot/grub/grub.cfg

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

Here is an example of a simple configuration file:

# Config file for GRUB2 - The GNU GRand Unified Bootloader
# /boot/grub/grub.cfg
#  Linux           Grub
# -------------------------
#  /dev/fd0        (fd0)
#  /dev/sda        (hd0)
#  /dev/sdb2       (hd1,2)
#  /dev/sda3       (hd0,3)
# Timeout for menu
set timeout=5
# Set default boot entry as Entry 0
set default=0
# (0) Arch Linux
menuentry "Arch Linux" {
set root=(hd0,1)
linux /vmlinuz26 root=/dev/sda1 ro
initrd /kernel26.img
## (1) Windows
#menuentry "Windows" {
#set root=(hd0,3)
#chainloader +1

Installing or Restoring GRUB to the Master Boot Record

GRUB may be installed from a live environment, or directly from a running Arch install.

In most cases, installing grub2 would be as easy as running the grub-install command as root:

# grub-install /dev/sda

where /dev/sda is the destination of the installation (in this case the MBR of the first SATA disc)

Alternatively, you should be able to install grub2 by booting the system and running the grub command as root:

# grub
{this section is still incomplete, some steps should be added!!!}

Boot loader configuration

The grub configuration is done in this file:


Be warned this section isn incomplete, feel free to put all missing configuration options here!

  • (hdn,m) is the partition m on disc n, numbers starting with 1
  • set default=n is the default boot entry, that is choosen after timout for user action
  • set timeout=m time m to wait in seconds for a user selection, before default is booted
  • menuentry "str"{entry options} title string 'str' for a boot entry & basic layout
  • set root=(hdn,m) base partition, where the kernel is stored to
  • linux /path ro root=/dev/device initrd /initrd.img use the root option, if the kernel not placed in /
  • chainloader +1 sets root active and gives booting procedure to its boot-loader (for Windows, f.e.)

Dual booting

These are the two most common ways of configuring the grub.cfg file. For more complex uses, feel free to add descriptions 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
menuentry "Windows XP" {
set root=(hd0,3)
chainloader +1

Note, that although commonly believed to be the case, Windows 2000 and later versions do not need to be on the first partition to boot. If the Windows partition changes number (i.e. if you after install add a partition before the windows partition), you will need to edit the Windows boot.ini file to reflect the change (see this article for details on how to do that).

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.

menuentry "Other Linux" {
set root=(hd0,2)
linux /boot/vmlinuz (add other options here as required)
initrd /boot/initrd.img (if the other kernel uses/needs one)

Tips and tricks

Please add any tips and tricks here


Any troubleshooting should be added here

External Resources

Grub2 homepage