How to restore Ubuntu grub

How to restore Ubuntu grub

As we know, windows will destory the GRUB if you install it with Ubuntu installed first.So how to fix GRUB?

I found a great solution on a blog. The steps are as follows:

  1. boot with a Ubuntu LiveCD(U disk), and choose try Ubuntu without install
  2. type $ sudo fdisk -l in terminal to find out where you installed Ubuntu.

I installde in sda1(maybe not same as you)

  1. type $ sudo -i to get the the ability to run commands as root.
  2. type $ mkdir /media/tmpdir to create a temporary folder.
  3. type $ mount /dev/sda1 /media/tmpdir to mount system
  4. type $sudo gurb-install --root-directory=/media/tmpdir/dev/sda . And no error report means you are almost there.

Attention: sda here is not sda1

  1. Reboot without LiveCD and boot Ubuntu first to update grub with $ sudo update-grub2
  2. Enjoy windows and Ubuntu.

Test sucessfully in win7, win8, win10.