Troubleshooting Boot Issues with GRUB

Resolve GRUB boot issues on Linux with clear, beginner-friendly steps, common fixes, and recovery tips. Follow simple commands and rescue-mode guidance to safely restore your bootloader.

Troubleshooting Boot Issues with GRUB

A short introduction to what causes GRUB boot problems and why they matter. GRUB is the bootloader that hands control to your operating system; if it’s missing or misconfigured your machine won’t boot. This guide walks through diagnosing common failures and repairing GRUB using a live USB, with clear commands and examples.

Diagnosing the Problem

Start by identifying whether the problem is GRUB itself, the kernel, or firmware/partition layout. Common symptoms: “grub rescue>” prompt, “error: no such partition”, or firmware dropping to UEFI/BIOS without passing control to GRUB.

Useful diagnostic commands to run from a live Linux USB or an existing system:

Check files on boot partitions (example mounting an installed root)

sudo mount /dev/sda2 /mnt
ls -l /mnt/boot
ls -l /mnt/boot/efi   # if UEFI system and EFI partition already mounted

Show partition types and flags:

sudo fdisk -l /dev/sda
# or for GPT:
sudo parted -l

Identify disks and partitions:

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

If you see a grub rescue prompt on boot, try these minimal GRUB shell checks (from the grub rescue> prompt):

grub rescue> ls
(hd0) (hd0,msdos1) (hd1,msdos1)
grub rescue> set
grub rescue> ls (hd0,msdos1)/
  • Use ls to identify where /boot/grub (or /grub) lives.
  • The error message often directly names a missing partition or module.

Explanations:

  • If you see UEFI firmware screens, you likely have an EFI System Partition (ESP). If BIOS/MBR messages appear, you’ll be working with grub-install for BIOS.
  • Knowing whether your system boots with UEFI vs BIOS determines the repair steps.

Rescue from a Live USB (chroot method)

The chroot method lets you repair GRUB from a running Linux environment by mounting your installed system and “chrooting” into it. This is reliable and works for most cases.

Steps (replace /dev/sda2 with your root partition, /dev/sda1 with EFI if UEFI):

# 1. Boot live USB, open terminal

# 2. Mount the root filesystem
sudo mount /dev/sda2 /mnt

# 3. If you have a separate /boot:
sudo mount /dev/sda3 /mnt/boot

# 4. If UEFI, mount the EFI system partition
sudo mount /dev/sda1 /mnt/boot/efi

# 5. Bind mount system dirs
for i in /dev /dev/pts /proc /sys /run; do sudo mount --bind $i /mnt$i; done

# 6. Chroot
sudo chroot /mnt /bin/bash

# 7. Inside chroot, update environment
export LANG=C

Inside the chroot you can run:

# Update package lists (if needed)
apt update

# Reinstall GRUB to the disk (example BIOS):
grub-install /dev/sda

# Reinstall GRUB for EFI (example):
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu

# Recreate GRUB config
update-grub
# or
grub-mkconfig -o /boot/grub/grub.cfg

Explanation:

  • Binding /dev, /proc, and /sys is required for chroot to behave like the installed system.
  • For UEFI, ensure the EFI partition is mounted at /boot/efi before grub-install.
  • Always use the disk (e.g., /dev/sda), not a partition (e.g., /dev/sda1) when installing the bootloader on BIOS systems.

Reinstalling and Repairing GRUB

If files are missing or GRUB modules can’t be found, a reinstall often fixes the issue. There’s also GRUB rescue minimal fixes if you need to boot quickly.

Reinstall GRUB on BIOS systems:

sudo grub-install --recheck /dev/sda
sudo update-grub

Reinstall GRUB on UEFI systems:

# Ensure EFI is mounted at /boot/efi
sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
sudo update-grub

Quick rescue from GRUB rescue> prompt (temporary):

# Example when /boot/grub is on (hd0,1)
grub rescue> set prefix=(hd0,1)/boot/grub
grub rescue> set root=(hd0,1)
grub rescue> insmod normal
grub rescue> normal

If insmod fails with “unknown filesystem”, the partition type may be corrupted or GRUB cannot read it.

Explanation:

  • Using --recheck forces probing of devices. The --bootloader-id names the boot entry visible in UEFI boot menus.
  • update-grub (Debian/Ubuntu) or grub2-mkconfig -o /boot/grub2/grub.cfg (RHEL/Fedora) generates the grub.cfg with discovered kernels.

Commands table (quick reference)

Command Purpose Notes
lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT Show block devices and types Useful to find root and EFI partitions
sudo mount /dev/sdXY /mnt Mount partition Replace sdXY with your partition
sudo chroot /mnt /bin/bash Enter installed system Do this after bind mounts
grub-install /dev/sda Install GRUB to MBR (BIOS) Use disk device, not partition
grub-install --target=x86_64-efi --efi-directory=/boot/efi Install GRUB for UEFI Ensure /boot/efi is mounted
update-grub Regenerate grub.cfg (Debian/Ubuntu) Use grub-mkconfig on other distros
efibootmgr -v Show UEFI boot entries Requires efibootmgr installed
boot-repair (GUI) Automated repair tool Useful for beginners; may hide details

Advanced recovery: EFI, Secure Boot, and common edge cases

UEFI introduces extra failure modes: missing EFI entries, renamed ESP, or Secure Boot blocking unsigned GRUB. Use efibootmgr to view and adjust UEFI boot order.

Inspect UEFI entries:

sudo efibootmgr -v

If the desired entry is missing, recreate it (example):

sudo efibootmgr --create --disk /dev/sda --part 1 --label "ubuntu" --loader /EFI/GRUB/grubx64.efi

Mount the EFI partition and verify files:

sudo mount /dev/sda1 /mnt
ls -l /mnt/EFI
# Look for ubuntu, GRUB, Microsoft, shimx64.efi

Secure Boot considerations:

  • If Secure Boot is enabled, the firmware may only allow signed bootloaders. Distros usually install shimx64.efi that is signed and loads GRUB.
  • If you build a custom GRUB or kernel, you may need to sign them or disable Secure Boot to boot.

Other advanced checks:

# Check disk UUIDs used in /etc/fstab
grep -E "UUID=" /mnt/etc/fstab

# Verify kernel images and initramfs exist
ls -l /boot/vmlinuz-* /boot/initrd.img-*

Explanation:

  • UEFI firmware stores boot options in NVRAM; efibootmgr edits those. Reinstalling GRUB may register a new entry but NVRAM may still point elsewhere.
  • Common mistakes: wrong partition mounted as /boot/efi, failing to install shim when Secure Boot is on.

Common Pitfalls

  • Not mounting the EFI partition before running grub-install in UEFI mode — leads to missing .efi files and no boot entry.
  • Installing GRUB to the wrong disk/partition (e.g., /dev/sda1 vs /dev/sda) — use the disk device for bootloader installation.
  • Failing to bind /dev, /proc, /sys before chroot — chroot environment will be incomplete and package commands can fail.

Next Steps

  • Try a full chroot reinstall of GRUB if one-off fixes fail.
  • If UEFI/Secure Boot issues persist, temporarily disable Secure Boot in firmware and test booting.
  • Backup current partition table and /boot before making further changes; consider creating a recovery USB image.

This article covered diagnosing boot failures, step-by-step rescue using chroot from a live USB, reinstalling GRUB for BIOS and UEFI, and specific tips for handling Secure Boot and EFI entries. Use the commands table as a quick reference and experiment carefully — keeping backups of important data and partition tables will make recovery much simpler.

👉 Explore more IT books and guides at dargslan.com.