Here are my notes from filing a duplicate issue (with just dracut,
initramfs-tools is purged), the missing step in bdrung's comment is
kernel-install.

This issue involves systemd (the kernel-install command, the
/usr/lib/kernel/install.d/55-initrd.install script that copies
/boot/initrd.img-$KERNEL_VERSION from /boot to /boot/efi), third-party
scripts hooking into kernel-install like dracut-core's
/usr/lib/kernel/install.d/50-dracut.install, and dracut, which provides
/etc/kernel/postinst.d/dracut which is run by kernel-image maintainer
scripts like /var/lib/dpkg/info/linux-image-6.14.0-15-generic.postinst.

Steps (thanks to execsnoop on apt reinstall linux-image-$KERNEL_VERSION):
- /etc/kernel/postinst.d/dracut generates /boot/initrd.img-$KERNEL_VERSION
- /etc/kernel/postinst.d/initramfs-tools calls update-initramfs (shipped by 
either dracut or initramfs-tools)
  - /usr/sbin/update-initramfs calls /etc/initramfs/post-update.d/systemd-boot, 
which calls kernel-install
- /etc/kernel/postinst.d/zz-systemd-boot also calls kernel-install if neither 
dracut nor initramfs-tools is installed
- kernel-install then runs:
  - /usr/lib/kernel/install.d/50-dracut.install from dracut-core, which runs 
dracut again, generates /boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd
  - /usr/lib/kernel/install.d/55-initrd.install from systemd which copies 
/boot/initrd.img-$KERNEL_VERSION to 
/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd.img-$KERNEL_VERSION

Which is how the EFI system partition ends up with duplicate initrds for every 
kernel version.
ESP space is limited and hard to grow so this is problematic.

On 25.04 plucky, it is possible to have dracut-core installed, dracut
and initramfs-tools both purged (purge removes left-over hooks from
/etc), in which case dracut-core will still generate an
/boot/efi/$MACHINE_ID/$KERNEL_VERSION/initrd,
/boot/initrd.img-$KERNEL_VERSION won't be generated for newly installed
kernels, and the duplication is avoided.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2100296

Title:
  Double initrd in /efi/<machine-id>/<kver>/ with systemd-boot

Status in dracut package in Ubuntu:
  Confirmed
Status in systemd package in Ubuntu:
  Confirmed

Bug description:
  With the combination of using dracut and systemd-boot from plucky-
  proposed I get two initrds copied to the EFI partition:

  /efi/2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic
  /efi/2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/linux
  
/efi/2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/jh7110-starfive-visionfive-2-v1.3b.dtb
  /efi/2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/initrd
  
/efi/2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/initrd.img-6.14.0-5-generic

  ..and both of them enabled in the config file

  root@visionfive2~# cat 
/efi/loader/entries/2504a9c37a434fc28843779e4d0b34eb-6.14.0-5-generic.conf
  # Boot Loader Specification type#1 entry
  # File created by /usr/lib/kernel/install.d/90-loaderentry.install (systemd 
257.3-1ubuntu3)
  title      Ubuntu Plucky Puffin (development branch)
  version    6.14.0-5-generic
  machine-id 2504a9c37a434fc28843779e4d0b34eb
  sort-key   ubuntu
  options    earlycon console=ttyS0,115200n8 rootwait root=/dev/nvme0n1 
rootfstype=btrfs ro rootflags=ssd,subvol=/plucky 
systemd.machine_id=2504a9c37a434fc28843779e4d0b34eb
  linux      /2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/linux
  devicetree 
/2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/jh7110-starfive-visionfive-2-v1.3b.dtb
  initrd     /2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/initrd
  initrd     
/2504a9c37a434fc28843779e4d0b34eb/6.14.0-5-generic/initrd.img-6.14.0-5-generic

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


-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to