If your installation of Grub fails with this sort of error
root@debian:~# grub-install /dev/sda Installing for x86_64-efi platform. Could not prepare Boot variable: No such file or directory grub-install: error: efibootmgr failed to register the boot entry: Input/output error.
The following notes might help to fix it. The problem can sometimes be caused by the contents of the EFI partition on your computer’s boot drive, or the contents of the NVRAM on your motherboard. Both Linux and Windows contain utilities that can correct the issue. The Linux ones seem more fully featured.