Translation(s): English - Français - Italiano - Русский

BootLoader > GRUB

GRUB is the GRand Unified Bootloader, a very powerful newish BootLoader that can be used to boot most operating system on the intel platforms.

Debian provides both GRUB v1 and v2 (more on Debian BootLoader).

Installing GRUB Package

Up to Debian Lenny

GRUB v1 for Debian (package grub) can be installed with:

To install GRUB v2, you need install the appropriate variant of grub v2, depending on your system's firmware (usually grub-pc, see grub2 variants).

Debian Squeeze and later

GRUB "v2" for Debian (package grub) can be installed with:

If your system isn't a regular PC (i.e if your system has EFI or OpenFirmware rather than a BIOS), you may have to install another version of GRUB (see GRUB 2 variants).

Configuring GRUB

Configuring GRUB v1

The configuration file is /boot/grub/menu.lst

Under Debian, the GRUB configuration file is updated automatically, when you install a new kernel. This is done automatically by update-grub.

You can edit the settings in /boot/grub/menu.lst. Make sure you read the comments, /usr/share/doc/grub/README.Debian.gz for more information and the update-grub(8) manpage from your distribution.

Configuring GRUB v2

The configuration file is /boot/grub/grub.cfg, but you shouldn't edit it directly. This file is generated by grub v2's update-grub(8), based on:

  1. The script snippets in /etc/grub.d/

  2. The configuration file /etc/default/grub

To configure grub "v2", you should edit /etc/default/grub, then run update-grub. Advanced configuration are achieved by modifying the snippets in /etc/grub.d/.

Also check the GRUB2 page for more detailed configuration instructions, ideas and suggestions.

Upgrading from v1 to v2

To upgrade to GRUB v2, you should:

  1. Install GRUB v2 (but don't remove the grub 1 yet).
  2. Follow the instruction displayed the package installation (i.e GRUB v1 now has an entry to cascade to GRUB v2, so reboot and try it, then you can actually enable grub2 bootloader by running upgrade-from-grub-legacy).

Transition from v1 to v2

Installing GRUB on disk

If you are ok with your GRUB configuration, you can install GRUB on the MBR of your disk using grub-install.


Dual Boot FreeBSD with GPT partition

  1. Edit /etc/grub.d/40_custom, adding the following (replace X with your FreeBSD partition):
    menuentry 'FreeBSD 10.1 amd64' {
                insmod ufs2
                set root='(hd0,gptX)'
                kfreebsd /boot/loader
  2. Update GRUB.

Dual Boot

Will GRUB allow me to hibernate Linux and activate another operating system (such as Windows XP) that I hibernated earlier, i.e. a !DualHibernate rather than a DualBoot?

Nothing will prevent you to hibernating (GRUB isn't aware that your host is suspended). However, make sure you don't mount the same partition (RW) under any two suspended OS !

Is there a way to install GRUB in the MasterBootRecord from DOS or Windows XP, i.e. a utility similar to rawrite.exe or fdisk.exe that write a GRUB MBR? What I want here is to install Linux without having a bootable floppy

There is/was a win32 Version of GRUB, i used it to install linux from Windows 2000 , but i am not sure what exactly the source is ;-) (google for grubwin32) Just unzip grubwin32 to c:\ then run c:\boot\grub\w32grub This would patch the necessary files(under XP, not linux). Then add :


And you now have a GRUB boot loader on your XP system.

When I upgraded from GRUB to GRUB2 I lost an entry to XP/WP7 , how can I recover the menu entry to boot there?
You have to install os-prober, make sure its enabled in GRUB2 configuration and sync GRUB2.

apt-get install os-prober


Finally run update-grub2

By default GRUB2 in debian will not add 'resume=/dev/swap-partition' option.
But if you want to perform this by default you can edit /etc/grub.d/10_linux file and make some changes there:


linux  ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}

with this

linux  ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} resume=`swapon -s | grep '/dev/sd.[0-9]' -o`

This will add your first swap partition to all found linux entries.

See Also

External Links


  1. GRUB is the main default bootloader on x86... But some other bootloaders are installed by default in some scenario that aren't supported by GRUB v1. (1)