dracut-core: Shipping /usr/lib/kernel/install.d/50-dracut.install causes two initrds to be installed on kernel postinst
Alexander Kurtz
alexander at kurtz.be
Tue Jul 22 14:45:33 BST 2025
Control: affects -1 systemd-boot
Hi,
I just upgraded to Trixie and ran into this bug. Unfortunately it seems
to have more unintended consequences. Here's (one of) the problem(s):
1. dracut ships /etc/kernel/postinst.d/dracut which generates an
initramfs into /boot/initrd.img-$VERSION and correctly
handles the hostonly={yes|no} setting from the configuration.
2. dracut also ships /usr/lib/kernel/install.d/50-dracut.install
which generates an initramfs into
$KERNEL_INSTALL_STAGING_AREA/initrd *but hardcodes*
"--add-confdir hostonly" as a command line argument. The latter
has been fixed by PR [0] (commits [1-2]) but AFAICT there has
been no release yet which contains these changes.
3. systemd-boot ships /etc/kernel/postinst.d/zz-systemd-boot which
calls kernel-install, which calls
/usr/lib/kernel/install.d/50-dracut.install and then
/usr/lib/kernel/install.d/90-loaderentry.install which does this:
for initrd in "${KERNEL_INSTALL_STAGING_AREA}"/microcode* "${@}"
"${KERNEL_INSTALL_STAGING_AREA}"/initrd*; do [ -f "$initrd" ] ||
continue echo "initrd $ENTRY_DIR/${initrd##*/}" have_initrd=yes
done
This effectively means that *both* initramfs files end up in the
loader entry for systemd-boot and thus *both* initramfs entries
are loaded by the kernel on boot
4. This effectively concatenates/merges to *full* initramfs images
(instead of only partial overlays as intended), one of which is a
hostonly=yes initramfs even though the user may have explicitly
configured hostonly=no. On my system this leads to some warnings
about missing devices on boot, but fortunately the system still
boots. However, other users may not be so lucky.
The problem can be worked around by disabling the .install file:
ln -s /dev/null /etc/kernel/install.d/50-dracut.install
dpkg-reconfigure linux-image-`uname -r`
However, I think the correct solution is for dracut to *stop shipping*
the /usr/lib/kernel/install.d/50-dracut.install file completely, at
least until a consensus has been found as to which part of the software
stack (kernel postinst vs. systemd-boot->kernel-install) *should*
generate the initramfs in Debian. This is most likely a policy decision
[3] involving the systemd and Linux maintainers.
Best regards
Alexander Kurtz
[0] https://github.com/dracut-ng/dracut-ng/pull/1238
[1] https://github.com/dracut-ng/dracut-ng/commit/663e720e76407cf10e4e5c8d834b292beba828fa
[2] https://github.com/dracut-ng/dracut-ng/commit/62fdf59c94ef7ec2261d054384ceddff39c3643b
[3] https://kernel-team.pages.debian.net/kernel-handbook/ch-update-hooks.html
More information about the Pkg-systemd-maintainers
mailing list