18

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.

1

1 Answer 1

28

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
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
7
  • Hi, thanks. I tried this and it got stuck forever (30 minutes) on a dpkg command. However I did get this Boot Info Summary: paste.ubuntu.com/947723 Apr 26, 2012 at 17:43
  • Ok, then based on the Boot Info script's output, you could try running (from the Live CD): sudo mount /dev/sda6 /mnt && sudo grub-install --root-directory=/mnt/ /dev/sda && sudo chroot /mnt && sudo update-grub && sudo reboot
    – SirCharlo
    Apr 26, 2012 at 17:52
  • IT WORKS! Seriously, thanks. And I shall continue with my head in the sand when it comes to the complexities of bootloaders ... Apr 26, 2012 at 18:08
  • Good! I'm glad it worked! I'll update my answer to help others who could have your problem..
    – SirCharlo
    Apr 26, 2012 at 18:14
  • Thanks a lot .. really it does great.. Now i can log on Ubuntu without a liveCD but windows7 doesn't work .. it asks me to repair my computer.. and another thing .. there's a "boot failed: some code i couldn't catch" before the grub menu appears.. why ??
    – Salahuddin
    Jul 1, 2012 at 20:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .