As the title says when I tried to generate grub on a machine running Fedora 31 using UEFI, I was presented with this error:

# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg 
Generating grub configuration file ...
grub2-editenv: error: environment block too small.
...

I didn’t know what had caused it. However, it seemed like an easy fix was to remove the grubenv file.

# rm /boot/efi/EFI/fedora/grubenv
# grub-editenv /boot/efi/EFI/fedora/grubenv create
# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg 
Generating grub configuration file ...
Adding boot menu entry for EFI firmware configuration
done

By the way, as a word of caution, if you have a similar problem, please don’t just copy and paste the command above and run it. It may make your sitution worse.

References: