Skip to content

many: initial systemd-boot support#2392

Open
supakeen wants to merge 5 commits into
osbuild:mainfrom
supakeen:bootctl
Open

many: initial systemd-boot support#2392
supakeen wants to merge 5 commits into
osbuild:mainfrom
supakeen:bootctl

Conversation

@supakeen
Copy link
Copy Markdown
Member

@supakeen supakeen commented Jun 1, 2026

This PR implements the new/changes stages for bootctl.install.root and fix-bls. It then introduces a new bootloader systemd.

When/if systemd-boot is selected as the bootloader in a platform we automatically determine the boot-root in the way the BLS dictates us to do. We don't install systemd-boot inside the os pipeline as it does checks on the paths it is given to determine if they are actual mountpoints and/or filesystems. We pass the ESP/XBOOTLDR explicitly but they could also be auto-detected if we want that.

This works in my testing for YAML definitions that have only an ESP, or both an ESP and XBOOTLDR.

There's probably plenty we can improve here such as moving the find*Mountpoint functions into pkg/disk and generalizing them; however I'd like to do that as part of more sweeping change to pkg/disk where I'll also cover auto-mountpoints, auto-types, based on the recently added policies.

Let's not have a boot test yet until I've used this for a bit and am sure it's stable and doesn't need to change. There are likely functionalities missing that I might like still and haven't thought about yet.

@supakeen supakeen requested review from a team and achilleas-k as code owners June 1, 2026 04:39
@supakeen supakeen requested review from avitova, croissanne and lzap June 1, 2026 04:39
@supakeen supakeen force-pushed the bootctl branch 2 times, most recently from 25385a3 to 679a18b Compare June 1, 2026 05:48
supakeen added a commit to teamsbc/artifacts that referenced this pull request Jun 1, 2026
Switch over the `standard` image type to use `systemd-boot`. This
cannot land yet as upstream `image-builder` hasn't landed support but
a PR for this is open [1].

[1]: osbuild/images#2392

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Copy link
Copy Markdown
Contributor

@brlane-rht brlane-rht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me, one minor comment and one error I assume is because you changed your mind about naming the stage :)

Comment thread pkg/osbuild/bootctl_install.go Outdated
Comment thread pkg/manifest/raw.go Outdated
supakeen added 5 commits June 3, 2026 06:43
This implements the recently added (and expanded) `bootctl.install.root`
stage in `osbuild` so it can be used in `images`.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
A new toggle in the `osbuild` `fix-bls` stage allows us to replace paths
that don't have a prefix. When BLS files are created by `90-loaderentry`
there won't be any other prefix than `/boot` which without setting this
flag wouldn't be replaced.

Replacement of `/boot` is necessary when `/boot` is a mountpoint (either
XBOOTLDR, or on the ESP directly.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Implement a new bootmode that indicates that `systemd-boot` should be
used. Also add some tests that we didn't have before to ensure round
trips between the string representations of the enums.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
This commit introduces the initial support for `systemd-boot` to the
pipeline generators.

`systemd-boot` follows the BLS quite strictly so in `os.go` we set the
boot root depending on if the ESP *and* XBOOTLDR exist or only the ESP.
The user (the one who writes YAML) has to ensure the ESP is large enough
if no XBOOTLDR is provided.

The installation of `systemd-boot` happens in the `image` pipeline
generator as `systemd-boot` is quite strict about vetting mountpoints
and filesystems. In the future it might be able to run in the `os`
pipeline but that will require a new `systemd` release.

Lots of opportunities for cleanups here. For example generalizing the
finding of partitions in `os.go` to `disk/` but also the behavior for
the `/efi` vs `/boot` automatic mountpoint assignment if we want to.

We probably should also be much more strict on the partition tables in
this case, but that can also come later.

Tested locally with setups with either only an ESP (mounted to /boot) or
an ESP and an XBOOTLDR (/efi and /boot respectively) which works.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
GPT type UUIDs are often set directly in the YAML definitions; if so
users are likely to copy/paste them from somewhere else where mixed
casing exists.

Let's make sure we compare case insensitively for UUIDs in this case.

Signed-off-by: Simon de Vlieger <cmdr@supakeen.com>
Copy link
Copy Markdown
Contributor

@brlane-rht brlane-rht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants