"single" -> "recovery" when friendly-recovery is installed
authorColin Watson <cjwatson@ubuntu.com>
Mon, 13 Jan 2014 12:13:06 +0000 (12:13 +0000)
committerJulian Andres Klode <jak@debian.org>
Sun, 2 Nov 2025 11:08:11 +0000 (12:08 +0100)
If configured with --enable-ubuntu-recovery, also set nomodeset for
recovery mode, and disable 'set gfxpayload=keep' even if the system
normally supports it.  See
https://launchpad.net/ubuntu/+spec/desktop-o-xorg-tools-and-processes.

Author: Stéphane Graber <stgraber@ubuntu.com>
Forwarded: no
Last-Update: 2025-07-21

Gbp-Pq: Name mkconfig-ubuntu-recovery.patch

configure.ac
util/grub.d/10_linux.in
util/grub.d/30_os-prober.in

index 503378f8fd3c53928fc9e2f92e8e17090999d513..b88067703e8cf089c98aafa2e7ab273c34cf6678 100644 (file)
@@ -2117,6 +2117,17 @@ enable_grub_protect=no
 fi
 AC_SUBST([enable_grub_protect])
 
+AC_ARG_ENABLE([ubuntu-recovery],
+              [AS_HELP_STRING([--enable-ubuntu-recovery],
+                              [adjust boot options for the Ubuntu recovery mode (default=no)])],
+              [], [enable_ubuntu_recovery=no])
+if test x"$enable_ubuntu_recovery" = xyes ; then
+  UBUNTU_RECOVERY=1
+else
+  UBUNTU_RECOVERY=0
+fi
+AC_SUBST([UBUNTU_RECOVERY])
+
 LIBS=""
 
 AC_SUBST([FONT_SOURCE])
index e661e9d13f8101e8d8badba5182c0b8efe4de5d1..ec362d76d1c30d3dcf924d2ae44bc793e2eceec5 100644 (file)
@@ -20,6 +20,7 @@ set -e
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"
 datarootdir="@datarootdir@"
+ubuntu_recovery="@UBUNTU_RECOVERY@"
 
 . "$pkgdatadir/grub-mkconfig_lib"
 
@@ -43,7 +44,11 @@ case ${GRUB_DEVICE} in
   ;;
 esac
 
-: ${GRUB_CMDLINE_LINUX_RECOVERY:=single}
+if [ -x /lib/recovery-mode/recovery-menu ]; then
+    : ${GRUB_CMDLINE_LINUX_RECOVERY:=recovery}
+else
+    : ${GRUB_CMDLINE_LINUX_RECOVERY:=single}
+fi
 
 # Default to disabling partition uuid support to maintian compatibility with
 # older kernels.
@@ -81,6 +86,10 @@ esac
 
 title_correction_code=
 
+if [ "$ubuntu_recovery" = 1 ]; then
+    GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY nomodeset"
+fi
+
 linux_entry ()
 {
   os="$1"
@@ -120,7 +129,9 @@ linux_entry ()
       if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
          echo "        load_video" | sed "s/^/$submenu_indentation/"
       fi
-      echo "   set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/"
+      if [ "$ubuntu_recovery" = 0 ] || [ x$type != xrecovery ]; then
+         echo "        set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/"
+      fi
   fi
 
   echo "       insmod gzio" | sed "s/^/$submenu_indentation/"
index 5d8d7529249fa70dc6353f1d335b7cbb20ef824d..84addef00eb8737c5f3bbad113e60dd9cd67d04d 100644 (file)
@@ -240,7 +240,7 @@ EOF
        fi
 
        onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
-       recovery_params="$(echo "${LPARAMS}" | grep single)" || true
+       recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
        counter=1
        while echo "$used_osprober_linux_ids" | grep 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id' > /dev/null; do
            counter=$((counter+1));