Retrive GRUB after installing WINDOWS
NOTE: linux is installed to boot in mode BIOS and WINDOWS(7) in mode bios too.
To repair grub you have to start linux on a live-CD or a live-USB.
KNOPPIX launches grub-legacy and can not restablish grub-pc (grub2) The file /boot/grub/stage1
is not read correctly on my laptop, but the live-usb I built with grub2 works flawless!
Start on a liveCD or liveUSB that has grub2 installed.
(or grub-legacy if your system use grub-legacy. In this case KNOPPIX works fine)
to see the partitions:
~$ sudo fdisk -l (or blkid)
If you use a liveUSB, the /mnt directory is free.
~$ sudo mkdir /mntgrub
If you use a liveCD /mnt is busy, so use another free directory.
To be sure of having a free directory, let's create the mntgrub directory:
Then, depending on the case (/mnt or /mntgrub) do:
~$ sudo mount /dev/sdxx /mntgrub
/dev/sdxx is the directory to use to repair grub which contains /boot/grub/...
In my case it's /dev/sda5
/dev/sda designating the disk to repair in my case.
~$ sudo grub-install --root-directory=/mntgrub /dev/sda
It works for me, hope it will work for you.
WARNING: If you accidentally corrupt the /boot/... directory, you will not be able to rebuild Grub.
So it's safe before you start, backing up the /boot directory