I have Window 7 installed on my computer. Then I installed Ubuntu 12.04.
Windows 7 shown in the boot menu of Ubuntu, but can't start successfully.
So I searched to fix this problem.
I found a way, by starting the computer with Windows 7 CD and opened command line and executed the following commands.
bootrec /?
bootrec /FixMbr
bootrec /FixBoot
After this, Windows 7 started directly with succesful. But there is a new problem. Where is Ubuntu? How I can switch to it? :)
So, I started searching to fix this problem. And found a way by starting the computer with Ubuntu 12.04 Live CD and followed below steps in Terminal.
- See which partition is Ubuntu installed on:
$ sudo fdisk -l
- Mount Ubuntu partition. Pay attention "sda6" is for me.
$ sudo mount /dev/sda6 /mnt
- Install grub to mounted partition. Please notice that it's "/dev/sda", not "/dev/sda6". "sda" is the hard disk which Ubuntu installed.
$ sudo grub-install --root-directory=/mnt/ /dev/sda
- Restart the computer and run the following command:
$ sudo update-grub
Extra Tips:
If "grub-install: error: cannot find EFI directory." error message shown.
Try to specify --efi-directory:
sudo grub-install --root-directory=/mnt/ --efi-directory=/boot/efi/ /dev/sda
If "grub-install: error: failed to get canonical path of `/cow'.." error shown.
Mount EFI partition (in my example is /dev/sda3) to /mnt/boot/efi and then try:
sudo mount /dev/sda3 /mnt/boot/efi
sudo grub-install --root-directory=/mnt/ /dev/sda
Reference: www.webupd8.org