I prepared debdiffs for stonking and noble to prevent update-grub from
generating unbootable boot entries for incomplete kernels that lack an
initrd when /usr/lib/linux/triggers/<version> is present.
Test builds are available in ppa:steelf/ppa.
Attaching debdiff for stonking.
** 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)).
+
+ [ 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.
+
+ [ Test Plan ]
+ 1. Simulate an incomplete kernel installation:
+ 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.
+ 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.
+
+ [ Other Info ]
+ - 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).
+
+ --- [ 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
+ 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
+ - 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.
+ 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)
** Tags added: patch sru-noble
** Patch added: "grub2 2.14-2ubuntu4 stonking debdiff"
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/2141741/+attachment/6009537/+files/grub2_2.14-2ubuntu4_stonking.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