Ubuntu Grub Rescue Commands

Just this very sweet morning you began your laptop and Boom! You get a black screen with a message that “Unknown Filesystem” and a message saying grub rescue. Now you are right here at Techolac to see how you can tackle out of this issue and also save your valuable data and boot typically into Linux again. Let us discuss some grub rescue commands.

Ways To Rescue Or Recover Grub

​You might be thinking about what has happened to distro. There may be many reasons. You might have installed some software, might mess with GRUB2, who knows you used some other distro trying dual booting and many other things. No matter what the reason may be, most of the time the problem is with the GRUB. Below are certain ways you can use to get your distro back from the screen of Grub Rescue.

Death Screen of Linux saying:

error: no such partition

grub rescue

Requirements and presumptions:

Now lets see how can we rescue the grub here.


To fix grub rescue go with following steps:

  • First thing is we have to start our OS only then after we can fix grub.
    #to start OS-->
    error: unknown filesystem.
    Entering rescue mode...
    grub rescue>

    When you see such an error first we have to check for “Filesystem” is ext2′

    grub rescue> ls        # type 'ls' and hit enter to see drive partition.
    (hd0) (hd0,msdos6) (hd0,msdos5) (hd0,msdos4) ...   # you will see such things 

this are our drives now we have to check which one is ext2.

grub rescue>ls (hd0,msdos6)
error: disk 'hd,msdos6' not found.

go for another drives until you get “Filesystem is ext2”.

grub rescue>ls (hd0,msdos5)
error: disk 'hd,msdos5' not found.
grub rescue>ls (hd0,msdos2)
(hd0,msdos2): Filesystem is ext2        # this is what we want

now set the path

grub rescue>set boot=(hd0,msdos2)
grub rescue>set prefix=(hd0,msdos6)/boot/grub
grub rescue>insmod normal
grub rescue>normal
  • Now just fix grub by following command on any Ubuntu
    sudo grub-install /dev/sda
    sudo apt-get update
    # to update grub
    sudo apt-get upgrade

make sure you must update grub after login into OS


How To Fix: error: no such partition grub rescue

We’ll be using chroot to rescue grub. The whole concept is that since grub configuration files have been deleted or corrupted, it needs to be re-installed. And using the live CD of exact OS version, we can install the grub configuration again. It will delete all the changes (if any) you have made to the grub.

Please follow these steps to easily fix grub rescue problem in Ubuntu (or other Linux distributions):

Step 1: Know you root partition

Boot from live CD, DVD or USB drive. Try Ubuntu from live disk. Open a terminal (Ctrl+Alt+T) and use the following command:

sudo su
fdisk -l

Here, you will see the drive name and partition number. It should look like sdXY. Where X is the drive letter and Y is the partition number. Usually it should be like sdaY.  You have to recognize the partition where root has been installed.

Step 2: Mount the root partition

Once we have got the partition where root has been installed, we’ll mount the root partition where Ubuntu has been installed. Use the following commands to mount it:

sudo mkdir /mnt/temp
sudo mount /dev/sdXY /mnt/temp

Replace XY with appropriate values.

Step 3: Be the CHROOT

Once we have the partition mounted, next step is to mount certain items in preparation of the chroot. Run the following commands one by one:

for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/temp$i;  done
sudo cp /etc/resolv.conf /mnt/temp/etc/resolv.conf
sudo chroot /mnt/temp


If the above commands ran successfully, you’ll see root@ubuntu:/# in the terminal indicating that you are in chroot mode.

Step 4: Purge Grub 2 packages

Now when we are in chroot environment (you can think of it as if we are behaving as root for the mounted partition)., time to get rid of the Grub 2 packages but before that lets update the repository.

apt-get update
apt-get purge grub grub-pc grub-common

While removing the grub, you’ll see a strange screen asking if you want to remove Grub 2 packages. Press TAB to select Yes. It will be highlighted once selected. Press enter to proceed.

Step 5: Re-install Grub packages

As we deleted the previous Grub, we deleted the messed up settings as well as any favourite settings stored in it. Now we’ll install a new and fresh Grub. Few things to keep in mind before you go on with the command to install the Grub.

Now when you taken all those things in mind, use the command below to install the Grub.

apt-get install grub-common grub-pc

Update the grub and exit the chroot:


Step 6: Unmount the partition:

We mounted something at the start, didn’t we? Well lets just unmount them.

for i in /dev/pts /dev /proc /sys; do sudo umount /mnt/temp$i ; done

That’s it. Reboot your system and you should see the good old Grub boot screen as before. I hope this tutorial helped you to get rid of error: no such partition grub rescue problem and the tutorial was easy to follow. Any question, suggestions or a word of thanks is always welcomed. Stay tuned for more Linux tutorials.

Exit mobile version