feature: Add Bootloader=uki_prebuilt for distro-shipped UKIs - #4247
feature: Add Bootloader=uki_prebuilt for distro-shipped UKIs#4247src-up wants to merge 2 commits into
Conversation
|
Tested on Fedora 43 with kernel-uki-virt and ShimBootloader=none — boots successfully via UEFI → EFI/BOOT/BOOTX64.EFI (UKI). Shim integration (ShimBootloader=signed) is not yet working and will be addressed in a follow-up. |
|
This is a bit confusing. Looking at |
i think , currently with Bootloader=uki-signed , stub check fails... build_image -> install_kernel -> want_uki = True -> stub check fires → DIES: systemd-stub is used to build UKIs from scratch. so i think the uki-signed assumes systemd-stub would be present, which is not needed for prebuilt UKIs. Even if we add systemd-stub to list of packages, we get I believe this is because, install_uki is only called if gen_kernel_images returns something and assumption there is that both a raw vmlinuz AND a signed .efi alongside it in /usr/lib/modules// will exist. Since they dont exist for distros like fedora, gen_kernel_images returns empty and code never reaches install_uki..
uki-prebuilt does not make this assumption.. |
behrmann
left a comment
There was a problem hiding this comment.
If Fedora ships a prebuilt UKI, then this should be covered by the tests as well and an image with a prebuilt UKI should be built.
89292fe to
2efe904
Compare
|
@behrmann Thanks for the review. Tried two approaches for test coverage:
Open to suggestions on how to handle this. Rest of the comments were addressed. |
ff85ba3 to
3a308d3
Compare
|
@behrmann One other thing needed: the CI test framework injects params like systemd.unit= and systemd.firstboot=no via kernel_command_line at build time — but for a prebuilt UKI those can't be baked in. Fixed by passing them at runtime via SMBIOS type-11 (io.systemd.stub.kernel-cmdline-extra), which systemd-stub reads from the prebuilt UKI. Please take a look when you get a chance. |
|
@daandemeyer any thoughts on this ? |
|
@behrmann please review |
On vacation currently, will review sometime in the next few days. |
db2b453 to
76105a1
Compare
@behrmann no worries. I have rebased from latest main For the new uki-prebuilt path, the sequence is:
CI log matches this flow, with the raw line: Installing prebuilt distro UKI .../usr/lib/modules/.../vmlinuz-virt.efi to .../efi/EFI/BOOT/grubx64.EFI. Relevant CI job: integration-test (fedora, fedora, ubuntu-24.04) |
|
@behrmann can we get these merged ? |
|
@src-up Oh, geez, I thought I had already. I was talking to Vitaly (?) about this two weeks ago. I'm terribly sorry. I've just went through the logic again and notice I had misunderstood @MoltenArmor's initial comment about the codepath for prebuilt UKIs. Having gone through the code again, your analysis why that code isn't used is correct ( I think this should work if I would be grateful if you could have a look whether the above idea makes this work. Sorry for bungling up the communication on this so much. |
Yes, Vitaly mentioned he met and spoke to you @behrmann
No worries :=) . Thanks for reviewing this again. Much appreciated. I tried putting the changes together like you suggested and came up with this commit src-up@2d3c99b. Let me know if this is more in line with what you were thinking. I tested the below commands on a fedora box and they pass |
|
@src-up Looks good, but I have to think this through more fully, I'll come back to you about this tomorrow. |
|
@src-up Sorry, late again. I left you a few commits on the commit. Thank you! |
deb0860 to
a4c4281
Compare
|
@behrmann hey, so I have moved that commit src-up@2d3c99b as part of this PR. Let me know what u think of the changes now ...
|
7b77aa6 to
342fcf4
Compare
keszybz
left a comment
There was a problem hiding this comment.
Looks reasonable, but the commit has not commit message. Please add a proper commit message.
|
@keszybz thanks for the review. I added the commit message and updated the comment. Let me know if this can be merged now. |
c491669 to
b611da8
Compare
|
@behrmann Thanks for mentioning about CI and your patience on this PR. I should have checked that myself first. Post the ruff fix, the fedora CI tests were also failing due to cache manifest not matching the saved one. With Packages=kernel-uki-virt, the package appears in the cache manifest. Since the CI cache was built without it, the manifests differ and --incremental=strict aborts the build. I changed it to VolatilePackages= so that kernel-uki-virt is installed on top of the cache without affecting the manifest. The fedora/fedora CI test passes now, but one of them (opensuse) ais still failing due to openSUSE GPG key verification error - perhaps unrelated changes. |
No worries. Your work on this has been very diligent, thank you.
That is unrelated. The key is not yet updated in a release version of distribution-gpg-keys
The workaround seems like a hack. Maybe for this particular piece of the matrix |
Some distributions (like Fedora) ship their own prebuilt Unified Kernel Images (UKIs). In some use cases, it's helpful to use mkosi to build images that consume these distro-shipped UKIs rather than building a UKI from scratch. This commit allows mkosi to natively consume prebuilt UKIs, eliminating the need for any additional scripts. Fixes systemd#4174
|
Hey @behrmann With "incremental=no", it is showing 7 failed tests and i think "default-initrd.cache does not exist" in logs means the cache is getting removed. Here is link to the raw log output of one of the 7 failing CI checks, specifically these lines I can try "incremental=yes" also but wanted to show you these first. |
|
@behrmann I tried with both incremental=yes and incremental=no. Where things stand
Honestly, not sure how to proceed here. |
|
Thanks for trying this out. I have a couple of deadlines I need to handle, so I won't be looking at this seriously before the week after next (the first of August that is). |
|
@behrmann Hey , Let me know if this week is a good time to figure out what path to take forward. Thanks ! |
|
I just opened #4410 to look into this. |
|
@src-up after playing around with this for a bit, I think the most concise solution is to set a different cache key for this particular test. You can find this as the last commit on #4410. The changes before that are unnecessary, I only factored out that particular instance from the test initially, because I was looking at the ordering of the tests. |
Some distributions (like Fedora) ship their own prebuilt Unified Kernel Images (UKIs). In some use cases, it's helpful to use mkosi to build images that consume these distro-shipped UKIs rather than building a UKI from scratch.
One such use case is testing cvmutils, where the goal is to replace ad-hoc shell scripts that handle image building with mkosi. However, doing so currently requires extra scripts to bridge the gap.
This PR fills that gap by allowing mkosi to natively consume prebuilt UKIs, eliminating the need for any additional scripts.
Fixes #4174