Monday 16 June 2014

Simple solution for common problem for Linux users ... when you install windows after installing Linux and need to recover grub..

Simple solution for most common problem for Linux users ... when you install windows after installing Linux and need to recover grub..

Need a live DVD. Use the Ubuntu distro from ver 10.04 and above, Kali live, Debian Wheezy live, or any live debian-based distro. Use according to the architecture you installed, either 32bit or 64bit.

Then boot with it and once in the system, open up a terminal and do this:

1.# fdisk -l (search for the partition where you installed kali: /dev/sda1, /dev/sda2, etc)
2.# mount /dev/sda1 /mnt (Mount the kali partition)
3.# mount --bind /dev /mnt/dev (You will need to mount the /dev directory into mnt)
4.# chroot /mnt (change the root to the mounted partition to be able to run the command from the mounted partition)
5.# grub-install --recheck /dev/sda (install grub in the HDD sda, not sda1, sda2, etc.., just sda.

Now, please issue these 2 commands, if they fail, do not worry, you will have to do it after reboot.. This will make win7 show up in the grub menu.
# os-prober (looks for partitions in the HDD and register them in the os-prober file.
# update-grub (Takes some templates, including the os-prober file and writes them in the menu)

That is all, once done, reboot..You should see the grub menu. If you do not see the win7 in the menu, don't worry, just enter kali, open up a terminal and run the 2 commands I posted above:
#os-prober (looks for partitions in the HDD and register them in the os-prober file.
#update-grub (Takes some templates, including the os-prober file and writes them in the menu)

Reboot again, you should see the kali and win7 in the menu.

No comments:

Post a Comment