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 Ubuntu 12.04 LTS 64-bit installed on my desktop PC, and it was working fine until a short while ago. I tried to reboot into Ubuntu after removing a Kubuntu installation from my PC and resizing my Ubuntu partition using my 11.10 live CD. When I rebooted, grub showed a black screen and said

Error: no such partition
grub rescue >_

I booted into my live CD again, Ubuntu was still installed and all my data was still there. I still cannot boot into Ubuntu. What should I do?

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

It looks like Kubuntu was still in control of GRUB. When you removed it, you also removed the files grub needed to boot. Fortunately this should be an easy fix.

Since you're already on a live CD, I think the easiest route is to chroot to your installation and run the grub installation scripts. Start by opening your Ubuntu installation (your root partition, which contains folders such as "etc", "usr", and "home") in a file browser in order to mount it.

Now open a terminal.

Find the Mount Pount

In the terminal, type mount This will print out several lines. Look for one that mentions your ubuntu installation in /media. It will look something like:

/dev/sda1 on /media/disk type ext4 (rw,relatime)

In the example above, the device is /dev/sda1 and the mount point is /media/disk. Make a note of this, because we will use this information later.

Set up the Chroot

We need to setup the chroot. This means we will link some system folders from the LiveCD to your installed system. To do this, paste the following text into the terminal, but replace /media/disk with the mount point you found earlier:

for i in sys dev proc; do sudo mount --bind /$i /media/disk/$i; done

The above command runs the following three commands:

sudo mount --bind /dev /media/disk/dev
sudo mount --bind /sys /media/disk/sys
sudo mount --bind /proc /media/disk/proc

This binds /sys, /dev/ and /proc to the same folders on /media/disk. This means that /media/disk/dev/ is actually /dev/

Now we are ready to chroot. In the terminal type chroot /media/disk, where /media/disk is your mount point.

You should now see a root shell (the prompt should end in #). Any command executed here is restricted to your installed partition, and will (for the most part) operate as if you were on your installed system.

Fix the Bootloader

Now all we need to do install the bootloader. In the terminal, paste the following two lines:

grub-install /dev/sda
update-grub

Note: This assumes that you only have one drive in your computer. If you have two, or if you are running from a LiveUSB drive, make sure you replace /dev/sda in the above command with the device from the "Find the Mount Point" section above. Do not include the number at the end of the device. For example, if the device for your partition is /dev/sdb2, then you should use grub-install /dev/sdb.

And that's it! If those commands complete without error, then reboot your computer.

share|improve this answer
    
This may be difficult for the OP... –  hexafraction Jul 20 '12 at 22:07
    
I will be unable to update grub due to my internet situation, is that a problem? –  Sauron Jul 20 '12 at 22:13
    
@Sauron: update-grub is a script that scans your partitions and writes the grub configuration file to give you a boot menu. It doesn't download anything from the internet. –  undecim Jul 20 '12 at 22:27
    
I tried your answer, I got as far as setting up chroot. When I entered the coomand, bash said "syntax error near unexpected token 'do'". What now? –  Sauron Jul 20 '12 at 22:36
    
@Sauron: You mistyped the command. Try copying the command and pasting it into the terminal (Ctrl+Shift+V will paste into the terminal, or you can right-click on the terminal and select 'Paste') –  undecim Jul 20 '12 at 23:06
show 12 more comments

Try reinstalling grub from a live CD boot?

share|improve this answer
    
How do I do that? –  Sauron Jul 20 '12 at 22:01
    
add comment

Please boot a live CD, and select to Try Ubuntu. Open a terminal and run:

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

pressing enter when prompted. When this finishes, run

sudo apt-get install -y boot-repair && boot-repair

and use the default settings. At the end, it will give a link. Please tell us this link to help diagnose.

share|improve this answer
    
I am asking this question on my laptop, not my desktop, which is out in my shop and out of my wifi's reach. I'll have to drag it into the house to do this, it'll be a bit before I can tell you what happens. –  Sauron Jul 20 '12 at 22:11
    
Actually, I have decided to try undecim's answer, so I'm not going to try your's unless his doesn't work. –  Sauron Jul 20 '12 at 22:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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