Stuck at 'grub rescue>'? The Ultimate Guide to Fixing Your Ubuntu Bootloader
It's a moment of pure panic for any computer user. You turn on your machine, expecting to see your familiar Ubuntu desktop, but instead, you're greeted by a stark black screen with a single, cryptic line of text: `error: no such partition. grub rescue>`. It feels like your computer is broken and all your data is gone. Take a deep breath. In most cases, your data is perfectly safe, and this problem is entirely fixable. This guide will calmly walk you through what this error means and how to rescue your system.
Why Am I Seeing This? Understanding the GRUB Bootloader
Think of GRUB (GRand Unified Bootloader) as the doorman for your computer. When your computer starts, GRUB's job is to find your operating system (Ubuntu) on the hard drive and load it. The `grub rescue>` prompt appears when the first stage of GRUB loads, but it can't find the second, more important stage, which contains the menu and the information needed to boot Ubuntu. This usually happens because:
- A recent Windows update overwrote the Linux bootloader.
- You manually changed or resized your disk partitions, and GRUB no longer knows where to look.
- A failed Ubuntu update corrupted the GRUB configuration files.
Phase 1: The Manual Rescue (Booting from the Command Line)
Our first goal is to temporarily boot into your Ubuntu system. This requires a few commands to manually tell GRUB where to find its files. This process is safe and will not damage your data.
Step 1: Find Your Ubuntu Partition
At the `grub rescue>` prompt, you need to figure out which partition your Ubuntu installation is on. Type the `ls` command and press Enter:
grub rescue> ls
You'll see a list of your drives and partitions, like `(hd0)`, `(hd0,msdos1)`, `(hd0,msdos2)`, etc. Now, you must check each partition to find the one with your Linux files. Use the `ls` command on each one like this:
grub rescue> ls (hd0,msdos1)/
grub rescue> ls (hd0,msdos2)/
You are looking for the partition that shows a familiar Linux filesystem with folders like `boot/`, `etc/`, `home/`, and so on. Once you find it, make a note of it. For this example, let's assume we found it on `(hd0,msdos2)`.
Step 2: Set Boot Parameters and Load GRUB
Now, type the following commands one by one, replacing `(hd0,msdos2)` with the partition you found in the previous step:
set prefix=(hd0,msdos2)/boot/grub
set root=(hd0,msdos2)
insmod normal
normal
After typing `normal` and pressing Enter, if all went well, you should see the familiar purple GRUB menu appear. You can now select "Ubuntu" and boot into your desktop. But remember, this is a temporary fix. If you restart, you'll be back at the rescue prompt.
Phase 2: The Permanent Fix (Using a Live USB)
Now that you're back in your system (or if the above steps didn't work), it's time to perform a permanent repair using a bootable Ubuntu USB drive.
Step 1: Create and Boot from a Live Ubuntu USB
You will need another computer to create a bootable USB drive with the same version of Ubuntu you have installed. Once it's created, plug it into the broken computer and restart. You'll need to enter your BIOS/UEFI menu (usually by pressing F2, F12, or Del at startup) and choose to boot from the USB drive. Select "Try Ubuntu" to load into the live desktop environment.
Step 2: Install and Run Boot-Repair (The Easy Way)
The easiest and most recommended way to fix GRUB permanently is with a fantastic tool called Boot-Repair. Connect to the internet, open a terminal (Ctrl+Alt+T), and run these three commands:
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair && boot-repair
The Boot-Repair application will launch. Simply click the "Recommended repair" button and let it do its work. It will automatically detect your operating systems and reinstall GRUB correctly. When it's finished, shut down, remove the USB drive, and boot your computer. It should now boot normally.
Conclusion: Rescued and Repaired
Facing the `grub rescue>` prompt is a rite of passage for many Linux users. While it looks terrifying, it's almost always a solvable software issue. By learning how to navigate the rescue prompt and using the powerful Boot-Repair tool, you have not only fixed your computer but have also gained a deeper understanding of how your system works.