Skip to content

Conversation

@jeckersb
Copy link
Collaborator

@jeckersb jeckersb commented Jan 28, 2026

Add a new subcommand that builds a Unified Kernel Image (UKI) by
computing the necessary arguments from a container image and invoking
ukify. This simplifies the sealed image build workflow by having bootc
internally compute:

  • The composefs digest (via existing compute-composefs-digest logic)
  • Kernel arguments from /usr/lib/bootc/kargs.d/*.toml files
  • Paths to kernel, initrd, and os-release

Any additional arguments are passed through to ukify unchanged, allowing
full control over signing, output paths, and other ukify options.

The seal-uki script is updated to use this new command instead of
manually computing these values and invoking ukify directly.

Also adds kargs.d configuration files for the sealed UKI workflow:

  • 10-rootfs-rw.toml: Mount root filesystem read-write
  • 21-console-hvc0.toml: Console configuration for QEMU/virtio

Closes: #1955

Assisted-by: OpenCode (Opus 4.5)
Signed-off-by: John Eckersberg [email protected]

@github-actions github-actions bot added the area/documentation Updates to the documentation label Jan 28, 2026
@bootc-bot bootc-bot bot requested a review from henrywang January 28, 2026 21:42
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new bootc container ukify command, which is a great addition for simplifying the creation of Unified Kernel Images. The new command correctly encapsulates the logic for finding kernel artifacts and constructing kernel arguments, which was previously handled in a shell script. The seal-uki script is now much cleaner and more maintainable by using this new command. The implementation in Rust is solid, and the associated configuration and documentation changes are appropriate. I have a couple of suggestions to improve the API design in the new Rust code.

@@ -0,0 +1,3 @@
# WORKAROUND: SELinux must be permissive for sealed UKI boot
# See https://github.com/bootc-dev/bootc/issues/1826
kargs = ["enforcing=0"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

But this will now be set for the ostree tests too...I don't think we want that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

So how about for now let's keep this in seal-uki ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This will mean that container ukify will need to take arbitrary cmdline args for now. I guess we'll just mark it as hidden, don't mention in the docs, and print a big scary warning that it will eventually be removed when we fix the enforcing thing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Leaving this unresolved until we agree that the current approach of hidden --karg with scary warning is ok for now.

Comment on lines 52 to 55
// Compute paths for kernel and initrd
let modules_dir = format!("usr/lib/modules/{kver}");
let vmlinuz_path = rootfs.join(&modules_dir).join("vmlinuz");
let initramfs_path = rootfs.join(&modules_dir).join("initramfs.img");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm another copy of this code is pretty unfortunate, let's have find_kernel return it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I updated Kernel to keep track of modules_dir and then vmlinuz and initramfs are derived from that. One TODO here is that means modules_dir ends up being serialized with container inspect --json (but not in human-readable). So from here we either (a) hide serialization of modules_dir, or (b) add modules_dir to human-readable output.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking we have a different internal only struct with more data that has impl Into the type we serialize for now

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok find_kernel now returns a KernelInternal wrapper that also tracks the paths for vmlinuz and initramfs. The ergonomics aren't great in a few places but it works. Let me know what you think.

--os-release "@${target}/usr/lib/os-release" \
# Build the UKI using bootc container ukify
# This computes the composefs digest, reads kargs from kargs.d, and invokes ukify
bootc container ukify --rootfs "${target}" \
Copy link
Collaborator

Choose a reason for hiding this comment

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

This definitely looks nicer!

@cgwalters cgwalters enabled auto-merge (rebase) January 29, 2026 14:45
Add a new subcommand that builds a Unified Kernel Image (UKI) by
computing the necessary arguments from a container image and invoking
ukify. This simplifies the sealed image build workflow by having bootc
internally compute:

- The composefs digest (via existing compute-composefs-digest logic)
- Kernel arguments from /usr/lib/bootc/kargs.d/*.toml files
- Paths to kernel, initrd, and os-release

Any additional arguments are passed through to ukify unchanged, allowing
full control over signing, output paths, and other ukify options.

The seal-uki script is updated to use this new command instead of
manually computing these values and invoking ukify directly.

Also adds kargs.d configuration files for the sealed UKI workflow:
- 10-rootfs-rw.toml: Mount root filesystem read-write
- 21-console-hvc0.toml: Console configuration for QEMU/virtio

Closes: bootc-dev#1955

Assisted-by: OpenCode (Opus 4.5)
Signed-off-by: John Eckersberg <[email protected]>
@github-actions github-actions bot added the area/install Issues related to `bootc install` label Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Updates to the documentation area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add bootc container ukify

2 participants