[PATCH v1 02/14] efi: loader: file: report EFI_UNSUPPORTED for volumes without a filesystem

Johannes Schneider johannes.schneider at leica-geosystems.com
Sat Oct 3 18:19:35 PDT 2026


OpenVolume() on a partition without a filesystem, such as a raw slot a
kernel or UKI is booted from, fails in cdev_mount() and returns
EFI_DEVICE_ERROR. The UEFI specification prescribes EFI_UNSUPPORTED for
that, and callers rely on it: systemd-stub skips EFI_UNSUPPORTED quietly
but logs any other error, and its log_wait() then stalls boot by up to
10 s:

  stub.c:587 at load_addons: Unable to open root directory: Device error
  cpio.c:340 at pack_cpio: Unable to open root directory: Device error  (x6)

Return EFI_UNSUPPORTED when no filesystem driver recognizes the device.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Johannes Schneider <johannes.schneider at leica-geosystems.com>
---
 efi/loader/protocols/file.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/efi/loader/protocols/file.c b/efi/loader/protocols/file.c
index ea7b0df82e..bfcf14f0e0 100644
--- a/efi/loader/protocols/file.c
+++ b/efi/loader/protocols/file.c
@@ -30,6 +30,8 @@
 #include <malloc.h>
 #include <dirent.h>
 #include <fs.h>
+#include <linux/sprintf.h>
+#include <xfuncs.h>
 
 #define MAX_UTF8_PER_UTF16 3
 
@@ -1012,6 +1014,16 @@ efi_open_volume(struct efi_simple_file_system_protocol *this,
 
 	EFI_ENTRY("%p, %p", this, root);
 
+	/* No filesystem on the volume is EFI_UNSUPPORTED, not a device error */
+	if (!cdev_get_mount_path(fs->cdev)) {
+		char *devpath = basprintf("/dev/%s", cdev_name(fs->cdev));
+		bool has_fs = fs_detect(devpath, "");
+
+		free(devpath);
+		if (!has_fs)
+			return EFI_EXIT(EFI_UNSUPPORTED);
+	}
+
 	path = cdev_mount(fs->cdev);
 	if (IS_ERR(path))
 		return EFI_EXIT(EFI_DEVICE_ERROR);
-- 
2.43.0




More information about the barebox mailing list