Grub always shows menu, even after many successful boots

How do I go back to a flickerfree boot, where the GRUB menu is hidden unless the last boot failed? I have tried reinstalling GRUB, regenerating its configuration, and grub2-editenv - set boot_success=1; the latter works for the very next boot but doesn’t persist for future boots.

The list of GRUB env variables from grub2-editenv is inconsistent with the text in the grubenv file itself, so maybe that’s part of the problem:

$ sudo grub2-editenv - list
boot_success=1
env_block=512+1
blsdir=/root/boot/loader/entries
boot_success=0
boot_indeterminate=0
$ sudo cat /boot/grub2/grubenv
# GRUB Environment Block
# WARNING: Do not edit this file by tools other than grub-editenv!!!
boot_success=1
env_block=512+1
blsdir=/root/boot/loader/entries
##################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################

Hi and welcome to :fedora: please try the solution posted here to remove the env_block

Thanks

Thank you, that fixed it!
(I had read that discussion and misunderstood it, thinking it only applied when /boot was ext4, but mine is BTRFS.)

That is interesting. On btrfs the grub env block is stored in the partiton at sector 256 as indicated by env_block=512+1. That is why the grubenv file differs from what grub2-editenv shows.

if /boot lives in /dev/nvme0n1p2, run this to display it

sudo dd skip=256 count=1 if=/dev/nvme0n1p2

That seems to be just zero bytes. But I think the offset is wrong, and if I fix that it’s an entirely different set of variables!

And although removing the env_block variable did get me the hidden menu, it doesn’t seem to actually fix everything: the menu doesn’t show up after a boot failure, and if I use the Alt key in Gnome to change “Reboot” to “Boot Options”, it shows the menu for a minute the first time and goes back to the 5-second menu for all subsequent boots, even if they were successful and shut down cleanly after more than 2 minutes.

I don’t have a separate /boot partition; it’s just a regular directory in the root (BTRFS) filesystem. I was trying to save disk space because my disk is small. I have an EFI system partition sda1, the btrfs with everything at sda2, and a swap partition sda3.

So

$ sudo dd skip=256 count=1 if=/dev/sda2 status=none | hexdump -C
00000000  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000200

But I think the offset should be 512:

$ sudo dd skip=512 count=1 if=/dev/sda2 status=none | hexdump -C
00000000  23 20 47 52 55 42 20 45  6e 76 69 72 6f 6e 6d 65  |# GRUB Environme|
00000010  6e 74 20 42 6c 6f 63 6b  0a 62 6f 6f 74 5f 73 75  |nt Block.boot_su|
00000020  63 63 65 73 73 3d 30 0a  62 6f 6f 74 5f 69 6e 64  |ccess=0.boot_ind|
00000030  65 74 65 72 6d 69 6e 61  74 65 3d 30 0a 23 23 23  |eterminate=0.###|
00000040  23 23 23 23 23 23 23 23  23 23 23 23 23 23 23 23  |################|
*
00000200

And that is not the same as either

$ sudo grub2-editenv - list
boot_success=1
blsdir=/root/boot/loader/entries
menu_auto_hide=1
env_block=512+1
boot_success=0
boot_indeterminate=0

or

$ sudo cat /boot/grub2/grubenv
# GRUB Environment Block
# WARNING: Do not edit this file by tools other than grub-editenv!!!
boot_success=1
blsdir=/root/boot/loader/entries
menu_auto_hide=1
env_block=512+1
#################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################################