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.

This question already has an answer here:

I had Windows 7 and Ubuntu on my hard drive working without any problems, but after installing a program called "Acronis True Image" and using its "try and decide" function, I lost GRUB.

How do I recover the Ubuntu installed on my hard drive? Do I use my USB device or CD?

Edit: Ok, thanks for your answers, but I think I was not very clear ... happens every time I run the application "Try and decide" from "Acronis True Image" I lose the GRUB, what I want is to boot the ubuntu operating system on my computer from my USB Device whenever I need it without having to restore the GRUB increasingly

share|improve this question

marked as duplicate by Florian Diesch, Eric Carvalho, Avinash Raj, Braiam, chaskes Jan 9 at 6:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
See askubuntu.com/questions/88384/… for various ways to reinstall GRUB or repair GRUB. –  user68186 Jan 8 at 21:04
    
Thanks "Seth" for the correction! –  Guillermojortizr Jan 8 at 21:05
    
Ok, thanks for your answers, but I think I was not very clear ... happens every time I run the application "Try and decide" from "Acronis True Image" I lose the GRUB, what I want is to boot the ubuntu operating system on my computer from my usb drive each time you need without having to restore the GRUB increasingly –  Guillermojortizr Jan 8 at 21:22
    
You can install GRUB in the USB drive. Then set put the USB as the first device in BIOS> Boot priority. That way, if the USB is plugged in, it will show GRUB and let you choose Ubuntu. If the USB device is not plugged in, it will boot Windows. –  user68186 Jan 8 at 22:05
    
Apparently Acronis nuke the bootloader (GRUB) each time you do that. I don't think this is related to Ubuntu and must consult the manual of Acronis to make sure that that's the desired/designed behavior. If it isn't report it to Acronis. –  Braiam Jan 9 at 2:06

1 Answer 1

To recover Windows 7, you can follow the instructions at Ubuntu boots to grub rescue : Use the Windows Repair Disk to boot into a command prompt on Windows 7 and then run the following commands:

bootrec.exe /FixMbr

Then, to recover Ubuntu, you can follow the instructions at Ubuntu boots to grub rescue :

Boot from a liveCD or a LiveUSB.

Confirm the partition number of your main partition. GParted can help you here. I'm going to assume in this answer that it's /dev/sda2, but make sure you use the correct partition number for your system!

Mount your partition after making sure your hard drive IS /dev/sda2:

sudo mount /dev/sda2 /mnt  # make sure that sda2 is correct!

Bind mount some other necessary stuff:

for i in /sys/proc/run/dev; do sudo mount --bind "$i" "/mnt$i"; done

chroot into your Ubuntu install:

sudo chroot /mnt

At this point, you're in your install, not the live CD, and running as root. Update grub:

update-grub

If you get errors, go to step 7. (Otherwise, 7 is optional.)

Depending on your situation, you might have to reinstall grub:

grub-install /dev/sda
update-grub 

I'm not sure if this is necessary, but it doesn't hurt. If everything worked without errors, then you're all set:

exit
sudo reboot

At this point, you should be able to boot normally.

share|improve this answer

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