How to repair GRUB2

sudo fdisk -l

sudo mkdir -p /media/ubuntu
sudo mount /dev/sda1 /media/ubuntu

Then you need to mount these system folders to use them on your current desktop environment:

sudo mount –bind /dev /media/ubuntu/dev
sudo mount –bind /proc /media/ubuntu/proc
sudo mount –bind /sys /media/ubuntu/sys

Now chroot into your hard drive with this command:

sudo chroot /media/ubuntu

You have now read/write permissions on your root partition. To install GRUB2, you need to use one of these two commands:

# grub-install /dev/sda

Installation finished. No error reported.

Update GRUB2 with this command:

# update-grub