Bug 1714533 - unable generate new grub.cfg, instead got "error: invalid environment block"
Summary: unable generate new grub.cfg, instead got "error: invalid environment block"
Keywords:
Status: CLOSED DUPLICATE of bug 1625124
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Peter Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-28 11:05 UTC by Mikhail
Modified: 2020-01-28 13:35 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-28 13:35:50 UTC
Type: Bug


Attachments (Terms of Use)

Description Mikhail 2019-05-28 11:05:53 UTC
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

Comment 1 Mikhail 2019-05-28 11:22:06 UTC
# 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".

Comment 2 Javier Martinez Canillas 2019-05-28 11:34:29 UTC
(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.

Comment 3 Javier Martinez Canillas 2019-05-28 11:35:05 UTC
(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".

Comment 4 Mikhail 2019-05-28 11:53:47 UTC
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.

Comment 5 Ben Cotton 2019-08-13 17:06:04 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 6 Ben Cotton 2019-08-13 19:17:26 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to 31.

Comment 7 Javier Martinez Canillas 2020-01-28 13:35:50 UTC

*** This bug has been marked as a duplicate of bug 1625124 ***


Note You need to log in before you can comment on or make changes to this bug.