EFI grub re-installation

Sometimes some another operating system can break grub bootloader, but the bootloader can be instelled via liveDVD/USB the next way:

WordPress shows the commands wrong so read the right commands here

sudo blkid ### tells the partitions
sudo mount /dev/sda7 /mnt ## if your linux is on /dev/sda7
sudo mount /dev/sda2 /mnt/boot ## if the EFI-partition is /dev/sda2
sudo mount --bind /dev /mnt/dev
sudo mount --bind /sys /mnt/sys
sudo mount --bind /proc /mnt/proc
sudo chroot /mnt
nano /etc/resolv.conf

... the contents
nameserver 8.8.8.8
.... save and quit
Ctrl o
Ctrl x
apt-get update
apt-get install grub-efi-amd64 grub-efi
mount /dev/sda2 /boot/efi ### if the efi partition is /dev/sda2
apt-get install --reinstall grub-efi grub-efi-amd64
update-grub

exit
sudo umount /mnt/dev
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/boot
sudo umount /mnt

After installation check that the /boot/efi/EFI/ubuntu folder is around and into that folder is grubx64.efi and grub.cfg files.