Why does Grub2 present twice/double menuentry for each ostree entry

Hi all !

I have three Silverblue deployments

$ rpm-ostree status
State: idle
Deployments:
● ostree://fedora:fedora/34/x86_64/silverblue
                   Version: 34.20210423.n.0 (2021-04-23T08:10:25Z)
                
  ostree://fedora:fedora/34/x86_64/silverblue
                   Version: 34.20210423.n.0 (2021-04-23T08:10:25Z)
                
  ostree://fedora:fedora/34/x86_64/silverblue
                   Version: 34.20210423.n.0 (2021-04-23T08:10:25Z)
          

They match the three ostree entries

$ sudo tree /boot/loader
/boot/loader
├── entries
│   ├── ostree-1-fedora.conf
│   ├── ostree-2-fedora.conf
│   └── ostree-3-fedora.conf

Thus using blscfg , as I understand it, I should have the corresponding GRUB2 menuentries:

menuentry 'Fedora 34.20210423.n.0 (Silverblue) (ostree:0)' 
menuentry 'Fedora 34.20210423.n.0 (Silverblue) (ostree:1)' 
menuentry 'Fedora 34.20210423.n.0 (Silverblue) (ostree:2)'

So why does GRUB2 present me with 6 menuentries ? they seem doubled …
What are they for ?

Thanks

1 Like

See this:

And:
https://fedoraproject.org/wiki/Changes/BootLoaderSpecByDefault#Config_files_provided_by_kernel.2C_grub2-switch-to-blscfg.2C_and_zipl-switch-to-blscfg

2 Likes

I have the same issue, it should be solved by the bootupd migration. Changes/FedoraSilverblueBootupd - Fedora Project Wiki

Relevant issue: Use bootupd and remove ostree-grub2 (was: All deployments are shown twice in grub) · Issue #120 · fedora-silverblue/issue-tracker · GitHub

Running sudo grub2-switch-to-blscfg migrated the grub config and removed the duplicate entries for me on Silverblue 37 (installed as 36). I’d imagine new installs from 38 up won’t have this issue anymore.

2 Likes

Running sudo grub2-switch-to-blscfg did not work for me on Kinoite 37. I get an error
/usr/bin/grub2-editenv: error: invalid environment block.

Are you on EFI? If not, perhaps this could help grub2: Don't add menu entries if GRUB supports parsing BLS snippets by martinezjavier · Pull Request #2044 · ostreedev/ostree · GitHub

1 Like

Any updates on this ? on F39 sb im facing the same problem. If i do this command will mess my grub with windows on it ?

2 Likes

I am having the same issue on Fedora Silverblue 40 & grub 2.06. It is especially annoying when using grub boot menu. What code generates duplicate entries? And can it be patched?

If no one is up to the task, can anyone share any starting points? I guess first place to look will be grub2 source code? Or rpm-ostree source code?

You can start by reading:

to get the context. Help always welcomed with testing, here for testing bootupd in Fedora 41.

I recently checked grub.cfg on a kinoite system, and it contains old pre-bls entries for the kernels and in addition it also reads the bls files for the same kernels. Seems likely to be a bug in rpm-ostree related to kernel updates.

It’s not a bug in rpm-ostree, it’s intentional. Please see the links from Why does Grub2 present twice/double menuentry for each ostree entry - #8 by siosm.

Where does it say that?

Both of the quoted links are about whether or not use bootupd to transfer the shim and grub2 .efi file to the ESP file system. That is not related to whether to use bls configuration or old style grub.cfg configuration without bls. Or in this case use both at the same time.

Old systems shipped with a GRUB that did not support BLS configs. Until we’ve made sure that everyone got they bootloader updated (thus the dependency on bootupd), we need to keep generating the older entries alongside the new BLS ones as we don’t know if they will be displayed by the GRUB installed on the system.

This is explained in Common F31 bugs - Fedora Project Wiki, first link from Use bootupd and remove ostree-grub2 (was: All deployments are shown twice in grub) · Issue #120 · fedora-silverblue/issue-tracker · GitHub

If people haven’t upgraded the grub2 and shim modules in the ESPyet, then they wouldn’t be able to boot because of the new Fedora key in the new shim version.

There are still BIOS systems and systems with Secure Boot disabled out there.

1 Like