Package: dracut
Version: 113-5
Severity: normal

Dear Maintainer,

On a system using systemd-boot with a BLS layout on the ESP
(/boot/efi/loader/entries and /boot/efi/<machine-id>/ exist), a plain
"dracut -f" succeeds but the rebuilt initrd is not the one that gets
booted.

With no output file given, dracut.sh picks
/boot/efi/<machine-id>/<kver>/initrd as the output (the BLS branch of
the default outfile logic). Since 109-3 dropped
debian-initramfs-post-update.patch (#1091455), dracut itself no longer
runs /etc/initramfs/post-update.d/, so kernel-install isn't invoked and
the loader entry isn't updated.

However, the loader entry written by systemd-boot's post-update hook
(invoked via update-initramfs) references the initrd by the basename of
the file passed to it, i.e.:

  initrd     /<machine-id>/<kver>/initrd.img-<kver>

So after "dracut -f", the ESP entry directory contains:

  initrd                  <- just rebuilt by "dracut -f", not referenced
  initrd.img-<kver>       <- referenced by the loader entry, unchanged
  linux

and the next boot uses the old initrd without any warning.
"update-initramfs -u" works correctly (builds /boot/initrd.img-<kver>
and the hook copies it into the ESP entry directory).

Reproduced in a VM with dracut 113-5 and systemd-boot 257.13-1~deb13u1:

  1. install systemd-boot and dracut, run "bootctl install" so that the
     BLS layout exists under /boot/efi
  2. run "update-initramfs -u" (the loader entry now points at
     initrd.img-<kver>)
  3. run "dracut -f"
  4. compare mtimes of /boot/efi/<machine-id>/<kver>/initrd and
     .../initrd.img-<kver>, and the "initrd" line of
     /boot/efi/loader/entries/<machine-id>-<kver>.conf

Before 109-3, step 3 instead failed loudly (#1109832), because the
post-update hook passed the BLS initrd path to kernel-install, which
then tried to copy the file onto itself.

I'm not sure what the best fix is. Possibilities that come to mind:

 - default the output of a plain "dracut" to /boot/initrd.img-<kver> on
   Debian, matching update-initramfs, or
 - have a plain "dracut" (when no output file is given) still run the
   post-update hooks, but with /boot/initrd.img-<kver> as the output, or
 - at least warn when writing into a BLS entry directory whose loader
   entry references a different initrd.

-- 
David Härdeman

Reply via email to