How to Fix GRUB Boot Issues in Linux: A Complete Guide

"Stability is the goal of IT operations, but anomalies are the daily reality."
Photo by mos design / Unsplash

πŸš€

If your Linux system fails to boot and stops at the GRUB command line (grub> or grub rescue>), it usually indicates a bootloader failure. Many users mistakenly reinstall GRUB or even the entire operating system, but in most cases, this issue can be fixed without reinstallation.

πŸ“Œ In this guide, you’ll learn:
βœ… Why your system is stuck at grub> or grub rescue>
βœ… How to manually boot your system using GRUB commands
βœ… Step-by-step methods to restore the GRUB bootloader
βœ… Best practices to prevent GRUB-related issues


πŸ›‘ 1. Understanding the GRUB Boot Failure

When GRUB fails, your system may stop at one of two different command-line interfaces:

1️⃣ grub> Prompt (GRUB Normal Mode)

  • GRUB is loaded, but its configuration is missing or incorrect.
  • Common Causes:
    • Incorrect bootloader configuration
    • Kernel or initrd.img file missing from /boot

You might see an error like:

error: you need to load the kernel first.

2️⃣ grub rescue> Prompt (GRUB Rescue Mode)

  • GRUB cannot find its core files or cannot access the disk.
  • Usually occurs when GRUB files are missing or the disk is unreadable.
  • Common Causes:
    • GRUB installation is corrupted
    • Filesystem errors on /boot or root partition
    • Disk partition UUIDs changed after a disk replacement

πŸ” 2. Diagnosing the Issue

Before fixing GRUB, identify the exact cause of the problem.

πŸ”Ή Step 1: Check Available Partitions

From the grub> or grub rescue> prompt, list detected partitions:

ls

πŸ“Œ Example Output:

(hd0) (hd0,msdos1) (hd0,msdos2)

Try listing files in /boot:

ls (hd0,msdos1)/boot/

βœ… Expected Output:
You should see vmlinuz, initrd.img, and grub directory.

If the /boot partition is missing or inaccessible, the issue is likely a corrupt filesystem or incorrect partition settings.


πŸ› οΈ 3. Fixing GRUB from the grub> Prompt

If your system stops at grub>, it means GRUB is functional, but its configuration is missing or incorrect.

πŸ”Ή Step 1: Manually Boot Linux from GRUB

1️⃣ Set the correct boot partition (adjust (hd0,msdos1) as needed):

set root=(hd0,msdos1)
set prefix=(hd0,msdos1)/boot/grub
insmod normal
normal

2️⃣ If GRUB loads but shows "You need to load the kernel first," manually boot Linux:

linux (hd0,msdos1)/boot/vmlinuz-$(uname -r) root=/dev/sda1 ro
initrd (hd0,msdos1)/boot/initrd.img-$(uname -r)
boot

βœ… Solution: If this works, the issue is likely a missing or broken grub.cfg file.


πŸ”Ή Step 2: Restore the GRUB Bootloader

If you can boot manually, permanently fix GRUB:

1️⃣ Boot into your Linux system
2️⃣ Reinstall GRUB:

grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
update-grub  # Debian-based systems

3️⃣ Reboot and verify the issue is resolved.


πŸ› οΈ 4. Fixing GRUB from the grub rescue> Prompt

If your system drops to grub rescue>, it means GRUB is unable to locate its core files.

πŸ”Ή Step 1: Locate the Boot Partition

Run:

ls

Try different partitions until you find /boot/grub:

ls (hd0,msdos1)/boot/grub

πŸ”Ή Step 2: Load the Correct GRUB Modules

Once you've identified the correct partition, run:

set root=(hd0,msdos1)
set prefix=(hd0,msdos1)/boot/grub
insmod normal
normal

This should bring you back to the normal GRUB menu.

πŸ”Ή Step 3: Reinstall GRUB

Once you boot into Linux, reinstall GRUB:

grub-install /dev/sda
update-grub
reboot

πŸ“Œ If the root filesystem is corrupted, repair it first:

fsck -y /dev/sda1

πŸ›‘οΈ 5. Preventing Future GRUB Issues

To avoid bootloader failures, follow these best practices:

βœ… Backup the GRUB configuration regularly

cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak

βœ… Ensure correct partition UUIDs in /etc/fstab

blkid
cat /etc/fstab

βœ… Avoid forced power shutdowns Use:

shutdown -h now

instead of unplugging power.

βœ… Check for disk errors periodically

fsck -n /dev/sda1

βœ… Be cautious when updating the kernel If upgrading the kernel, make sure GRUB updates correctly:

update-grub

πŸ“Š 6. Summary

Issue Solution
System stuck at grub> prompt Manually boot Linux, update GRUB config
grub rescue> prompt (GRUB missing) Locate /boot/grub, reinstall GRUB
Cannot load kernel (error: you need to load the kernel first) Set correct root partition, check kernel and initrd paths
Boot failure after disk replacement Update GRUB configuration and /etc/fstab with correct UUIDs
Prevent GRUB issues Backup GRUB config, verify disk health, avoid forced shutdowns

πŸ’¬ Join the Discussion!

Have you ever faced GRUB boot issues in Linux?
How did you fix them?

πŸ’¬ Share your experiences in the comments below! πŸš€

πŸ‘‰ If you're troubleshooting Linux filesystem errors, check out: How to Recover Files from the Linux lost+found Directory


Read more