From 04bf4c76aa932da6a9051c5068d8c5a216ee6f66 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 30 Jan 2026 14:54:30 +0100 Subject: [PATCH] composefs: add check for UKI when --composefs-backend is used, make sure there is a UKI in the specified image. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Giuseppe Scrivano --- crates/kit/src/images.rs | 8 ++++++++ crates/kit/src/to_disk.rs | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/crates/kit/src/images.rs b/crates/kit/src/images.rs index ccede79..61f65e1 100644 --- a/crates/kit/src/images.rs +++ b/crates/kit/src/images.rs @@ -216,6 +216,14 @@ pub fn get_image_size(name: &str) -> Result { Ok(info.size) } +/// Check if image has a UKI (required for --composefs-backend) +pub fn has_uki(name: &str) -> Result { + let status = Command::new("podman") + .args(["run", "--rm", name, "sh", "-c", "ls /boot/EFI/Linux/*.efi >/dev/null 2>&1"]) + .status()?; + Ok(status.success()) +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/kit/src/to_disk.rs b/crates/kit/src/to_disk.rs index 33949f7..16099be 100644 --- a/crates/kit/src/to_disk.rs +++ b/crates/kit/src/to_disk.rs @@ -369,6 +369,13 @@ EOF /// Main entry point for the bootc installation process. See module-level documentation /// for details on the installation workflow and architecture. pub fn run(opts: ToDiskOpts) -> Result<()> { + if opts.install.composefs_backend && !images::has_uki(&opts.source_image)? { + return Err(eyre!( + "Image '{}' has no UKI - not suitable for --composefs-backend", + opts.source_image + )); + } + // Phase 0: Check for existing cached disk image let would_reuse = if opts.target_disk.exists() { debug!(