error: no such partition. Entering rescue mode…

I recently updated my desktop from Linux Mint 19.3 to 20.1, but ran in to an issue where I was no longer able to see the GRUB boot menu on system startup. I wanted to document the fix here in hopes anyone else who encounters the same issue can find a resolution (and for my own reference should I encounter this error again in the future). I dual boot Windows and Linux Mint, so my disk had several partitions:

  • Windows 10 (primary)
  • Windows 10 (boot)
  • Windows 10 (recovery)
  • Logical partition with:
    • Linux Mint (19.3) partition
    • A small amount of unallocated space

I had everything from Mint 19.3 backed up and wanted to start with fresh install of Mint 20.1, cleaning things up a bit by removing the logical partition and the existing partition on which Mint 19.3 was installed. Mint 20.1 would then be installed on this newly created partition. I did the usual stuff for Linux installation, creating a bootable live USB drive with the Mint 20.1 image and booting my machine with it. I used gParted (installed by default on Mint) to delete the logical partition and the existing Ext 4 partition, and then created a new partition which included the previously unallocated space on the disk. The installation was easy, and when it completed I restarted my machine. However, I was now prompted with the this screen:

I did not see the GRUB boot menu that was previously present, and I was not able to boot the machine into Windows 10 or into the newly installed Linux Mint 20.1. My Google-fu led me to discover that I had likely foobar’d the existing boot configurations. My initial fix was to boot the Windows 10 installer disk and run the “Startup Repair” tool:

This repair attempt was unsuccessful however, and the machine once again booted into the “error: no such partition.” prompt. After some additional research, I found some posts which detailed completely purging GRUB and re-installing it. I again booted into the Mint 20.1 live USB I had created for the install and opened up the terminal. I needed root access first with command sudo su, and them used the Fixed Disk Editor tool to list all all partition tables with command fdisk -l. This will list every partition on each drive. The output I get is similar to the following (I’ve omitted some of the output):

Disk /dev/sda: 465.78 GiB, 500107862016 bytes, 976773168 sectors

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048   1126399   1124352   549M  7 HPFS/NTFS/exFAT
/dev/sda2         1126400 584246014 583119615 278.1G  7 HPFS/NTFS/exFAT
/dev/sda3       584247296 585320447   1073152   524M 27 Hidden NTFS WinRE
/dev/sda4       585320448 976773119 391452672 186.7G 83 Linux

From here I can see I have disk /dev/sda, with four partitions:

  • /dev/sda1
  • /dev/sda2
  • /dev/sda3
  • /dev/sda4

The first three partitions are for Windows, and the last one is the newly created partition from the Mint 20.1 install process. Partition /dev/sda4 needs to be mounted, so first I created a folder named “rescue” in /mnt/ with the mkdir command and then mounted the partition with mount command:

sudo mkdir /mnt/rescue
sudo mount /dev/sda4 /mnt/rescue

Note that device and partition I used (/dev/sda4) may be different on your machine. The next step is to mount these folders from the partition that we just mounted to /mnt/rescue:

  • /dev (device files)
  • /dev/pts (pseudoterminals)
  • /proc (virtual filesystem for kernel processes)
  • /sys (also for kernel processes stuff)

That can be done all at once with the following command:

for x in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/rescue_$i; done

Next, copy file “resolv.conf” (this file contains information about the DNS resolver) with this command:

sudo cp /etc/resolv.conf /mnt/rescue/etc/resolv.conf

After that, change the root director with chroot:

sudo chroot /mnt/rescue

Next, I purged all GRUB packages by first updating the package repository then purging several packages (you must be connected to the internet in order to proceed):

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

This prompted a confimation, I press the TAB key and then ENTER to select “Yes.” After GRUB has been removed, I reinstalled the grub-common and grub-pc packages:

apt-get install grub-common grub-pc

During this install process, I was promoted to select “OK” to add extra kernel options. I was also prompted to select the device (/dev/sda) which will be the boot drive. It is important to not select a partition (/dev/sda1, /dev/sd4, etc) at this step. When the install completes, update GRUB and the exit chroot with these commands:

update-grub 
exit

The last step was to unmount the folders which I have mounted at the beginning of this process. That can be again done in a single line command using a loop:

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

After this final command, I just needed to reboot the machine (and remove the live Mint USB drive) and I once again had my GRUB boot menu, allowing me to select either the existing Windows 10 partition or the new Linux Mint 20.1 partition in which to boot. If the GRUB menu item which is selected by default is not the option you prefer, you can edit file /etc/default/grub and set the value of GRUB_DEFAULT accordingly.

Below are some additional links I found useful when troubleshooting this issue:

https://ubuntuforums.org/showthread.php?t=1581099

https://itsfoss.com/solve-error-partition-grub-rescue-ubuntu-linux/

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s