photon icon indicating copy to clipboard operation
photon copied to clipboard

Kernel Update fails Secure Boot

Open harryhmtse opened this issue 6 years ago • 28 comments

Performed tdnf update on a Photon VM, which updated linux-esx to 4.19.87-5.ph3 Upon restarting the VM, the bootloader reports invalid signature on the primary and the fallback entries, performs a restart, and hangs at the boot splash screen. Escaping the boot splash screen will show that it's dropped into the GRUB shell.

It can be worked around by disabling Secure Boot setting on the Virtual Machine.

harryhmtse avatar Jan 26 '20 01:01 harryhmtse

Same problem here!

ecerichter avatar Jan 26 '20 01:01 ecerichter

Issue persists in 4.19.97-1.ph3

harryhmtse avatar Feb 01 '20 00:02 harryhmtse

I downgraded to the 4.19.87-1 kernel to get back up and running with UEFI Secure Boot enabled, testing each version along the way. So far the following versions all fail to boot:

4.19.87-4 4.19.87-5 4.19.97-1

gizmotronic avatar Feb 13 '20 05:02 gizmotronic

Seems support requests are not getting attention, I'll just fallback to more supported OS distro like CentOS.

ecerichter avatar Feb 19 '20 22:02 ecerichter

Reason: Secure boot certificate in the virtual firmware has expired.

Solution: Now we sign kernel images with new key, and its certificate has to be added to firmware manually, as for now, here is a link: https://github.com/vmware/photon/wiki/Frequently-Asked-Questions#q-after-updating-Kernel-rpm-VM-fails-to-boot-with-secure-boot

YustasSwamp avatar Feb 20 '20 17:02 YustasSwamp

@YustasSwamp thanks for the update. This sounds like it's going to need to be resolved through an update of the hosting ESXi-based product. (vSphere, Fusion, Workstation), is this already in the pipeline or should we be submitting support tickets for those products?

harryhmtse avatar Feb 20 '20 18:02 harryhmtse

You are right. There are 2 possible solutions to resolve it.

  1. update of the hosting ESXi-based product, as you've mentioned - will be available soon.
  2. update Photon's shim to include new certificate - in process, there is some delay on shim-review side: https://github.com/rhboot/shim-review/issues/75

YustasSwamp avatar Feb 20 '20 18:02 YustasSwamp

Thanks @YustasSwamp for the clarification and the workaround, I think you've put us all at ease explaining the problem, and letting us know there's a fix in the pipeline, and knowing that this ticket isn't just going to go stale.

harryhmtse avatar Feb 20 '20 21:02 harryhmtse

Running into the same issue. Disabling secure boot seems not working (will be enabled automatically again :(

Megachip avatar Mar 25 '20 17:03 Megachip

@Megachip try this:

  • power off VM
  • disable secure boot
  • remove .nvram file in VM folder
  • power on VM

YustasSwamp avatar Mar 26 '20 06:03 YustasSwamp

This fixed it for me: https://github.com/vmware/photon/wiki/Frequently-Asked-Questions#q-after-updating-kernel-rpm-vm-fails-to-boot-with-secure-boot

ElanHasson avatar Mar 27 '20 02:03 ElanHasson

That's a useful workaround, @ElanHasson, thanks! Unfortunately it doesn't scale well, so I'm still hoping for an ESXi update to land soon.

gizmotronic avatar Apr 02 '20 17:04 gizmotronic

Fresh install of OVA, update... dead. That shouldn't happen :(

r24-IT avatar Jun 16 '20 11:06 r24-IT

Agree. Fix here is to release new shim (with updated certificate) signed by UEFI CA. And it is blocked at shim-review stage for several months already ((

So, current workaround is to inject current certificate to the firmware as describer here: https://github.com/vmware/photon/wiki/Frequently-Asked-Questions#q-after-updating-Kernel-rpm-VM-fails-to-boot-with-secure-boot

YustasSwamp avatar Jun 16 '20 19:06 YustasSwamp

The workaround in the FAQ did not resolve this for me. I had to disable secure boot by deleting these lines from the VMX file:

uefi.secureBoot.enabled = "TRUE"
uefi.secureBoot.dbDefault.file0 = "vmware_sb2017.der"

mmlakin avatar Aug 12 '20 01:08 mmlakin

@mmlakin did you remove nvram file? What was the error, when it didn't boot?

YustasSwamp avatar Aug 12 '20 03:08 YustasSwamp

Yes, I deleted the .nvram file every time I tried a change. It gives the same error as before:

error: /boot/vmlinuz-4.19.132-4.ph3-esx has invalid signature.

I downloaded the certificate file again, deleted and re-uploaded the modified .vmx file a few times, tried all this again after a successful boot with secure boot disabled, and every time it gives the same error. The only way I can get it to boot is with a .vmx file that doesn't contain the eufi.secureBoot parameters. I only set this up about a month ago using the hw13 OVA.

mmlakin avatar Aug 12 '20 18:08 mmlakin

Thanks for update. We switched to different certificate because of BootHole issue. Will provide solution/update shortly.

YustasSwamp avatar Aug 12 '20 18:08 YustasSwamp

@mmlakin bootloader binaries (with fixed BootHole vulnerability) have to be updated on your system Please follow updated instructions: https://github.com/vmware/photon/wiki/Frequently-Asked-Questions#q-after-updating-kernel-rpm-vm-fails-to-boot-with-secure-boot No needs to add vmware_sb2017.der certificate, but it does not harm.

YustasSwamp avatar Aug 12 '20 19:08 YustasSwamp

Thanks for your quick responses!

Following those directions did not resolve my problem, and left me with an unbootable system. I restored from backup so I'm all good now.

First, wget was not found so I used curl -O instead, and the directory on my system was BOOT and not Boot as listed in the instructions. The shasum did change after replacing them with the newly downloaded binaries, but did not match the output in the instructions.

root@photon-machine [ ~ ]# cp bootx64.efi /boot/efi/EFI/BOOT
root@photon-machine [ ~ ]# cp grubx64.efi /boot/efi/EFI/BOOT
root@photon-machine [ ~ ]# sha256sum /boot/efi/EFI/Boot/*.efi
5559cec34ff09e7dc75e757cbf64f6a0655f24c4cbd825890abc66ea9c4c6fe3  /boot/efi/EFI/Boot/bootx64.efi
ff8c14de51ec089265ed14d8a97227226b1f866304241d34b824670dc7cfb609  /boot/efi/EFI/Boot/grubx64.efi

Also, I was able to download the dbxupdate, but when running the command I got the following error:

root@photon-machine [ ~ ]# dbxtool -a ./dbxupdate_x64.bin
dbxtool only supports timestamped updates

Since I had a recent backup, I rebooted just to test it and my system could no longer boot, even with secure boot disabled. No error message about signature this time, just a splash screen showing boot entries it tried, and then it showed a BIOS screen. I restored and tried the entire process again, for good measure, deleting the old .efi files and re-downloading them in place and got the same result. I've restored again and I'm just leaving secure boot off for now.

mmlakin avatar Aug 13 '20 01:08 mmlakin