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:
/bootfolder/vmlinuzand/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).
- Boot into the live USB environment.
- Open a terminal and find your root partition using:
sudo fdisk -l
- Mount your Linux root partition (assume it’s
/dev/sda1):
sudo mount /dev/sda1 /mnt
- If you have a separate
/bootor/boot/efipartition, mount those as well:
sudo mount /dev/sda2 /mnt/boot
sudo mount /dev/sda3 /mnt/boot/efi
- Bind important system directories:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
- Chroot into your installed system:
sudo chroot /mnt
- Reinstall GRUB:
grub-install /dev/sda
update-grub
- 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
/bootbefore resizing or modifying disks. - After any kernel or bootloader update, verify that
grub.cfgis updated. - Use tools like
boot-repairin 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
prefixor 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.























