How to Install GRUB Bootloader: A Step-by-Step Guide

GRUB (Grand Unified Bootloader) is the standard bootloader for Linux systems and dual-boot setups. It presents a menu when your computer starts that lets you choose which operating system to boot into. Here’s how to install it correctly.

What you need first

  • A working Linux installation (or a Live Linux USB if your current bootloader is broken)
  • Knowledge of which disk to install GRUB on (usually your main drive)
  • Whether your system uses BIOS or UEFI firmware

If your bootloader is broken and you can’t boot into your Linux system, boot from a Live Linux USB first. You’ll need to mount your installed system and chroot into it before running install commands.

Step 1: Identify your disk

Open a terminal and run:

lsblk

or

sudo fdisk -l

This lists all disks and partitions. Your main drive is usually /dev/sda. Identify it carefully – installing GRUB to the wrong disk can prevent your system from booting.

Step 2: Install GRUB

For BIOS systems:

sudo grub-install /dev/sda

Replace /dev/sda with your actual disk name. This writes GRUB into the Master Boot Record (MBR) – the first sector your BIOS reads on startup.

For UEFI systems:

First, mount your EFI System Partition (usually FAT32-formatted, often /dev/sda1):

sudo mount /dev/sda1 /boot/efi

Then install GRUB as a UEFI executable:

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub

This registers GRUB with your UEFI firmware as a boot option.

Step 3: Generate the GRUB configuration file

After installing, generate the config that tells GRUB which operating systems are present:

sudo update-grub

or on systems where update-grub isn’t available:

sudo grub-mkconfig -o /boot/grub/grub.cfg

This scans your system, detects installed OSes (including Windows), and writes the boot menu configuration.

Step 4: Reboot

Restart your system. GRUB should load and display a menu listing your installed operating systems. If dual-booting with Windows, it will appear in the list.

Repairing from a Live USB

If repairing a broken install, after booting the Live USB you need to chroot into your installed system before running the install commands. Mount your Linux root partition and EFI partition, then use arch-chroot or chroot to enter your system environment. This makes the GRUB commands run as if inside your actual installation rather than the live environment.

On UEFI systems, use efibootmgr to manage boot entries if GRUB doesn’t appear in your firmware’s boot menu after installation.

Here’s a clear video walkthrough of the BIOS and UEFI installation paths:

The BIOS vs UEFI distinction is the one that causes most failed GRUB installs. Running the BIOS command on a UEFI system, or vice versa, produces an install that doesn’t boot. Checking your firmware mode before starting – either from your BIOS settings or via [ -d /sys/firmware/efi ] && echo UEFI || echo BIOS in Linux – is worth doing first.

the chroot repair path from a live USB is useful knowledge. had to do this when a windows update overwrote the MBR and killed my grub dual boot. booted live usb, mounted root partition, chrooted in, ran grub-install and update-grub, rebooted fine. knowing this exists saves the “my linux install is gone” panic.

The lsblk output before running any install command is important. Confirming you have the right disk identifier before writing to it is not optional. Installing GRUB to a secondary data drive instead of the boot drive is a recoverable mistake but an annoying one. Take thirty seconds to verify the target.

update-grub automatically detecting windows for dual boot is genuinely convenient. you install linux, run grub-install and update-grub, and grub finds the windows partition and adds it to the menu automatically. no manual configuration of the windows entry needed in most cases.

For UEFI systems, efibootmgr being the tool to manage boot entries after install is worth knowing. If GRUB installs correctly but doesn’t appear in the firmware’s boot menu, efibootmgr can list and modify UEFI boot entries. Running efibootmgr -v shows current entries and order.