Recover Grub of EFI System in Linux
Sep 30, 2016 Sarad Gajurel Reading time: 2 minutes
All the linux users who use distro with GRUB as a bootloader are aware of its value. That hard time when you power on the computer and after a brand logo the next screen just appears to show you message that GRUB was not able to load the entries. In this article, you’ll get to know how to recover the GRUB bootloader on EFI/UEFI system.
NOTE: This article shows the method of recovering the GRUB only for Debian and it’s derrivatives that uses ‘apt-get’ as package manager with EFI/UEFI systems. If your bootsector uses MBR this does not work at all.
Pre-requisite: Live bootable media of your Linux distro and an working internet connection
Boot your Linux distro live
open the terminal
Find out Linux partition and EFI partition with following command:
sudo fdisk -l
You will see the output similar to image below:
Look at the ‘Device’ and ‘Type’ column. In my case,
/dev/sda2 is EFI System /dev/sda7 is Linux filesystem
Note out your EFI System and Linux filesystem Device.
Now you need to execute the following commands replacing with your ‘Device’ accordingly:
sudo mount /dev/sda7 /mnt sudo mount /dev/sda2 /mnt/boot/efi sudo for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done sudo cp /etc/resolv.conf /mnt/etc/ sudo modprobe efivars sudo chroot /mnt sudo apt-get update sudo apt-get install --reinstall grub-efi-amd64 sudo update-grub sudo umount /mnt/boot/efi sudo umount /mnt exit sudo reboot
Now you are done and the grub menu should appear on reboot.
NOTE: If you have dual boot, another OS may not be listed in the entry so after reboot open the terminal and enter following command:
That’s all and you are good to go. Let me know through comments if you face any problem and I’ll be there for you.