Hide Forgot
Description of problem: # grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg /usr/bin/grub2-editenv: error: invalid environment block. Generating grub configuration file ... /usr/bin/grub2-editenv: error: invalid environment block. # dnf provides grub2-mkconfig Last metadata expiration check: 0:14:19 ago on Tue 28 May 2019 03:50:49 PM +05. grub2-tools-1:2.02-84.fc31.x86_64 : Support tools for GRUB. Repo : @System Matched from: Filename : /usr/sbin/grub2-mkconfig grub2-tools-1:2.02-84.fc31.x86_64 : Support tools for GRUB. Repo : rawhide Matched from: Filename : /usr/sbin/grub2-mkconfig
# ls -la /boot/efi/EFI/fedora/ total 13116 drwx------. 3 root root 4096 May 28 16:17 . drwx------. 4 root root 4096 Apr 16 08:34 .. -rwx------. 1 root root 112 Oct 2 2018 BOOTIA32.CSV -rwx------. 1 root root 110 Oct 2 2018 BOOTX64.CSV drwx------. 2 root root 4096 May 27 21:13 fonts -rwx------. 1 root root 1104200 May 20 22:14 gcdia32.efi -rwx------. 1 root root 1751368 May 20 22:14 gcdx64.efi -rwx------. 1 root root 5408 Apr 16 19:16 grub.cfg -rwx------. 1 root root 3391 May 28 16:15 grub.cfg.new -rwx------. 1 root root 0 May 9 15:54 grubenv -rwx------. 1 root root 1104200 May 20 22:14 grubia32.efi -rwx------. 1 root root 1751368 May 20 22:14 grubx64.efi -rwx------. 1 root root 927824 Oct 2 2018 mmia32.efi -rwx------. 1 root root 1159560 Oct 2 2018 mmx64.efi -rwx------. 1 root root 1210776 Oct 2 2018 shim.efi -rwx------. 1 root root 975536 Oct 2 2018 shimia32.efi -rwx------. 1 root root 969264 Oct 2 2018 shimia32-fedora.efi -rwx------. 1 root root 1210776 Oct 2 2018 shimx64.efi -rwx------. 1 root root 1204496 Oct 2 2018 shimx64-fedora.efi I see that new file "grub.cfg.new" is created, but this file not replaced old "grub.cfg".
(In reply to Mikhail from comment #1) > # ls -la /boot/efi/EFI/fedora/ > total 13116 > drwx------. 3 root root 4096 May 28 16:17 . > drwx------. 4 root root 4096 Apr 16 08:34 .. > -rwx------. 1 root root 112 Oct 2 2018 BOOTIA32.CSV > -rwx------. 1 root root 110 Oct 2 2018 BOOTX64.CSV > drwx------. 2 root root 4096 May 27 21:13 fonts > -rwx------. 1 root root 1104200 May 20 22:14 gcdia32.efi > -rwx------. 1 root root 1751368 May 20 22:14 gcdx64.efi > -rwx------. 1 root root 5408 Apr 16 19:16 grub.cfg > -rwx------. 1 root root 3391 May 28 16:15 grub.cfg.new > -rwx------. 1 root root 0 May 9 15:54 grubenv You have a 0 bytes grubenv, that's wrong. You can try to create a new one with 'grub2-editenv create' Also, you have a /boot/grub2/grubenv symlink.
(In reply to Javier Martinez Canillas from comment #2) > (In reply to Mikhail from comment #1) > > # ls -la /boot/efi/EFI/fedora/ > > total 13116 > > drwx------. 3 root root 4096 May 28 16:17 . > > drwx------. 4 root root 4096 Apr 16 08:34 .. > > -rwx------. 1 root root 112 Oct 2 2018 BOOTIA32.CSV > > -rwx------. 1 root root 110 Oct 2 2018 BOOTX64.CSV > > drwx------. 2 root root 4096 May 27 21:13 fonts > > -rwx------. 1 root root 1104200 May 20 22:14 gcdia32.efi > > -rwx------. 1 root root 1751368 May 20 22:14 gcdx64.efi > > -rwx------. 1 root root 5408 Apr 16 19:16 grub.cfg > > -rwx------. 1 root root 3391 May 28 16:15 grub.cfg.new > > -rwx------. 1 root root 0 May 9 15:54 grubenv > > You have a 0 bytes grubenv, that's wrong. You can try to create a new one > with 'grub2-editenv create' > > Also, you have a /boot/grub2/grubenv symlink. I meant here "you should have".
For unknown reason file "grubenv" is empty. Symlink was present. So I fixed issue by recreating "grubenv" file. # grub2-editenv /boot/efi/EFI/fedora/grubenv create If instead of message "error: invalid environment block" I would see another message "corrupted grubenv, please recreate it with command `# grub2-editenv grubenv create`" it would be more helpful for not grub2 guru's.
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle. Changing version to '31'.
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle. Changing version to 31.
*** This bug has been marked as a duplicate of bug 1625124 ***