GRUB (GRand Unified Bootloader) is the dominant bootloader on Linux systems. Developed under the GNU project, it loads the kernel and initial ramdisk from disk, passes them command-line parameters, and transfers control to the kernel. GRUB 2 (the current version, universally used despite the name "GRUB 2") supports a wide variety of filesystems and partition schemes, scripting, menus, chainloading into other operating systems, and both BIOS and UEFI firmware.
On a typical distribution, the core configuration is generated automatically:
sudo vim /etc/default/grub # high-level options
sudo update-grub # Debian/Ubuntu
sudo grub2-mkconfig -o /boot/grub2/grub.cfg # Fedora
This produces /boot/grub/grub.cfg (or similar), which lists available kernels and their parameters. Editing grub.cfg directly is discouraged; edit /etc/default/grub and the scripts in /etc/grub.d/ and then regenerate.
At boot you can press a key (often Shift or Esc) to reveal GRUB's menu, choose an older kernel, add a parameter like single for recovery mode, or open a command-line shell to type a manual boot sequence. On systems where something has gone wrong—a broken initramfs, a missing filesystem, a corrupted root partition—GRUB is often the last tool available before you reach for rescue media.
Discussed in:
- Chapter 3: The Linux Kernel — The Boot Process
Also defined in: Textbook of Linux