[SOLVED] Cannot install PVE as UEFI OS

I have an Intel NUC DN2820FYKH with an Intel Visual BIOS v2.2.5 and the same error installing Proxmox v8 or v9:
- failed to prepare EFI boot using Grub on '/dev/sda2': unable to install the EFI boot loader on '/dev/sda'
Tried a Kingston & Intel SSD HDD and the same behavior.
I could finally successful install Proxmox disabling the UEFI Boot in the BIOS and only enabling the Legacy Boot.
Afterwards it could not boot, no valid boot device was detected, and enabling both UEFI & Legacy Boots it worked fine.
 
I had the same error installing Proxmox on a Lenovo ThinkCentre M70s Gen 4 with the latest BIOS:


failed to prepare EFI boot using Grub ... unable to install the EFI boot loader


and during installation:


Cannot set EFI variable
efivarfs_set_variable: ... Cannot allocate memory


I found that the problem was a Lenovo BIOS setting.


In BIOS go to Security and set:


Windows UEFI Firmware Update → Disabled


I already had Secure Boot disabled.


After disabling Windows UEFI Firmware Update, I performed a normal Proxmox installation again and it completed successfully. No GRUB workaround, fallback BOOTX64.EFI, EFI-variable deletion, or rescue boot was required.


Hardware: Lenovo ThinkCentre M70s Gen 4


Hopefully this helps anyone with the same issue on recent Lenovo ThinkCentre systems.