GRUB is a popular Bootloader.
However, how could we recover GRUB is covered by other Bootloader ?
sudo fdisk -l
to view all partitions in your harddisk(s).
You should know where does Ubuntu partition installed. For example /dev/sda5
sudo mkdir /mnt/sda5
to create a directory for mounting the partition
sudo mount /dev/sda5 /mnt/sda5
sudo grub-install --root-directory=/mnt/sda5 /dev/sda
Pay attention in this part.
You should know where does your GRUB install to.
If Master Boot Record is in first harddisk, you should type /dev/sda
If Master Boot Record is in second harddisk, you should type /dev/sdb
If Master Boot Record is in third harddisk, you should type /dev/sdc