Ubuntu – Grub rescue after installing Ubuntu on a external HDD from USB


I have Windows 7 installed in my internal HDD and wanted to try out Ubuntu so I have an USB to put Ubuntu LiveUSB on and installed Ubuntu on a external HDD and everything worked out fine.

Now the problem. If I remove the external HDD and try to boot Windows normally it shows the grub rescue screen. The only way to boot into Windows is by having the external HDD attached.

Is there any way I can make it so I won't have to have the external HDD attached to be able to boot my Windows 7?

Best Answer

When you installed Ubuntu, it placed the Grub bootloader on your internal drive MBR, but all the grub modules are stored on your Ubuntu partition, on the external drive. Grub won't let you do much if it cannot load the modules, so, without the external plugged in you cannot boot anything.

What you should have done is to leave the Windows bootloader on the internal drive, and installed Grub to the external. Then whenever you plug in the external, just override at startup to boot from the external.

To install Grub to the external MBR (assuming it's /dev/sdb):

sudo grub-install /dev/sdb

To get Windows booting without the external, reinstall the Windows bootloader. To do this boot from a Windows 7 repair CD or the Windows Installation DVD to a repair prompt and run:

bootrec /fixmbr

You can make a Windows Repair CD from Windows if you don't have one. It's also possible to install a Windows-like bootloader from your Ubuntu install:

sudo apt-get install lilo
sudo lilo -M /dev/sda mbr

Note that lilo will popup a large warning screen, but it's safe to ignore it as this refers to when it's used to boot linux.

This is what it looks like to use lilo (note the command is case-sensitive):

bcbc@neptune:~$ sudo apt-get install lilo
[sudo] password for bcbc: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 275 kB of archives.
After this operation, 807 kB of additional disk space will be used.
Get:1 http://mirror.csclub.uwaterloo.ca/ubuntu/ precise/main lilo amd64 1:23.2-2 [275 kB]
Fetched 275 kB in 1s (198 kB/s)
Preconfiguring packages ...
Selecting previously unselected package lilo.
(Reading database ... 505850 files and directories currently installed.)
Unpacking lilo (from .../lilo_1%3a23.2-2_amd64.deb) ...
Processing triggers for man-db ...
Setting up lilo (1:23.2-2) ...
bcbc@neptune:~$ sudo lilo -M /dev/sda mbr
Backup copy of /dev/sda in /boot/boot.0800
The Master Boot Record of  /dev/sda  has been updated.

You'll see a warning that looks like this - it can be ignored when you use lilo as a windows-style bootloader:

enter image description here

Related Question