Assuming:
- /dev/sda1 is your efi partition
- /dev/sda2 is your root partition (containing /boot too)
- Your linux kernel file is /boot/vmlinuz-linux
- Your initrd file is /boot/initrd.img
Burn a live usb of ubuntu 16.04 with amd64 architecture, boot on it and paste these commands:
sudo os-prober
efibootmgr
Install os-prober or efibootmgr if it isn't installed yet:
sudo apt-get install os-prober
sudo apt-get install efibootmgr
Grub in efi mode is probably not installed, install it too
sudo apt-get install grub-efi-amd64-signed
Then, install grub:
sudo mount -t ext4 /dev/sda2 /mnt
sudo mount -t vfat /dev/sda1 /mnt/boot/efi
grub-install --target=x86_64-efi --efi-directory=/mnt/boot/efi --boot-directory=/mnt/boot --bootloader-id=grub
Don't try to use grub-mkconfig, it will not work.
Instead, boot from your newly grub bootloader, you will have a grub shell, paste these commands:
set root=(hd0,2)
linux /boot/vmlinuz-linux root=/dev/sda2
initrd /boot/initrd.img
boot
After that, you should be on linux, mount your efi partition (to /boot/efi !) if it's not already, install grub/os-prober/efibootmgr, and run these:
sudo os-prober
grub-install --target=x86_64-efi --efi-directory=/boot/efi --boot-directory=/boot --bootloader-id=grub
grub-mkconfig -o /boot/grub/grub.cfg
Reboot, and grub is back and working