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 had Ubuntu 12.04 Beta installed on my computer. When 12.04 was finally released, I made a bootable USB Flash Drive using Startup Disk Creator.

Then I decided to check if this drive works properly and to reinstall the system on my desktop. I must add, my desktop behaves a bit strange when it comes to bootable USB's, it recognizes them as HDD.

In BIOS I changed priority of boot so USB Flash Drive (recognized as HDD) was first. Successfully booted, I installed Ubuntu. Everything worked fine, but...

Now I cannot boot from my real HDD. Every time I want to boot, I put the USB Flash Drive into my computer, boot, safely remove it and everything works.

What do I need to do to repair boot?

share|improve this question

8 Answers 8

up vote 20 down vote accepted

It looks like Grub got installed to the USB drive. Boot with the USB drive, open a terminal window by pressing Ctrl-Alt-T then run

sudo grub-install /dev/sda

That command will install GRUB to the MBR of the first hard drive, which should make it bootable.

share|improve this answer
1  
What if /dev/sda isn't the drive GRUB should be installed on? Should this be addressed in this answer or is the boot-repair tool mentioned in knezmej's answer safer? –  jamesadney Apr 27 '12 at 19:08
    
If dev/sda is not the drive, the command won't work, and you'll have to use the appropriate designation, in other words, /dev/sdb, /dev/sdc, etc. –  mikewhatever Apr 28 '12 at 0:45
    
"It looks like you've installed grub to the USB drive." I agree with everything except this. I just did an install and left everything as is, so it's seems the installer does this by default, which is really quite an oversight by Ubuntu. I guess their testers must be using install CDs. –  Gerry Apr 28 '12 at 21:11
    
When booting form USB and executing this command, the user won't require sudo, will he?? –  Akshit Baunthiyal Aug 3 '12 at 4:19
    
Why not? Wouldn't you get 'permission denied' error? I haven't tried it without sudo, to be honest. –  mikewhatever Aug 3 '12 at 5:42

It would be a good idea to mention to complete the following command:

sudo fdisk -l 

to determine where the HD logical partition is. In my case it was at the following address:

/dev/sdb therefore it was not working before. Now it is :)

In summary do the following frist

sudo fdisk -l (determine your logical partition)

then

sudo grub-install /dev/(location to the main HD logical partition)

Sheers!

share|improve this answer

As said above in the last post, It looks like you've installed grub to the USB drive. Boot with the USB drive, unplug it, then run:

sudo grub-install /dev/sda

That command will install GRUB to the MBR of the first hard drive, which should make it bootable.

When done above, this has worked perfect for my installation of 12.04 LTS.

share|improve this answer

The problem

Grub, Ubuntu's bootloader, was installed on the flash drive, and not on your internal hard drive, as it should have been.

Solution

Boot with the flash drive plugged in. Remove it once Ubuntu is booted up.

Run the following commands from a Terminal:

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

Click on the "Recommended repair" button, and reboot.

Explanation

Boot-Repair installed Grub to your internal hard drive. This allows your computer to boot without depending on the bootloader that was installed on the flash drive.


Glossary

Bootloader: a piece of code that runs before any operating system is running. A bootloader is used to boot other operating systems. Each operating system usually has its own bootloader.

GRUB (Grand Unified Bootloader): a bootloader package developed to support multiple operating systems and allow the user to select among them during boot-up. It is Ubuntu's default bootloader.

Command, command line: the traditional Unix environment , where you type commands to tell the computer what to do.

Terminal: an application that allows you to access the command line. Open it by hitting its keyboard shortcut, Ctrl Alt T

share|improve this answer

I have such problem too. I do the last update on my system flash stick (very useful thing which!) After rebooting I found: 1. System from flash cannot boot itself. 2. System from PC fails boot without the stick; if the stick is on then system from it will be booted instead the system from PC.

Looks like your update patched without prompt my primary grub (on my primary drive) instead of those, from which the system was booted. It may cause a lot of headache for users who have systems on removable drives.

share|improve this answer

I had this problem when trying to install Ubuntu from a persistent USB drive. I started over with a non-persistent USB and it worked fine. It wasn't ideal, but it worked.

share|improve this answer

Actually this seems to be a bug in the Ubuntu Installer. I also created a bootable USB drive using Ubuntu 11.10. I created a couple of drives for other distributions using the same Ubuntu 11.10 before, so the bug cannot be in 11.10.

After the setup of 12.04 was finished, I had to keep the USB connected to make Ubuntu start.

share|improve this answer

You could also try to use repairing software e.g. boot-repair-ubuntu from ppa:yannubuntu/boot-repair

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair
share|improve this answer

protected by Community Apr 12 at 1:31

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.