Grub is a boot loader for many Linux distributions which basically tells your system where it can find installed operating system(s) on one or more hard drives. Your PC needs this information in order to boot into your Linux distro successfully. If grub becomes corrupted, one such error you may come across is "error: no such partition grub rescue."

This error most commonly arises when resizing or rearranging the partitions of a hard drive, as is necessary with dual boot in Ubuntu or dual boot in Manjaro, for example. If you've received this error out of the blue (i.e. you haven't made any recent changes to your hard drive), it could be a sign of the hard drive going bad.

Regardless of the cause, we've written this guide to help you get your Linux system back up and running. In this article, we'll give you the step by step instructions to fix the dreaded "no such partition" grub error.

In this tutorial you will learn:
  • How to fix grub error: no such partition grub rescue
GRUB boot loader for Linux
GRUB boot loader for Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro using grub
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Fix grub error: "no such partition grub rescue" step by step instructions

In order to rescue grub, you'll need a bootable live CD/DVD or USB drive. Ideally, this should be the same operating system that you have currently installed on your PC.

In the steps below, we're using the apt-get package manager, available on Ubuntu, Debian, and most derivatives. If you're using a different distro, you'll need to adjust those commands accordingly (for example, using pacman in Manjaro).

Once you've created your bootable media and inserted it into the PC, boot directly to the live environment. Once loaded up, open a terminal and type the following commands:

  1. First, we need the drive name and partition number that we're trying to rescue. Type the following command to see a full list of the partitions on your hard drive:
    $ sudo fdisk -l
    

  2. SUBSCRIBE TO NEWSLETTER
    Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


  3. The hard drive and partition will be identified by something like /dev/sda5, but that's just an example, yours is likely different. Once you know how yours is called, type the following commands (while substituting the hard drive name and partition number where necessary) to mount the partition:
    $ sudo mkdir /mnt/temp
    $ sudo mount /dev/sda5 /mnt/temp
    
  4. Next, it's necessary to chroot into the installed system to reinstall the grub packages. Execute the following commands:
    $ 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
    
  5. If your terminal prompt has changed to show the root user (i.e. root@ubuntu:/#) then the chroot was successful. Now it's time to remove grub; be sure to use purge so all of the grub conf files are also removed. You'll also be prompted asking if you're sure that you want to remove grub, use TAB on your keyboard to select 'Yes' and continue.
    # apt-get update
    # apt-get purge grub grub-pc grub-common
    
  6. Finally, reinstall grub with the following commands:
    # apt-get install grub-common grub-pc
    # update-grub
    
  7. That should be it. To wrap up, exit chroot and unmount everything with the commands below. Then, remove your live media and reboot the system.
    # exit
    $ for i in /dev/pts /dev /proc /sys; do sudo umount /mnt/temp$i ; done
    $ reboot
    

As long as your terminal didn't return any errors when following the steps above, you should now be able to boot directly into your Linux system as before.

Conclusion

If grub doesn't work properly, your computer doesn't know how to load Linux. There are a few reasons for why grub may fail to find a partition to boot to, with the most common cause being when a user rearranges partitions and the changes fail to sync with grub's configuration. The steps above work by completely reinstalling grub and all of its configuration files. This will allow your system to find the Linux OS on your hard drive and boot to it.

FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions