Vasudev Kamath: Note to Self: Enabling Unified Kernel Image on Debian
Note
These steps may not work on your system if you are using the default Debian installation. This guide assumes that your system is using systemd-boot as the bootloader, which is explained in the post linked below.
Installation and Configuration
Install the systemd-ukify package:
sudo apt-get install systemd-ukify
Create the following configuration in /etc/kernel/install.conf:
This configuration specifies how to generate the UKI image for the installed kernel and which generator to use.layout=uki initrd_generator=dracut uki_generator=ukify
Define the kernel command line for the UKI image. Create /etc/kernel/uki.conf with the following content:
[UKI] Cmdline=@/etc/kernel/cmdline
Generating the UKI Image
To apply these changes, regenerate the UKI image for the currently running kernel:
sudo dpkg-reconfigure linux-image-$(uname -r)
Verification
Use the bootctl list command to verify the presence of a "Type #2" entry for the current kernel. The output should look similar to this:
bootctl list
type: Boot Loader Specification Type #2 (.efi)
title: Debian GNU/Linux trixie/sid (2d0080583f1a4127ac0b073b1a9d3e61-6.10.9-amd64.efi) (default) (selected)
id: 2d0080583f1a4127ac0b073b1a9d3e61-6.10.9-amd64.efi
source: /boot/efi/EFI/Linux/2d0080583f1a4127ac0b073b1a9d3e61-6.10.9-amd64.efi
sort-key: debian
linux: /boot/efi/EFI/Linux/2d0080583f1a4127ac0b073b1a9d3e61-6.10.9-amd64.efi
options: systemd.gpt_auto=no quiet root=LABEL=root_disk ro systemd.machine_id=2d0080583f1a4127ac0b073b1a9d3e61
type: Boot Loader Specification Type #2 (.efi)
title: Debian GNU/Linux trixie/sid (2d0080583f1a4127ac0b073b1a9d3e61-6.10.7-amd64.efi)
id: 2d0080583f1a4127ac0b073b1a9d3e61-6.10.7-amd64.efi
source: /boot/efi/EFI/Linux/2d0080583f1a4127ac0b073b1a9d3e61-6.10.7-amd64.efi
sort-key: debian
linux: /boot/efi/EFI/Linux/2d0080583f1a4127ac0b073b1a9d3e61-6.10.7-amd64.efi
options: systemd.gpt_auto=no quiet root=LABEL=root_disk ro systemd.machine_id=2d0080583f1a4127ac0b073b1a9d3e61
type: Automatic
title: Reboot Into Firmware Interface
id: auto-reboot-to-firmware-setup
source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f
Cleanup and Reboot
Once the "Type #2" entries are generated, remove any "Type #1" entries using the bootctl unlink command. After this, reboot your system to boot from the UKI-based image.
Future Considerations
The primary use case for a UKI image is secure boot. Signing the UKI image can also be configured in the settings above, but this guide does not cover that process as it requires setting up secure boot on your system.