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: