#1139183 grub-installer: Use blkid instead of partmap to determine partitioning scheme

#1139183#5
Date:
2026-06-06 20:22:30 UTC
From:
To:
Dear maintainers,

for ZFS partitions and also for physical partitions of a software MD
RAID, the partmap program returns 'loop' whereas, for ext4 and swap
partitions, it returns 'gpt' (the partitioning scheme of the physical
drive).  The blkid program seems to be more reliable as it always
correctly detects a GPT label in all these cases.

I will send a patch as a separate e-mail for your convenience.

Thank you in advance!

Best regards,

Thomas Uhle

#1139183#10
Date:
2026-06-06 20:30:02 UTC
From:
To:
partmap identifies ZFS partitions and also physical partitions of a MD
RAID as loop devices whereas blkid correctly detects a GPT label.
Closes: #1139183
---
 debian/control | 2 +-
 grub-installer | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/debian/control b/debian/control
index 9042e55e..68310e22 100644
--- a/debian/control
+++ b/debian/control
@@ -11,7 +11,7 @@
 Architecture: amd64 arm64 armhf i386 ia64 hurd-i386 hurd-amd64 kfreebsd-i386 kfreebsd-amd64 loong64 mipsel powerpc ppc64 ppc64el riscv64 sparc sparc64
 XB-Subarchitecture: ${subarch}
 Provides: bootable-system
-Depends: ${shlibs:Depends}, ${misc:Depends}, kernel-installer, created-fstab, di-utils, di-utils-mapdevfs, os-prober, partman-utils
+Depends: ${shlibs:Depends}, ${misc:Depends}, kernel-installer, created-fstab, di-utils, di-utils-mapdevfs, os-prober, util-linux-udeb
 XB-Installer-Menu-Item: 7400
 Package-Type: udeb
 Description: Install GRUB on a hard disk
diff --git a/grub-installer b/grub-installer
index 30e7ecfc..d05a5b10 100755
--- a/grub-installer
+++ b/grub-installer
@@ -260,7 +260,7 @@
 disc_offered=$(mapdevfs "$disc_offered_devfs")

 # Identify partition table of the disk containing our boot partition
-bootfslabel=$(partmap $disc_offered || echo unknown)
+bootfslabel=$(blkid -p -o value -s PART_ENTRY_SCHEME $disc_offered || echo unknown)

 info "Identified partition label for $bootfs: $bootfslabel"

@@ -693,7 +693,7 @@
 	    (([ -n "$cdfs" ] && [ "$cdfs" != "iso9660" ]) || \
 	     [ "$hybrid" = true ])) || \
 	   ([ "$default_bootdev" != '(hd0)' ] && \
-	    ! partmap "$default_bootdev" >/dev/null && \
+	    ! blkid -p -o value -s PART_ENTRY_SCHEME "$default_bootdev" >/dev/null && \
 	    ! grub_probe -t fs -d "$default_bootdev" >/dev/null); then
 		db_fget grub-installer/bootdev seen
 		if [ "$RET" != true ]; then