grub-install fails to reinstall grub with:
Installing for x86_64-efi platform.
grub-install: warning: Internal error.
grub-install: error: failed to register the EFI boot entry: Operation not permitted.
I noticed while performing an upgrade which tries to upgrade the package grub-efi-amd64-signed. This gives a more informative error message:
Installing grub to /boot/efi.
Installing for x86_64-efi platform.
grub-install: warning: Internal error.
grub-install: error: failed to register the EFI boot entry: Operation not permitted.
mount: /var/lib/grub/esp: mount point does not exist.
The system is trying to find the EFI partition on /var/lib/grub/esp
This is strange since my fstab looks correct,
/dev/sda7 has the boot flag and /dev/sda2 has the esp flag. I don't know why grub-install goes to /var/lib to try to find the efi partition. The error still persists even if I explicitly pass the directories to grub-install.
grub-install --efi-directory=/boot/efi/ --boot-directory=/boot/
Yes, I tried running boot repair. Got the following out: https://paste.ubuntu.com/p/THG9p4YQgQ/