From 5dcfbdc8c54229058739e744825f8a7133e2c739 Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Sat, 26 Sep 2026 20:20:00 -0700 Subject: [PATCH] fix(chainload): don't register an empty initrd An initrd file, or chain of initrd files, with no contents was still registered with the initrd media loader, which reports NOT_FOUND for empty data. The Linux EFI stub treats anything other than BUFFER_TOO_SMALL as a load error and fails to boot, rather than booting without an initrd. Skip registering an empty initrd, as the edera action already does. --- crates/boot/src/actions/chainload.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/boot/src/actions/chainload.rs b/crates/boot/src/actions/chainload.rs index 631e3af..2d056a7 100644 --- a/crates/boot/src/actions/chainload.rs +++ b/crates/boot/src/actions/chainload.rs @@ -116,8 +116,10 @@ pub fn chainload(context: Rc, configuration: &ChainloadConfigurat } // If an initrd was read, register it with the EFI stack. + // An empty initrd is not registered, as Linux fails to boot if the initrd it is + // given can't be loaded, instead of booting without one. let mut initrd_handle = None; - if let Some(content) = initrd { + if let Some(content) = initrd.filter(|content| !content.is_empty()) { let handle = MediaLoaderHandle::register(LINUX_EFI_INITRD_MEDIA_GUID, content.into_boxed_slice()) .context("unable to register linux initrd")?;