Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
Glad that I am not the only one! plus.google.com/103621378732713508804/posts/i7ddQoUXJ52 –  Stefan Lasiewski May 1 '12 at 21:30
add comment

1 Answer

up vote 28 down vote accepted

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
share|improve this answer
    
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 –  eegg Apr 26 '12 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 '12 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 ... –  eegg Apr 26 '12 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 '12 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 '12 at 20:23
show 3 more comments

protected by Community Apr 29 '12 at 10:28

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.