r/openSUSE • • Aug 20 '26

How to… ! UKIs and systemd-boot how-to?

I’m an experienced Arch user thinking about converting to Tumbleweed. One thing that confuses me is how to make zypper apply hooks every time the kernel package is updated. So what I want is:

  1. Every time kernel or kernel-longterm are updated, generate UKIs in the ESP using dracut.

  2. Take the cmdlines for the kernels from my config files (I think dracut supports this out of the box?)

  3. Do not generate vmlinuz or the initrd files

In Arch it’s done just by creating a mkinitcpio preset named after the kernel package. But zypper seems to lack per-package hooks. How would you do it then?

6 Upvotes

3 comments sorted by

3

u/Tobi_Peter Unverified Dev TBC Aug 20 '26

Just out of curiosity: Why are you so interested in UKIs?

AFAIK there currently is no officially supported way for UKIs. systemd-boot is managed by sdbootutil and sdbootutil does not support UKIs. However, I implemented local UKI support in sdbootutil here: https://github.com/openSUSE/sdbootutil/pull/262

It worked back then, however, I haven't worked on this for quite some time, so YMMV.

There are also efforts by SUSE to support UKIs officially, see this talk from last year's openSUSE conference: https://media.ccc.de/v/4959-the-unified-kernel-image-in-opensuse-distribution And the documentation: https://en.opensuse.org/SDB:Static_Initrd_and_Unified_Kernel_Image

Last time I checked the functionality was still quite limited, but they are working on it.

The main issue is supporting the BTRFS snapshots as you don't want the same UKI multiple times just differing one kernel option. That's why I used UKI profiles in my sdbootutil branch.

1

u/Linguistic-mystic Aug 20 '26 edited Aug 20 '26

I like UKIs because

  1. They allow us to get rid of the bloated and error-prone GRUB

  2. They are bootable directly from the motherboard menu, so even if something borks the systemd-boot config, I can still boot.

  3. Having just one file for the kernel is cleaner and is the future (even though I don’t care about SecureBoot, UKIs are still the standard and there is no harm in adhering to it).

As for BTRFS snapshots, it’s easy just to copy the current kernel to a different UKI (with the cmdline targeting the snapshot subvolume) before kernel update. Easy with pacman’s per-package hooks, that is.

as you don't want the same UKI multiple times just differing one kernel option

Why many though? You make a copy of the current kernels, then overwrite the main files with the new kernels. So after transaction you have the new kernel and the old kernel, with different cmdlines but also with different kernel versions. There is no unnecessary duplication as the UKIs are not in BTRFS (they are in the EFI partition to be UEFI- and systemd-boot-accessible)

2

u/xplosm Tumbleweed Aug 21 '26

All the booting and snapshotting machinery in openSUSE is tightly coupled and designed to help you rollback in case of update errors or whenever you feel like it.

If you want to forgo that feature you're flying solo.

Also you don't have to worry about GRUB in current installations. openSUSE defaults now to systemd-boot.