Skip to content

Conversation

DaanDeMeyer
Copy link
Contributor

In ubuntu devel they started using the stubble bootloader for their kernel images which includes a .linux and a .osrel section which means it identifies as a UKI so we skip it. Let's additionally look for .sdmagic as a workaround to fix this for now.

To implement this we can't make use of bootctl kernel-identify anymore so we reimplement the logic ourselves with pefile. While we're at it, we move KernelType to bootloader.py as it makes more sense to live there than in qemu.py.

@keszybz
Copy link
Member

keszybz commented Oct 16, 2025

Hmm, but wouldn't a better solution be to make bootctl kernel-identify detect those stubbled images properly? Fixing it just here is a workaround that we'll need in other places too.

@DaanDeMeyer
Copy link
Contributor Author

DaanDeMeyer commented Oct 16, 2025

Hmm, but wouldn't a better solution be to make bootctl kernel-identify detect those stubbled images properly? Fixing it just here is a workaround that we'll need in other places too.

I don't know what the proper way to identify those images is, for all intents and purposes they look exactly like a UKI. And since they use ukify it'd be on us to add extra hacks to make sure they can build images that do not identify as UKIs. We can't add any stubble specific code to systemd to detect them either, so I have no clue how to fix this in a non-hacky way.

@DaanDeMeyer DaanDeMeyer force-pushed the kernel-type branch 2 times, most recently from 7340b06 to 1861d23 Compare October 16, 2025 07:54
In ubuntu devel they started using the stubble bootloader for their
kernel images which includes a .linux and a .osrel section which means
it identifies as a UKI so we skip it. Let's additionally look for
.sdmagic as a workaround to fix this for now.

To implement this we can't make use of bootctl kernel-identify anymore
so we reimplement the logic ourselves with pefile. While we're at it,
we move KernelType to bootloader.py as it makes more sense to live there
than in qemu.py.
@behrmann
Copy link
Contributor

Would it maybe make sense to add an --assert-section option to bootctl kerne-identify? Then we could call bootctl kernel-identify --assert-section .sdmagic

@DaanDeMeyer
Copy link
Contributor Author

Would it maybe make sense to add an --assert-section option to bootctl kerne-identify? Then we could call bootctl kernel-identify --assert-section .sdmagic

Looking for .sdmagic is the hack we don't want to do in the first place. There should be no requirement for UKIs to have a sdmagic section.

@behrmann
Copy link
Contributor

True, I was thinking if maybe stubble wanted to do add a different section, they could then reuse the tooling to do detection as bootctl kernel-identify --assert-section .stubble or some such.

Copy link
Contributor

@behrmann behrmann left a comment

Choose a reason for hiding this comment

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

I think it makes sense to merge this as is t get Ubuntu CI working again in a reasonable manner, but we do need to clarify the spec to answer the question: What is a UKI?

@keszybz keszybz merged commit d1b84f5 into systemd:main Oct 16, 2025
76 of 78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants