How to repair grub bootloader on a dual boot machine with Windows and Linux

Grub 2 typically gets overridden when you install Windows or another Operating System. To make Linux control the boot process, you need Reinstall (Repair/Restore) Grub using a Linux Live CD.

ROOT_DISK='/dev/sda2'
BOOT_DISK='/dev/sda1' # optional, only for EFI
DISK='/dev/sda'

mount $ROOT_DISK /mnt mount $BOOT_DISK /mnt/boot/efi # optional

for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done

chroot /mnt grub-install $DISK update-grub

don’t forget to update UUID in /mnt/etc/fstab using blkid