EFI variable storage full

I rebooted my tablet because of a wireless bug that occationally crops up, and the UEFI couldn’t find any operating systems. I’m in the process of relocating, so I don’t have any other computers here. Not to mention no USB keyboard.

Luckly, I remembered that I had a Debian install image on a thumb drive, and luckly it was in my backpack. So, boot it up and get into graphical rescue mode (no keyboard!), and of course I can’t tell it to reinstall grub, because I need to type the device path. So it’s off to expert install with a network console, and that works, happily I can type ‘o’ with the screen rotation button, otherwise I couldn’t set a password.

ssh in from my phone, set up a chroot, and grub-install complains with an odd message,

efibootmgr: Could net set variable Boot0000: No such file or directory
efibootmgr: Could net prepare boot variable: No such file or directory

strace efibootmgr -c clarifies matters somewhat, the write to /sys/firmware/efi/vars/new_var returns a filesystem full error. There’s a whole bunch of entries along the lines of dump-type0-n-unixtime-GUID. Apparently kernel dumps from the aformentioned wireless bug had built up, so there wasn’t any space to for the grub-install from the [GRUB upgrade]() to make a boot entry. So it stopped booting.

Of course, the efivars interface is embarrassingly painful (you need to write a special struct to del_var to remove a variable), and the Debian version of efivar can’t delete variables. Happily I still had a copy of the kernel on the hard drive, and could load the much more sanely designed efivarfs interface and mount it. A simple rm /sys/firmware/efi/efivars/dump-type0-* and it’s all better.

At least it prompted me to hurry up and start moving my work into VR.