Bug 2325707 - Wrong GRUB Generation after installation with Anaconda Web UI
Summary: Wrong GRUB Generation after installation with Anaconda Web UI
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: os-prober
Version: 42
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Hedayat Vatankhah
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-11-12 19:36 UTC by Adrien D
Modified: 2025-02-26 13:16 UTC (History)
11 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Adrien D 2024-11-12 19:36:25 UTC
After installing Fedora Rawhide during test days, dual boot with Ubuntu 24.04, unable to boot Ubuntu. All is OK for Fedora.

Grub message : bad shim signature, you need to load the kernel first

After rebooting Fedora and generating GRUB config, same issue.

(I think it's a grub issue instead of anaconda-webui)

Reproducible: Always

Steps to Reproduce:
1. Install Ubuntu 24.04 with default partitionnement (ext4)
2. Install Fedora With Anaconda web-ui https://fedoraproject.org/wiki/QA:Testcase_webui_partitioning_guided_shrink
3. Boot the Ubuntu entry
Actual Results:  
bad shim signature, you need to load the kernel first


Expected Results:  
Ubuntu boot successfully

Comment 1 Adrien D 2024-11-12 19:38:58 UTC
Just add a precision, only if Secure boot enabled

Comment 2 Marta Lewandowska 2024-11-13 09:08:42 UTC
Hi Adrien,
Do you have an efi entry for Ubuntu? i.e., what is the output of 
# efibootmgr

If you are booting Ubuntu from Fedora and using Fedora's grub, it does not trust Ubuntu kernels, which is the message that you're seeing. But you should have the Ubuntu boot loaders still installed in /boot/efi/EFI/ubuntu and there should be a grub.cfg there as well. Creating an efi entry for it, if it doesn't exist, will allow you to boot Ubuntu also with Secure Boot enabled. I can tell you how to do that, but it should already be there...

Comment 3 Katerina Koukiou 2024-11-14 10:23:34 UTC
I am answering here, I can reproduce that easily:

So when booted into Fedora:

[tester@ibm-p8-kvm-03-guest-02 ~]$ efibootmgr 
BootCurrent: 0001
Timeout: 0 seconds
BootOrder: 0001,0002,0000,0003,0004,0005,0006
Boot0000* UiApp	FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
Boot0001* Fedora	HD(15,GPT,96a2176c-568d-44c3-bf1c-cef88210e921,0x2000,0x3e000)/\EFI\fedora\shimx64.efi
Boot0002* UEFI Misc Device	PciRoot(0x0)/Pci(0x2,0x4)/Pci(0x0,0x0){auto_created_boot_option}
Boot0003* UEFI PXEv4 (MAC:525400123456)	PciRoot(0x0)/Pci(0x16,0x0)/MAC(525400123456,1)/IPv4(0.0.0.0,0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0){auto_created_boot_option}
Boot0004* UEFI PXEv6 (MAC:525400123456)	PciRoot(0x0)/Pci(0x16,0x0)/MAC(525400123456,1)/IPv6([::],0,Static,[::],[::],64){auto_created_boot_option}
Boot0005* UEFI HTTPv4 (MAC:525400123456)	PciRoot(0x0)/Pci(0x16,0x0)/MAC(525400123456,1)/IPv4(0.0.0.0,0,DHCP,0.0.0.0,0.0.0.0,0.0.0.0)/Uri(){auto_created_boot_option}
Boot0006* UEFI HTTPv6 (MAC:525400123456)	PciRoot(0x0)/Pci(0x16,0x0)/MAC(525400123456,1)/IPv6([::],0,Static,[::],[::],64)/Uri(){auto_created_boot_option}

efibootmgr does not show the other OS entry (here I am testing against debian)

And yes, there is efi entry for debian in my case:

[tester@ibm-p8-kvm-03-guest-02 ~]$ sudo ls  /boot/efi/EFI/debian/
BOOTX64.CSV  fbx64.efi	grub.cfg  grubx64.efi  mmx64.efi  shimx64.efi
[tester@ibm-p8-kvm-03-guest-02 ~]$ sudo cat /boot/efi/EFI/debian/grub.cfg
search.fs_uuid 4c49db7c-dc87-4c8b-b8b2-41e03234a0aa root 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

Let me know how I can assist you with further debugging.

Comment 4 Marta Lewandowska 2024-11-14 13:17:13 UTC
Secure boot is doing what it's supposed to: shim is loading the grub in its directory, and since it's fedora's grub, it doesn't trust ubuntu kernels. Since ubuntu was already installed on your machine (is this a VM or actual hardware? if a VM, which application do you use?) then there *should* be an efi entry for it, and if you set it to boot next:
# efibootmgr -n 000#
then ubuntu should boot with secure boot enabled.

What Katerina is observing (on a VM) is that the existing ubuntu entry disappears after the fedora installation, and it needs to be recreated... and I wonder whose fault that is exactly... I don't think it's anaconda's. Their efi entry creation looks ok to me. So it could be VMM or ... well, more info would help.

Comment 5 Katerina Koukiou 2024-11-14 15:09:03 UTC
Writing some more observations:

Trying to select the OSes from the main menu fails consistently with: bad shim signature, you need to load the kernel first
Trying to select the OSes from the UEFI firmware settings -> Boot Manager -> selecting the OS in Boot manager Menu -> selecting the OS from the main menu always works

So I assume there is something wrong with Fedora's main grub configuration: /boot/grub2/grub.cfg

Attaching the files for the bootloader team to check:

/boot/grub2/grub.cfg
/boot/efi/EFI/fedora/grub.cfg
/boot/efi/EFI/ubuntu/grub.cfg

Comment 6 Katerina Koukiou 2024-11-14 15:10:12 UTC
Created attachment 2057776 [details]
/boot/grub2/grub.cfg

Comment 7 Katerina Koukiou 2024-11-14 15:10:46 UTC
Created attachment 2057777 [details]
/boot/efi/EFI/fedora/grub.cfg

Comment 8 Katerina Koukiou 2024-11-14 15:11:16 UTC
Created attachment 2057778 [details]
/boot/efi/EFI/ubuntu/grub.cfg

Comment 9 Katerina Koukiou 2024-11-14 15:26:21 UTC
Created attachment 2057779 [details]
blkid output

Comment 10 Marta Lewandowska 2024-11-19 13:42:28 UTC
efibootmgr displays the boot options that are available in UEFI. These are UEFI boot variables that you can also set with efibootmgr. Please notice that the fedora entry looks like:

Boot0001* Fedora	HD(15,GPT,96a2176c-568d-44c3-bf1c-cef88210e921,0x2000,0x3e000)/\EFI\fedora\shimx64.efi

so that when you choose to boot from that option (either by typing `efibootmgr -n 0001`-- which is BootNext-- or by setting it in the BootOrder: 0001,0002,0000,0003,0004,0005,0006) it uses that path (/dev/vda15 = EFI system partition aka /boot/efi) \EFI\fedora\shimx64.efi as its first stage boot loader. That is the fedora shim, which simply looks for the grub that is in the same directory-- fedora grub-- and loads that. Fedora grub only trusts fedora kernels.

Now if you already have or you create an entry for ubuntu, it will look something like:

Boot0002* Ubuntu	HD(15,GPT,96a2176c-568d-44c3-bf1c-cef88210e921,0x2000,0x3e000)/File(\EFI\ubuntu\shimx64.efi)

which is the ubuntu shim (\boot\efi\EFI\ubuntu\shimx64.efi), and which will load the grub in its directory-- ubuntu grub-- that only trusts ubuntu kernels.

The menu with the black background is the grub menu, generated by /boot/grub2/grub.cfg and which includes both fedora and ubuntu kernels. Since you've already booted to grub at that point, which kernels will boot with Secure Boot enabled depends on the grub path you took to get there. If you booted using fedora shim -> fedora grub, then you'll only be able to boot securely to fedora.

Comment 11 Adam Williamson 2024-11-25 16:23:34 UTC
what this probably needs is for whatever generates the boot menu at Fedora level to be SB-aware and not include entries for non-bootable OSes, if SB is enabled. I believe that's os-prober.

Comment 12 Aoife Moloney 2025-02-26 13:16:13 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.


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