I had a good running installation of Debian Jessie, but then I ran apt-get update && apt-get upgrade && apt-get dist-upgrade.And then after rebooting, it came directly to the BIOS. I realized that Grub was missing, so I ran a live cd and entered Rescue mode, mounted my root partition, + the boot partition and ran these commands:Grub finds the linux image:root@debian:~# update-grubGenerating grub configuration file ...Found background image: /usr/share/images/desktop-base/desktop-grub.pngFound linux image: /boot/vmlinuz-4.9.0-3-amd64Found initrd image: /boot/initrd.img-4.9.0-3-amd64Found linux image: /boot/vmlinuz-4.9.0-0.bpo.3-amd64Found initrd image: /boot/initrd.img-4.9.0-0.bpo.3-amd64Found linux image: /boot/vmlinuz-3.16.0-4-amd64Found initrd image: /boot/initrd.img-3.16.0-4-amd64Found Ubuntu 16.10 (16.10) on /dev/sdb2Adding boot menu entry for EFI firmware configurationdoneAnd then grub-install :root@debian:~# grub-install /dev/sdaInstalling for x86_64-efi platform.Could not prepare Boot variable: No such file or directorygrub-install: error: efibootmgr failed to register the boot entry: Input/output error.Lsblk:root@debian:~# lsblkNAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTsda      8:0    0 223.6G  0 disk sda1   8:1    0  92.6G  0 part /sda2   8:2    0 130.4G  0 part sda3   8:3    0   573M  0 part /boot/efiDid I do something wrong? Is there too little space on my /boot/efi partition?root@debian:~# ls -l /boot/efi/EFI/debian/total 120-rwx------ 1 root root 121856 Jul 20 20:29 grubx64.efiefibootmgr doesn't show a Debian installation:root@debian:~# efibootmgr --verbose | grep debianEdit :I keep getting this error everytime I try and create a boot loader with EFI using the efibootmgr :grub-install: info: executing efibootmgr -c -d /dev/sda -p 3 -w -L grub -l \EFI\grub\grubx64.efi.Could not prepare Boot variable: No such file or directorygrub-install: error: efibootmgr failed to register the boot entry: Input/output error.
Grub installation failed
debian;boot;grub2;uefi
Fixed the efibootmgr errors by mounting the Boot variables for efibootmgr :# mount -t efivarfs efivarfs /sys/firmware/efi/efivarsAnd then efibootmgr gave me errors about space :Could not prepare Boot variable: No space left on deviceFixed that by deleting dump files :# rm /sys/firmware/efi/efivars/dump-*And then ran the usual update-grub # grub-install -v --target=x86_64-efi --recheck /dev/sda and it ran successfully!