Bug#754921: [PATCH] grub-mkconfig: Disable recordfail on non-writable LVM or RAID partitions

Anders Kaseorg andersk at MIT.EDU
Wed Jul 16 01:29:44 UTC 2014


Package: grub-common
Version: 2.02~beta2-10
Severity: important
Tags: patch

Currently recordfail is disabled on filesystems that GRUB can’t write to.  
However, a filesystem that GRUB could write to might still be located on 
an _abstraction_ that GRUB can’t write to, including LLVM and/or RAID.  
This leads to an error message and delay during boot:

Error: diskfilter writes are not supported.
Press any key to continue...

See also https://bugs.launchpad.net/bugs/1274320.

recordfail is added in debian/patches/quick_boot.patch.  Below is a patch 
on top of that to check for unsupported abstractions.  (I believe this is 
the form of the patch most convenient for git-dpm, but let me know if 
you’d like it in another form.)

Anders


diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 8dc5592..7ab59e3 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -102,23 +102,42 @@ function savedefault {
 EOF
 
 if [ "$quick_boot" = 1 ]; then
-    cat <<EOF
+  cat <<EOF
 function recordfail {
   set recordfail=1
 EOF
+
+  check_writable () {
+    abstractions="$(grub-probe --target=abstraction "${grubdir}")"
+    for abstraction in $abstractions; do
+      case "$abstraction" in
+	diskfilter | lvm)
+	  cat <<EOF
+  # GRUB lacks write support for $abstraction, so recordfail support is disabled.
+EOF
+	  return
+	  ;;
+      esac
+    done
+
     FS="$(grub-probe --target=fs "${grubdir}")"
     case "$FS" in
       btrfs | cpiofs | newc | odc | romfs | squash4 | tarfs | zfs)
 	cat <<EOF
   # GRUB lacks write support for $FS, so recordfail support is disabled.
 EOF
+	return
 	;;
-      *)
-	cat <<EOF
-  if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi
-EOF
     esac
+
     cat <<EOF
+  if [ -n "\${have_grubenv}" ]; then if [ -z "\${boot_once}" ]; then save_env recordfail; fi; fi
+EOF
+  }
+
+  check_writable
+
+  cat <<EOF
 }
 EOF
 fi



More information about the Pkg-grub-devel mailing list