GRUB Boot Loader

GRUB is the "GRand Unified Bootloader", a boot loader that supports multiple boot options, such as various Linux boot modes, and other operating systems like Windows, BSD, and so on.

A boot loader simply loads up what's necessary for an operating system to start up, such as where's the kernel and with what options should it be loaded. Once it loads it up it hands off control to the kernel to complete the process.

You can configure GRUB boot options by editing the /boot/grub/grub.cfg or in some systems /etc/grub.conf file or using one of the graphical tools that make doing this easier and safer. For most Linux users the grub configuration will be automatically created, even including other operating systems you might have installed.

Key part of the grub.cfg file is where it lists the operating system options. One such entry may look something like this (from a sample configuration):

menuentry 'Ubuntu, with Linux 2.6.32-24-generic' –class ubuntu –class gnu-linux –class gnu –class os { recordfail insmod ext2 set root='(hd1,6)' search –no-floppy –fs-uuid –set 6655ee5e-45d1-4d1c-9a7d-10f30f16e745 linux /boot/vmlinuz-2.6.32-24-generic root=UUID=6655ee5e-45d1-4d1c-9a7d-10f30f16e745 ro quiet splash initrd /boot/initrd.img-2.6.32-24-generic }

The menuentry line defines the name of the entry and proceeds to specify some options. Key options here are set root, which specifies the partition on which the root directory of the operating system resides, the linux option followed by a path on the specified root directory where the kernel is and with which options to load it, and the initrd line specifying the location of the initialization file.

Besides these menu entries and options you can also set some general options for GRUB. A couple basic ones that may be of interest are GRUB_DEFAULT and GRUB_TIMEOUT.

GRUB_DEFAULT sets which of the menu entries will be selected by default, and booted into automatically after a timeout. Its numeric value corresponds to the order in which a menu entry is listed, keeping in mind that it starts at "0", not "1". So if you want the first menu entry to be the default you set GRUB_DEFAULT=0 or if you want the third one to be the default set GRUB_DEFAULT=2, and so on.

You can also set GRUB_DEFAULT=saved if you want the default to be the last selected entry on the previous boot.

GRUB_TIMEOUT simply sets the number of seconds it will count to before booting the default entry automatically. It's typically set to 10 seconds: GRUB_TIMEOUT=10. You can change it to whatever you want, or put "-1" if you want to disable the timeout and have it boot only when you explicitly tell it to. Of course, "0" will make it boot immediately.

If you've edited the grub.cfg file and saved it you also need to update grub with the new configuration by running this command:

sudo update-grub

Finally, if you need an easy way to modify GRUB bootloader configuration with a graphical user interface you can use grub-customizer or Boot Repair.