Fixing grub boot-loader after installing Windows


If you had linux installed and later thought of installing Windows, it will overwrite your grub boot loader by default.

The fix is quick and easy. So, I would like to document the easy steps for reference.

Previously, I wrote for similar fixing but in Bangla উবুন্তু ৯.১০ : কারমিকে আপগ্রেড করায় সৃষ্ট সমস্যা এবং প্রতিকার

For this solution you gotta have a live CD or USB bootable through which you can Run Ubuntu/Lubuntu (or Mint etc debian distros).

1. Boot up your machine with the LiveCD/USB, you can run the installer just to see the device on HDD containing your linux installation.

It would be something like /dev/sda1 and in ext4.

2. If you haven’t run the installer, you can see the partition table using gparted. Press Alt-F2 and type gparted and hit Enter. 

If it tells you that gparted needs root permission then, instead of just ‘gparted’ type in ‘gksu gparted’ and hit enter. If you wanna know about gksu. Now if you have identified your linux’s / folder partition go to next step.

3. On your terminal (hit Ctrl+Alt+T to pop open) type: sudo mount /dev/sdXY /mnt  here, replace X with a,b,h etc as you found above. Y is the number. For mine it was: sudo mount /dev/sda1 /mnt

4. You haven’t done anything destructive or permanent in the above steps. At this step you will try to revive the old grub. If your ‘/’ (root) folder’s location was /dev/sda1, now you will use it as /dev/sda to refer to the device as a whole. NOT WITH NUMBER

So, at the terminal you will type: sudo grub-install –root-directory=/mnt/ /dev/sdX

It it showed success. You are done. Reboot machine and you will see your old grub2 boot loader. But, Windows might not appear there. Dont panic! Go to next step to fix. 🙂

5. Boot up in your good old Ubuntu. And fire up your terminal again. Type: sudo update-grub 

It will fetch your windows to the boot loader as well. Cheers!

Leave a comment