Attached updated debdiff for tenacious (grub2 2.14-2ubuntu4):

- Targets current development series (tenacious).
- Checks both initramfs and initrd_real in 10_linux.in and 20_linux_xen.in.
- Guards the skip check on GRUB_DISABLE_INITRD != true, empty 
GRUB_FORCE_PARTUUID, and an installed initramfs generator 
(/etc/kernel/postinst.d/initramfs-tools or dracut) so initrd-less cloud images 
are unaffected when update-grub runs from inside 
/usr/lib/linux/triggers/<version>.

** Description changed:

  [ Impact ]
- When a kernel postinst hook fails (e.g. DKMS module build failure), the 
kernel package remains half-configured: vmlinuz is installed and 
/usr/lib/linux/triggers/<version> is present, but no matching initrd is 
generated. A subsequent update-grub invocation (such as during removal of an 
older kernel) scans /boot and generates a boot menuentry for the incomplete 
kernel without an initrd line. On systems where storage drivers (NVMe, SATA, 
SAS) are built as modules, booting this entry causes an immediate, undetectable 
kernel panic (VFS: Unable to mount root fs on unknown-block(0,0)).
+ When a kernel postinst hook fails (e.g. DKMS module build failure), the 
kernel package remains half-configured: vmlinuz is installed and 
/usr/lib/linux/triggers/<version> is present, but no matching initrd is 
generated. A subsequent update-grub invocation scans /boot and generates a boot 
menuentry for the incomplete kernel without an initrd line. On systems where 
storage drivers (NVMe, SATA, SAS) are built as modules, booting this entry 
causes an immediate kernel panic (VFS: Unable to mount root fs on 
unknown-block(0,0)).
  
  [ Fix ]
- In /etc/grub.d/10_linux, when inspecting a kernel where no initrd was found 
(test -z "${initrd_real}"), check if a pending kernel trigger marker exists in 
/usr/lib/linux/triggers/${version} or /usr/lib/linux/triggers/${alt_version}. 
If the trigger marker is present, skip generating a boot menuentry for that 
kernel image. This prevents update-grub from publishing unbootable kernels to 
grub.cfg.
+ In util/grub.d/10_linux.in and util/grub.d/20_linux_xen.in, when no initrd or 
builtin initramfs is found, skip generating a boot menuentry if initrd 
generation is enabled (GRUB_DISABLE_INITRD != true, GRUB_FORCE_PARTUUID is 
unset, and /etc/kernel/postinst.d/initramfs-tools or 
/etc/kernel/postinst.d/dracut is executable) and a pending kernel trigger file 
exists in /usr/lib/linux/triggers/ or /usr/lib/linux/triggers/.
  
  [ Test Plan ]
- 1. Simulate an incomplete kernel installation:
+ 1. Simulate an incomplete kernel installation on a system with 
initramfs-tools installed:
     sudo touch /boot/vmlinuz-9.9.0-test-generic
     sudo touch /usr/lib/linux/triggers/9.9.0-test-generic
     sudo rm -f /boot/initrd.img-9.9.0-test-generic
  2. Run sudo update-grub.
  3. Verify behavior:
-    - Without fix: GRUB outputs "Found linux image: 
/boot/vmlinuz-9.9.0-test-generic" and writes a stanza lacking an initrd line.
-    - With fix: GRUB outputs "Skipping linux image with pending 
post-installation trigger and no initrd: /boot/vmlinuz-9.9.0-test-generic", and 
no stanza is generated.
+    - Without fix: GRUB outputs " Found linux image: 
/boot/vmlinuz-9.9.0-test-generic\ and writes a stanza lacking an initrd line.
+  - With fix: GRUB outputs \Skipping linux image with pending 
post-installation trigger and no initrd: /boot/vmlinuz-9.9.0-test-generic\, and 
no stanza is generated.
  4. Clean up test files (sudo rm -f /boot/vmlinuz-9.9.0-test-generic 
/usr/lib/linux/triggers/9.9.0-test-generic) and verify standard installed 
kernels generate valid boot entries.
  
  [ Where problems could occur ]
