Translation(s): English - Français - Italiano - Português (Brasil) - Русский
BootLoader > GRUB
GRUB is the GRand Unified Bootloader, a very powerful BootLoader that can be used to boot most operating systems.
Debian provides both the latest GRUB v2 and the legacy GRUB v1.
GRUB v2 is the default bootloader since DebianSqueeze (it was first provided in DebianLenny).
GRUB v1 was the main 1 default bootloader on x86 platforms (until DebianSqueeze).
Contents
Installing GRUB
The latest grub is usually installed for you, for example by the DebianInstaller. If you did want to install it by hand you would run apt install grub2 as root. This will install the default grub-pc package: If your system has EFI or OpenFirmware rather than a BIOS, you may have to install a different package, such as grub-efi.
The legacy GRUB v1 is available in the grub-legacy package.
Configuring GRUB
Configuring GRUB v1
The settings for the legact GRUB v1 are read from /boot/grub/menu.lst
Under Debian, the GRUB v1 configuration file is updated automatically, by update-grub, when you install a new kernel.
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 https://manpages.debian.org/stable/grub-legacy/update-grub.8.en.html manpage.
Configuring GRUB v2
To configure GRUB v2, you should edit /etc/default/grub or the scripts in /etc/grub.d/ and then run update-grub (see https://manpages.debian.org/stable/grub2-common/update-grub2.8.en.html)
The GRUB2 page has more detailed configuration instructions, ideas and suggestions.
Upgrading from v1 to v2
To upgrade from GRUB v1 to GRUB v2, you should:
- Install GRUB v2 (but don't remove the grub 1 yet).
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).
The GRUB Transition page provides historical information about this transition.
Installing GRUB to the MBR
You usually do not need to worry about this, but should you need to, you can install GRUB to the MBR of your disk using grub-install.
FAQ
Dual Boot FreeBSD with GPT partition
- 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 } - 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 :
c:\boot\stage1="GRUB"
to c:\boot.ini
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
Then edit /etc/default/grub and make sure you have a line like
GRUB_DISABLE_OS_PROBER=false
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:
Replace
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
GRUB Configuration: GrubConfiguration
Recover GRUB: GrubRecover
From LILO to GRUB: FromLiloToGrub
GRUB rebooting: GrubReboot
External Links
GRUB v1 was usually the default bootloader for x86. Other bootloaders were used for setups not supported by GRUB v1. (1)
