Skip to content

Instantly share code, notes, and snippets.

@tsmx
Last active December 31, 2023 10:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsmx/ee344e5a310908fab60f27c3911d2506 to your computer and use it in GitHub Desktop.
Save tsmx/ee344e5a310908fab60f27c3911d2506 to your computer and use it in GitHub Desktop.
Fedora - fix grub2 after kernel update with invalid environment block error

Sometimes an update of the kernel breaks your current grub2. You will see an error like /usr/bin/grub2-editenv: error: invalid environment block during execution of the update procedure.

In that case don't restart your machine because it is most likely that this will fail and then you'll have to fix it using chroot from a Live Media. Instead, immediately after the update showing up the error, fix it by executing the following as root:

dnf reinstall grub2-efi-x64 shim-x64
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
@antoniosanct
Copy link

antoniosanct commented Sep 17, 2022

Thanks for the gist! However, in my case it doesn't work!! (my /boot/efi/EFI/fedora/grubenv was empty) I could fix using this:

grub2-editenv create

Rel: bugzilla

@jimc
Copy link

jimc commented Oct 3, 2023

nice !

@herrernst
Copy link

Thank you! Saved my day (Fedora 38)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment