How to boot from Grub Rescue? Fixed(error): no such partition.

Ever get into the freaking condition, when your system doesn’t boot successfully and throw your control to a grub rescue utility informing the following error?

error: no such partition.
Entering rescue mode...
grub rescue>

I went through this situation today. And here is how I rescued with it.

Actually, I was trying to resize my Linux (Ubuntu 16.04 LTS) partition which is dual booted with Windows 10. For that, my first step was to un-allocate the partition which I wanted to merge with my ext4 (Linux partition). For this, first I logged in Windows and tried unallocate the partition I wanted to merge (Local Disk :D) but I found out that it can be done with Gparted as well. But still.

“I started to explore windows storage management console, and few times detached and reallocate this partition, together with separating out a partition of 3 GB from it. I was just testing the working of the console. But this fun, lead me to freak later in the day.”

Now the next step was to use Gparted in Linux. But for that, I needed to boot in my Linux and here is the twist. When I did reboot my laptop to switch the OS. Oh my God! I get encountered with this scary error.

error: no such partition.
Entering rescue mode... 
grub rescue>

I was screwed up! I didn’t know what the hack had been done with my system.

I searched the web and found out the reason for this error, that was glaring at me was “that I deleted a Windows partition. and somehow I don’t know how, I messed up with some grub configurations. You remember the fun?”

But something worked like heaven for me. Here is the solution, if you ever get into this, proceed as follows.

Note that, other possible solutions might be available, but this is just what worked for me. You are recommended to explore the web first, then go with the solution that suits your condition perfectly.

Step 1: List File Systems

error: no such partition.
Entering rescue mode...
grub rescue> ls
(hd0) (hd0,msdos5) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1)

This “ls” command will list possible file systems where grub might be available. Now our next step is to find out, that which among these listed systems is the one that we can use for booting.

Step 2: Find the File System we may use to boot

grub rescue> ls (hd0,msdos1)
(hd0,msdos1): Filesystem is unknown.
grub rescue> ls (hd0,msdos2)
(hd0,msdos2): Filesystem is unknown.
grub rescue> ls (hd0,msdos3)
(hd0,msdos3): Filesystem is unknown.
grub rescue> ls (hd0,msdos5)
(hd0,msdos5): Filesystem is ext2.

Hurray! we have found out, that which filesystem we have to choose for booting now.

Step 3: A little configuration

grub rescue> set root=(hd0,msdos5)
grub rescue> set prefix=(hd0,msdos5)/boot/grub
grub rescue> insmod normal
grub rescue> normal

After this, I could see the old booting menu, where I may select between Ubuntu and Windows. At this point, it seems that the problem is solved, but that’s not the truth!

Now if you again reboot your system, you will again get into this grub rescue. If you want to permanently fix this issue. Proceed as follows (after step 3).

Step 4: Updating System grub

Log into Ubuntu and just give these 2 commands.

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

Now try to reboot! Hopefully, you are back to your previous experience of booting. After going through this, now I don’t feel that grub rescue is a freaking issue, on the other hand, it’s a simple utility to rescue our system with faulty grub configurations.

When I was back with my Linux and an unallocated partition I proceeded ahead for my goal for resizing. Explore the second part of this journey on How to resize your Linux partition with Gparted?

See you in the next post.

Advertisements

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s