Description: Skip linux image with pending postinst trigger and missing initrd
Author: Viktor Pashaiev <w.paszajew@gmail.com>
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2141741
Forwarded: not-needed
Last-Update: 2026-10-15

--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -412,6 +412,13 @@
     fi
   done
 
+  if test -z "${initrd_real}"; then
+    if test -e "/usr/lib/linux/triggers/${version}" || test -e "/usr/lib/linux/triggers/${alt_version}"; then
+      gettext_printf "Skipping linux image with pending post-installation trigger and no initrd: %s\n" "$linux" >&2
+      continue
+    fi
+  fi
+
   initrd=
   if test -n "${initrd_early}" || test -n "${initrd_real}"; then
     initrd="${initrd_early} ${initrd_real}"
