GRUB (GRand Unified Bootloader) is an operating system bootloader. It acts as a "conduit" between turning on the computer and starting the kernel.
When the computer turns on:
- The device runs very simple code (BIOS/UEFI).
- This code looks for a bootloader, such as GRUB.
- GRUB loads the kernel into memory and transfers control to it.
In other words, without a bootloader, the kernel cannot start.
The computer itself doesn't know where the kernel is located on the disk. GRUB can:
- find the kernel on the disk
- pass it startup parameters
- select between multiple kernels or operating systems
- support booting from different devices (HDD, SSD, USB, network)
GRUB consists of several parts:
-
Stage 1 — the minimal code at the very beginning of the disk. It knows where to find Stage 2.
-
Stage 2 — the main bootloader code. It can:
- read file systems
- display the kernel selection menu
- load the kernel into memory
- Configuration file — determines:
- which kernels are available
- command-line parameters for the kernel
- timer and selection menu
- Kernel or OS selection: you can have multiple kernel versions and select the one you need.
- Passing parameters to the kernel: for example, how much memory to use, which drivers to enable.
- Works with different file systems: FAT, NTFS, ext4, and others.
- Command line mode: allows you to manually load the kernel or fix errors.
- Universal: supports different architectures and kernels.
- Flexible: you can add your own scripts and menus.
- Reliable: can correctly load the kernel even from multiple drives.
BIOS/UEFI → GRUB → Kernel → Init/Userspace → Programs
- BIOS/UEFI — minimal startup code
- GRUB — finds and starts the kernel
- Kernel — manages the hardware
- Init/Userspace — starts the terminal, programs, and interfaces
Without GRUB (or another bootloader), the kernel cannot start.