Reinstall Bootloader in Existing Linux OS

Written on 01 August 2016

If Your Grub Partition Contains A Full OS Install

sudo mount /dev/sda1 /mnt  
sudo chroot /mnt  
sudo update-grub  

If Your Grub Partition Only Contains Boot Files

In my case the grub partition was a stand-alone boot partition with no system installed, so I had to bring in most of the system to the chroot environment first:

mkdir /mnt/chrootdir  
mount /dev/sda1 /mnt/chrootdir  
for dir in proc dev sys etc bin sbin var usr lib lib64 tmp; do  
    mkdir /mnt/chrootdir/$dir && mount --bind /$dir /mnt/chrootdir/$dir
chroot /mnt/chrootdir  

Another way

sudo mount /dev/sda1 /mnt

Then reinstall grub2:

sudo grub-install --root-directory=/mnt /dev/sda