F40 Change Proposal: Unified Kernel Support Phase 2 (System-Wide)

Unified Kernel Support Phase 2

This is a proposed Change for Fedora Linux.
This document represents a proposed Change. As part of the Changes process, proposals are publicly announced in order to receive community feedback. This proposal will only be implemented if approved by the Fedora Engineering Steering Committee.

Wiki
Announced

:link: Summary

Improve support for unified kernels in Fedora.

:link: Owner

:link: Phase 2 goals

  • Add support for booting UKIs directly.
    • Boot path is shim.efi → UKI, without any boot loader (grub, sd-boot) involved.
    • The UEFI boot configuration will get an entry for each kernel installed.
    • Newly installed kernels are configured to be booted once (via BootNext).
    • Successful boot of the system will make the kernel update permanent (update BootOrder).
  • Enable UKIs for aarch64.
    • Should be just flipping the switch, dependencies such as kernel zboot support are merged.
  • Add a UEFI-only cloud image variant which uses UKIs.
    • Also suitable for being used in confidential VMs.
    • Cover both x86_64 and aarch64.

:link: Related bugs

:link: Feedback

:link: Benefit to Fedora

  • Better secure boot support: the UKI initrd is covered by the signature.
  • Better support for tpm measurements and confidential computing.
    • measurements are more useful if we know what hashes to expect for the initrd.
    • measurements are more useful without grub.efi in the boot path (which measures each grub.cfg line processed).
  • More robust boot process
    • generating the initrd on the installed system is fragile

:link: Scope

  • Proposal owners:

    • updates for virt-firmware and uki-direct packages.
    • enable UKIs on aarch64 (MR 2818).
    • prepare kickstart (Fedora kickstarts) changes for generating UKI enabled images.
  • Other developers:

    • installer/anaconda: implement discoverable partition support.
    • bootloader/shim: fix bugs.
    • Fedora Cloud SIG: Add UKI enabled images as an option to Download Fedora Cloud
    • See also: Related Bugs section.
  • Release engineering: #Releng issue number

  • Policies and guidelines: N/A (not needed for this Change)

  • Trademark approval: N/A (not needed for this Change)

  • Alignment with Objectives:

:link: Upgrade/compatibility impact

None, it’s opt-in. Also the uefi cloud image is an additional image and will not replace the current bios/uefi hybrid image.

:link: How To Test

:link: Switch an existing install to use UKIs.

Needs up-to-date Fedora 39 or Rawhide install in a virtual machine. Bare metal hardware with standard storage (ahci / nvme) should work too.

Needs an big enough ESP to store UKI images there (minimum 200M, recommended 500M).

  1. dnf install virt-firmware uki-direct
  • The uki-direct package contains the kernel-install plugin and systemd unit needed to automatically manage kernel updates.
  • You should have version 23.10 or newer.
  1. sh /usr/share/doc/python3-virt-firmware/experimental/fixup-partitions-for-uki.sh
  1. dnf install kernel-uki-virt

  2. kernel-bootcfg --show

  • optional step, shows UEFI boot configuration, the new UKI should be added as BootNext

$ kernel-bootcfg --show # C - BootCurrent, N - BootNext, O - BootOrder # -------------------------------------------- # N - 0008 - 6.5.7-300.fc39.x86_64 <= entry for the the new kernel # C O - 0007 - 6.5.6-300.fc39.x86_64 <= currently running kernel # O - 0006 - Fedora <= grub2 entry # O - 0001 - UEFI QEMU QEMU HARDDISK [ … ]

  1. reboot

  2. kernel-bootcfg --show

  • optional again, after successful boot the new kernel should be first in BootOrder.

$ kernel-bootcfg --show # C - BootCurrent, N - BootNext, O - BootOrder # -------------------------------------------- # C O - 0008 - 6.5.7-300.fc39.x86_64 # O - 0007 - 6.5.6-300.fc39.x86_64 # O - 0006 - Fedora # O - 0001 - UEFI QEMU QEMU HARDDISK [ … ]

:link: Test UKI cloud images

Repo with kickstart files and scripts: Gerd Hoffmann / fedora-uki · GitLab

Images for download: Index of /fedora-uki

  • fedora-uki-cloud: uki-based cloud image, use cloud-init to configure this.
  • fedora-uki-direct: minimal uki-based image, root password is ‘root’.
  • fedora-classic: minimal non-uki image, root password is ‘root’.

Known problems:

  • images can fail to boot on the first attempt
    • should that happen reset the guest once, the second and all following boots will work fine.
    • root cause is a shim bug (github 554).
    • known workaround: add a vTPM to the guest configuration.

:link: Booting another kernel

From the booted system:

  • uefi-boot-menu --reboot

From the firmware:

If your UEFI firmware offers an boot menu you should be able to use that to select the kernel to boot. Unfortunately this is not standardized so there is no standard procedure to do so.

  • Virtual machines (OVMF): Enter the firmware setup by pressing ESC when you see the tianocore splash screen. Select “Boot Manager” in the toplevel menu.
  • Thinkpad laptops: Interupt normal boot (just ‘Enter’ on recent hardware, or using the special key on older models), then press F12 (“choose a temporary startup device”).

:link: User Experience

:link: Dependencies

:link: Contingency Plan

  • Contingency mechanism:
    • drop kickstart file for the uefi-only cloud image.
  • Contingency deadline: N/A (not a System Wide Change)
  • Blocks release? No

:link: Documentation

N/A (not a System Wide Change)

2 Likes

This all seems reasonable, but could you possibly add (to the change or just release notes later) what the use cases/reasons to use this is?

I guess its all just incremental progress to a goal, but if we are making these images and testing them and hoping our users help test them and provide feedback, it might be nice to explain when someone might want to use them?

Might be there’s something I missed here reading back after the holidays. :wink: