18.04.2025

What is GRUB: the boot loader without which Linux won't start

When you power on your computer, what happens before you see your operating system’s logo?

Before the OS even begins to load, a crucial piece of software called the bootloader takes over. In the Linux ecosystem, the most widely used bootloader is known as GRUB.

What is GRUB?

GRUB (GNU GRUB, short for "GRand Unified Bootloader") is an essential utility that manages the boot process, allowing your machine to start one or several operating systems. It’s automatically installed during most Linux setup procedures and is the first program to take control after BIOS or UEFI finishes initializing your hardware. Depending on your setup, GRUB will either present a menu to choose between operating systems or directly launch the Linux kernel without needing user input.

What can GRUB do?

GRUB is more than just "start Linux." It can:

How does GRUB work?

The computer’s boot process happens in several stages:

  1. BIOS or UEFI — Initializes hardware and searches for a bootloader.
  2. GRUB Stage 1 — Loads from the MBR (on older systems) or the EFI partition (on newer ones).
  3. GRUB Stage 2 — The main part of GRUB, which loads the configuration and the kernel.
  4. Operating System Kernel — The Linux (or other OS) kernel is loaded and takes over control.

Configuring and Recovering GRUB

Where is GRUB’s configuration stored?

The main GRUB configuration file is located at:

/boot/grub/grub.cfg

However, it is not recommended to edit this file directly because it is automatically generated by the system. Instead, you should modify:

/etc/default/grub

After making changes, update the bootloader configuration using:

sudo update-grub

Example configuration of /etc/default/grub:

GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -d -s 2>/dev/null || echo Ubuntu`
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="acpi=force"

How to recover GRUB if it stops working?

If after installing Windows or replacing a drive Linux no longer boots, GRUB might have been overwritten. You can recover it using a Live USB distribution.

Run the following commands:

sudo mount /dev/sdXn /mnt
sudo grub-install --boot-directory=/mnt/boot /dev/sdX

Then, enter the installed system's environment and update the configuration:

sudo chroot /mnt
update-grub

GRUB and Multi-OS Selection

If you have multiple operating systems installed on your machine, GRUB will automatically create a boot menu allowing you to choose which OS to launch — for example:

You can customize the order and appearance of this menu via the /etc/default/grub file and update it using update-grub. You can also set the default system and adjust the timeout before automatic boot.

GRUB 1 vs GRUB 2

Today, most systems use GRUB 2 — a more flexible and modular version that supports modern boot formats. The older GRUB (Legacy) is now obsolete and rarely used.

Conclusion

GRUB is not just a bootloader — it is a critical component of the Linux ecosystem, providing flexible control over operating system startup. Thanks to its wide range of features, it fits both simple user systems and complex setups with multiple OSs and non-standard boot conditions.

Proper GRUB configuration can not only speed up the boot process but also help prevent potential issues related to multi-boot setups, system updates, or recovery after failures.

While its configuration might seem complex at first glance, understanding the basic principles — like editing /etc/default/grub instead of directly modifying grub.cfg — significantly simplifies working with this powerful tool.

By mastering GRUB, you gain not only control over your system's boot process but also increase its resilience to unexpected changes and failures.

Looking for reliable and flexible cloud solutions?

With Serverspace, you can quickly rent virtual servers tailored to your needs — from lightweight instances for simple projects to powerful configurations for demanding applications. Easily deploy isolated VPC environments for maximum security and network control. Plus, explore a comprehensive library of detailed tutorials, how-to guides, and technical articles that will help you set up, configure, and optimize your infrastructure at every stage. Whether you're launching your first Linux server, managing multi-OS boot environments, or building a complex cloud architecture, Serverspace offers the performance, scalability, and expert resources to support your success. Start building today with intuitive tools, flexible billing, and 24/7 technical support.