Avoid getting confused by inaccessible loop device backing paths
authorColin Watson <cjwatson@ubuntu.com>
Mon, 13 Jan 2014 12:13:08 +0000 (12:13 +0000)
committerFelix Zielcke <fzielcke@z-51.de>
Wed, 11 Jun 2025 15:42:34 +0000 (17:42 +0200)
Bug-Ubuntu: https://bugs.launchpad.net/bugs/938724
Forwarded: no
Last-Update: 2021-09-24

Patch-Name: mkconfig-nonexistent-loopback.patch

Gbp-Pq: Name mkconfig-nonexistent-loopback.patch

util/grub-mkconfig_lib.in
util/grub.d/30_os-prober.in

index cc3c4f0dbc135e57f14a2bf7efa55294fe4244ce..121df9ad5b66d2a209d6fe56cc4d8b6a6ec31a09 100644 (file)
@@ -143,7 +143,7 @@ prepare_grub_to_access_device ()
         *)
           loop_device="$1"
           shift
-          set -- `"${grub_probe}" --target=device "${loop_file}"` "$@"
+          set -- `"${grub_probe}" --target=device "${loop_file}"` "$@" || return 0
         ;;
       esac
     ;;
index b74606b0b310b951562c8dae1d2616f370e764e2..c54b5261f81616cd2f836d95b3e58cc9373a6c8c 100644 (file)
@@ -226,6 +226,11 @@ EOF
          LINITRD="${LINITRD#/boot}"
        fi
 
+       if [ -z "${prepare_boot_cache}" ]; then
+         prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
+         [ "${prepare_boot_cache}" ] || continue
+       fi
+
        onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
        recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
        counter=1
@@ -237,10 +242,6 @@ EOF
        fi
        used_osprober_linux_ids="$used_osprober_linux_ids 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id'"
 
-       if [ -z "${prepare_boot_cache}" ]; then
-         prepare_boot_cache="$(prepare_grub_to_access_device ${LBOOT} | grub_add_tab)"
-       fi
-
        # The GRUB_DISABLE_SUBMENU option used to be different than others since it was
        # mentioned in the documentation that has to be set to 'y' instead of 'true' to
        # enable it. This caused a lot of confusion to users that set the option to 'y',