I've had this problem before and I always follow this site: https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows
But here's a copy-paste of what you need to do:
Short story:
Boot Ubuntu using Live CD or USB and run sudo grub-install /dev/XXX
replacing XXX with the device you installed Ubuntu on, for example sudo grub-install /dev/sda
Long story:
Boot up Ubuntu using a Live CD or USB.
Open a terminal. As of Ubuntu 11.10 and 11.04, this can be done by opening the Unity Dash (you can click the Ubuntu logo in the top panel or use the Windows key on your keyboard) and typing in "Terminal", and clicking what comes up. On earlier versions, you can achieve this by going to Applications→Accessories→Terminal. Alternately use the Keyboard Shortcut: Ctrl+Alt+T.
For full details on using terminal to fix grub on hard drive from Live Installer DVD or Flash: https://help.ubuntu.com/community/Grub2/Installing#via_the_LiveCD_terminal
You are then presented with a standard bash prompt, type - this only works to reinstall to MBR of a working system:
sudo grub-install /dev/XXX
where XXX is the device of your Ubuntu install. (E.g.: grub-install /dev/sdb
). Hint: You can also use /dev/disk/by-label/
if the partition you installed on has a label. You can determine the /dev
node for such a device by running:
ls -l /dev/disk/by-label/
This will give the output of something like:
lrwxrwxrwx 1 root root 10 Oct 16 10:27 data -> ../../sdb2
lrwxrwxrwx 1 root root 10 Oct 16 10:27 data2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Oct 16 10:27 fat -> ../../sda6
lrwxrwxrwx 1 root root 10 Oct 16 10:27 home -> ../../sda7
lrwxrwxrwx 1 root root 10 Oct 16 10:27 root -> ../../sda1
lrwxrwxrwx 1 root root 10 Oct 16 10:27 swap -> ../../sda5
lrwxrwxrwx 1 root root 10 Oct 16 10:27 windows -> ../../sdb1
You can also use gparted --list
if you do not see the /dev/disk/by-label
:
$ sudo parted --list
Model: ATA WDC WD10TPVT-00U (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
3 1049kB 1000GB 1000GB primary ext4
From here, find only the drive name, ignore the partition number, that is, for partitions labelled root
, data2
, fat
, home
and swap
it's all still just sda
. This is due to the fact that GRUB is installed in the MBR of the drive, and not on a partition.
Trouble? If other things are messed up, e.g. if you have deleted the partition from where Grub was previously installed, grub-install may return an error message such as cannot find a device for /... (is /dev mounted?)
. You may have to do grub-install
a bit differently. Refer to the handy guide on fixing a broken system
Now reboot your system. The usual GRUB boot menu should appear. If it does not, hold Left Shift while booting. You will be able to choose between Ubuntu and Windows.