Ubuntu – GRUB complains of “no such partition” after installing 12:04


I have just installed 12.04. I previously had 11.10 installed, with /dev/sda6 as the install partition mounted at / and with /dev/sda1 mounted at /home. When installing 12.04, I duly selected the same options, with no reformatting. I selected /dev/sda6 as the bootloader partition. I was warned, as expected, that the system files on /dev/sda6 would be deleted.

After reinstalling, I can't get past GRUB: selecting the main boot option, or the recovery mode option, both give me the error "No such partition", and the option to go back to the main GRUB screen.

What's going on here? What partition is it saying doesn't exist? And obviously, how do I fix this?

Edit 1:

I get the error three times; it looks like:

error: no such partition.
error: no such partition.
error: no such partition.

Press any key to continue ...

This also happens with the "Memory test" boot options.

Entering the command line and running ls gives me the same error.

Best Answer

To repair the Grub bootloader, try these steps.

1 - Live CD

First, you'll need to boot from a Ubuntu Live CD.

2 - Repair the bootloader

Open a terminal from the Live CD, and run the following commands:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair

After a few seconds, Boot Repair's main window will open.

Click on Recommended repair.

You're done!

Reboot to test everything out.

If everything went well, you should be up and running now. If not, keep going.

Command-line version

If the above fails, you can also use the command line (from a Live CD) to reinstall Grub.

Important: Replace sda1 with the partiton that contains Ubuntu and sda with the drive that contains Ubuntu's partition

sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt/ /dev/sda
*edit* at this point, also ensure that if /usr and /var are on seperate partitions that you mount them to /mnt/usr and /mnt/var
*edit 2* whithin the chroot you need to have /dev /run and /proc available for update-grub to work, use the following to acheive that: for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
sudo chroot /mnt
sudo update-grub
sudo reboot
Related Question