How do I reinstall grub2? [duplicate]

Having tried all day to reinstall grub and trawling the internet I have had no luck. I can no longer boot into ubuntu and have tried boot disk frin yannubuntu but the grub tabs are greyed out. Other methods will not install it on sda1. I have no other os to boot into but have a live usb. Please help


Try this to recover grub:

  1. Open the live version of Ubuntu (either brun the LiveCD or install the image to a bootable USB device using Startup Disk Creator)
  2. Open terminal and run sudo fdisk -l to see where Linux is installed on
  3. Run sudo mount /dev/sdxY /mnt where x is altter and Y a number you have found in the previous step
  4. Run sudo grub-install --root-directory=/mnt /dev/sdx to install grub
  5. Run sudo update-grub to update grub
  6. Reboot

GUI way

In addtion to the other answers, a way with graphical user interface would be to boot from LiveCD or a bootable USB device (putting the live .iso on there with Startup Disk Creator Install usb-creator-gtk). Once in the Live session you can install Boot-Repair:

sudo add-apt-repository ppa:yannubuntu/boot-repair \
    && sudo apt-get update \
    && udo apt-get install -y boot-repair \
    && boot-repair

Then start Boot-Repair from Dash and click "Recommended Repair" or take a look at the other options.

Use at your own risk. The usual warnings with non-official repositories apply.