- The check only triggers when both conditions are met: initrd_real is empty 
AND a trigger marker exists in /usr/lib/linux/triggers/. Custom kernels 
intentionally configured without an initrd do not have markers under 
/usr/lib/linux/triggers/ and continue to work as before. If a kernel postinst 
script fails to clean up its trigger marker after a successful run, that kernel 
would be skipped until the stale marker is removed.
+ The skip check only triggers when no initrd is found, an initramfs generator 
hook is installed, GRUB_DISABLE_INITRD is not true, GRUB_FORCE_PARTUUID is 
empty, and a trigger marker exists in /usr/lib/linux/triggers/. Cloud images 
configured with GRUB_FORCE_PARTUUID or without an initramfs generator, as well 
as custom kernels without markers under /usr/lib/linux/triggers/, continue to 
work as before.
  
  [ Other Info ]
  - Debian BTS bug: https://bugs.debian.org/1151014
- - Development series (stonking): debdiff prepared against 2.14-2ubuntu3 
(version 2.14-2ubuntu4).
- - Stable SRU (noble): debdiff prepared against 2.12-1ubuntu7.3 (version 
2.12-1ubuntu7.4).
- - PPA test builds: ppa:steelf/ppa (grub2 2.14-2ubuntu4~ppa1, grub2 
2.12-1ubuntu7.4~ppa1).
+ - Development series (tenacious): debdiff prepared against 2.14-2ubuntu3 
(version 2.14-2ubuntu4).
  
  --- [ Original Report ]
  ENVIRONMENT:
  - Ubuntu 24.04 Noble (HWE kernel)
  - systemd version: 255 (255.4-1ubuntu8.10)
  - Kernel: 6.17.0-14-generic
  - Storage: NVMe SSD
  - File: /usr/lib/kernel/install.d/55-initrd.install
  - Package owner: systemd (confirmed via dpkg -S)
  
  BUG:
  When initrd generation fails or is skipped during kernel
  installation, 55-initrd.install detects the missing initrd
  but exits 0 (success) instead of exit 1 (failure).
  
  Relevant code in 55-initrd.install (line 26):
  
    if [ -e "$INITRD_SRC" ]; then
        ln -fs "$INITRD_SRC" "$KERNEL_INSTALL_STAGING_AREA"
    else
        echo "$INITRD_SRC does not exist, not installing an initrd"
    fi
    exit 0  <- BUG IS HERE
  
  This silent success causes GRUB to write a boot entry for
  a kernel with no initrd, with zero warning to the user.
  
  HOW THIS CAUSES KERNEL PANIC:
  Ubuntu's kernel config has CONFIG_BLK_DEV_NVME=m meaning
  the NVMe storage driver exists ONLY as a module inside
  initramfs. Without initramfs:
  - NVMe driver never loads
  - Kernel cannot see any storage device
  - Results in: VFS: Unable to mount root fs on unknown-block(0,0)
  - KERNEL PANIC on every boot - silent, no warning given
  
  HOW I TRIGGERED THIS:
  virtualbox-dkms 7.0.16 (dfsg) fails to build for kernel
  6.17 due to missing VBox/cdefs.h header. DKMS exits code 11.
  run-parts stops alphabetically - 'd' (dkms) runs before
  'i' (initramfs-tools) - so initramfs is never generated.
  55-initrd.install then silently exits 0 -> GRUB creates
  unbootable boot entry -> KERNEL PANIC on reboot.
  
  This failed silently 3 days in a row (Feb 11, 12, 13 2026)
  confirmed in /var/log/dpkg.log and /var/log/apt/term.log.
  
  PROPOSED FIX:
  Change line 26 of 55-initrd.install from:
    exit 0
  to:
    exit 1
  
  When initrd is missing, this should be a HARD FAILURE
  not a silent warning. This would cause apt to report
  the error visibly and prevent GRUB from creating an
  unbootable boot entry.
  
  RELATED BUG:
  https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/2136499
  (virtualbox-dkms FTBFS triggers this silent failure)

** Patch added: "grub2 2.14-2ubuntu4 tenacious debdiff"
   
https://bugs.launchpad.net/bugs/2141741/+attachment/6014897/+files/grub2_2.14-2ubuntu4_tenacious.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2141741

Title:
  55-initrd.install silently exits 0 when initrd missing causing
  undetectable kernel panic on NVMe systems

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2141741/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to