Connect with us

Hi, what are you looking for?

Technology

How to Use GRUB Rescue to Fix Linux Boot Failure

Facing a boot failure on your Linux machine can be frustrating, especially if you’re welcomed by the cryptic grub rescue prompt instead of your familiar desktop interface. GRUB, the GRand Unified Bootloader, is one of the most critical components on Linux systems, responsible for booting the operating system. When GRUB is corrupted or misconfigured, it prevents your OS from loading, leaving you with limited options—unless you know how to intervene manually.

TL;DR

If you’re stuck in grub rescue mode, don’t panic. This article walks you through identifying your Linux partition and repairing the GRUB bootloader using a systematic, step-by-step approach. You’ll learn how to find your root filesystem, set the correct boot parameters, and reinstall GRUB if needed—all from a rescue prompt or a live USB environment. These instructions can restore your Linux system without losing data.

Understanding the GRUB Rescue Mode

The grub rescue prompt typically appears when GRUB can’t find the correct files to boot your Linux operating system. This often happens due to:

  • Deletion or corruption of the /boot partition or files
  • Repartitioning or resizing disks without updating GRUB
  • Accidental removal of the GRUB bootloader
  • File system damage or disk issues

Before you proceed, remember that you’re interacting with a very limited shell. You can’t access full Bash features or utilities—only a few basic commands.

Step 1: Inspect the Available Partitions

At the grub rescue prompt, the first step is to see what partitions are accessible. Use the following command:

ls

This will return a list resembling (hd0) (hd0,msdos1) (hd0,msdos2), etc. The different entries represent physical disks and partitions. Your goal is to find the partition that contains the Linux root file system, usually something like (hd0,msdos1) or (hd0,gpt2), depending on your system’s partitioning scheme.

Step 2: Locate the Linux Root and Boot Partitions

Now start testing each partition to find the one containing the /boot/grub directory. Use:

ls (hd0,msdos1)/

Keep trying different partitions until you see the familiar Linux directory structure. Look specifically for:

  • /boot folder
  • /vmlinuz and /initrd.img (kernel and initramfs)
  • /boot/grub (GRUB configuration files)

Once you’ve identified your root and boot partitions, make a note of them. Most systems have a separate /boot partition, but sometimes everything is in one place.

Step 3: Set the Correct Boot Parameters

Now that you’ve identified the right partition—for this example, we’ll assume it’s (hd0,msdos1)—run the following commands:

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

If everything goes correctly, your system should now attempt to boot into the usual GRUB menu or directly into Linux. If you get any error like “unknown filesystem” or “file not found”, recheck the partition and try again with a different one.

Step 4: Boot Temporarily Using Commands

If you cannot fully reach the GRUB menu, you can attempt to boot into Linux manually. Suppose your Linux kernel and initrd are located in (hd0,msdos1)/boot/vmlinuz and (hd0,msdos1)/boot/initrd.img. Here’s how you can proceed:

set root=(hd0,msdos1)
linux /boot/vmlinuz root=/dev/sda1 ro
initrd /boot/initrd.img
boot

Make sure to replace /dev/sda1 with your actual root partition as recognized by the Linux kernel. If successful, this method will boot your Linux OS into a functioning session.

Step 5: Permanently Repair GRUB Using a Live USB

If you’re unable to boot using manual commands or you want to repair GRUB permanently, you’ll need to use a Linux live USB (e.g., Ubuntu or Debian).

  1. Boot into the live USB environment.
  2. Open a terminal and find your root partition using:
sudo fdisk -l
  1. Mount your Linux root partition (assume it’s /dev/sda1):
sudo mount /dev/sda1 /mnt
  1. If you have a separate /boot or /boot/efi partition, mount those as well:
sudo mount /dev/sda2 /mnt/boot
sudo mount /dev/sda3 /mnt/boot/efi
  1. Bind important system directories:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
  1. Chroot into your installed system:
sudo chroot /mnt
  1. Reinstall GRUB:
grub-install /dev/sda
update-grub
  1. Exit chroot and reboot:
exit
sudo reboot

Your system should now boot normally.

Preventing GRUB Issues in the Future

To reduce the risk of encountering GRUB Rescue mode in the future, keep these best practices in mind:

  • Always back up important partitions like /boot before resizing or modifying disks.
  • After any kernel or bootloader update, verify that grub.cfg is updated.
  • Use tools like boot-repair in Ubuntu-based systems for simplified GRUB issues.
  • Keep a USB bootable rescue environment at hand in case of emergencies.

Common Errors and Troubleshooting Tips

Here are some frequently encountered errors and how to address them:

  • “Unknown filesystem” – Likely you’re pointing to the wrong partition or the partition is corrupted.
  • “file /boot/grub/i386-pc/normal.mod not found” – You may have the wrong prefix or are missing core GRUB files.
  • “grub-install: command not found” – This indicates you’re either not in chroot or your environment lacks GRUB. Try apt install grub.

Conclusion

While ending up at a grub rescue prompt can be intimidating to many users, fixing it doesn’t require reinstalling Linux or losing data. With a methodical approach—examining partitions, adjusting GRUB parameters, and possibly using a live USB—you can fully recover your bootloader and get your system back in working order.

Learning how GRUB works and how to manipulate it from a rescue prompt is a valuable skill for any Linux user, particularly those managing servers or dual-boot systems. Remember to document your partition layout and keep system repair tools nearby to stay prepared in the event of future boot issues.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

Technology

Sometimes, your Beelink Mini PC may refuse to boot or act strangely. One quick fix is resetting the CMOS. This clears the BIOS settings...

Software

Photos are incredible pieces of history, unparalleled by any other form of documentation. Years from now, they’ll be the only things that’ll allow people...

Reviews

Technology is a key part of modern life and something we all use on a daily basis. This is not just true for our...

Software

Your Facebook profile is like an open book, constantly exposed for anyone with an internet connection to flip through its pages. It’s no secret...