Skip to content

Facilitate usage of UKIs during installation

Idea proposal 💡

Checks

NOTE: The below check boxes must be checked before the accompanying idea will be considered.

  • I have checked that the idea is not directly tied to a specific project For example: "Show label icons in the package overview web page" must be a feature request in the ArchWeb repository
  • I have carefully checked this idea is not already covered by any open or closed ideas.
  • I understand that I hold no copyright claims and that this idea can be adapted and used by Arch Linux in any arbitrary shape or form.

Summary

I would like to integrate support to optionally use Unified Kernel Images (UKIs) directly during Arch installation. Currently, it's much easier to install Arch first and thereafter configure UKIs, which can be cumbersome.

Motivation

Unified Kernel Images (UKIs) streamline the traditional microcode/initrd/kernel image combination by consolidating these components into a single file. UKIs offer several advantages, as detailed in the wiki article and the UKI specifications.

Other distributions, such as Fedora, are also beginning to support UKIs. UKIs can be generated using various tools, including mkinitcpio, dracut, and systemd's 'ukify', which is packaged separately as systemd-ukify.

Currently, the Arch Installation Guide typically installs /boot/initramfs-linux.img, /boot/initramfs-linux-fallback.img, and /boot/vmlinuz-linux unconditionally. This behavior is dictated by /usr/share/libalpm/scripts/mkinitcpio, which is triggered by /usr/share/libalpm/hooks/90-mkinitcpio-install.hook (see 1) when mkinitcpio is installed as a dependency of the installed kernel.

Specification

There are multiple ways to facilitate UKI installation, the following steps outline a proposed method using kernel-install, systemd-ukify, and mkinitcpio for initrd creation.

  1. mkinitcpio hooks: Instead of unconditionally installing mkinitcpio's pacman hooks to /usr/share/libalpm/hooks/, install them to a dedicated directory, such as /usr/share/mkinitcpio/.

  2. kernel-install hook: Introduce a kernel-install pacman hook similar to this one into the Arch systemd package, and install it to /usr/share/systemd/kernel-install/ or similar.

  3. Update Installation Guide: Revise the initramfs step of the Installation Guide to always generate the initramfs unconditionally and prepare automation for subsequent kernel updates. This would involve:

    • Copying the desired hooks (mkinitcpio or kernel-install) to /etc/pacman/hooks.
    • Configuring /etc/kernel/install.conf and optionally /etc/kernel/uki.conf for UKIs. This could be as simple as echo "layout=uki" > /etc/kernel/install.conf. Alternatively, copy the samples from /usr/lib/kernel/install.conf and (soon) /usr/lib/kernel/uki.conf, and start from there.
    • Generating the initramfs using either mkinitcpio -P or kernel-install add-all.

As an added benefit, this would ensure that users are consistently aware of the initramfs generation process, instead of making it optional in some cases. It would also facilitate the use of the kernel-install framework for all users, regardless of their choice to use UKIs. As a side note, when using kernel-install, the only remaining action required for a bootable setup in most cases is to execute bootctl install.

Caveats and alternatives

  1. I am unsure how to implement the first step without impacting current installations.
  2. If the mkinitcpio hooks are not present when linux is first installed by pacstrap, then the presets in /etc/mkinitcpio.d/ will not have been created. Thus, mkinitcpio -P alone will not be enough to generate an initramfs. There are ways around this, the simplest being to simply reinstall the kernel once the hooks have been copied, but I don't think it is an acceptable solution. Ideally, it should still be mkinitcpio -P for people not making use of kernel-install. We could also split the mkinitcpio hooks in two, default ones unconditionally installed which generate the presets, and optional ones which only regenerate the initramfs. However this installs useless presets on systems using kernel-install, which might be confusing.

Alternatives and ideas:

  • A feature toggle during installation, i.e. during pacstrap step
  • Move everything to kernel-install. I think this would be great, but certainly a more complicated change. However, this proposal can be a stepping stone towards that, by opening kernel-install to a wider audience first.
  • Use mkinitcpio's built-in uki creation.

Happy to hear any good ideas and comments from everyone.

Edited by cedric cvl
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information