To solve this issue, we need support from dpkg. Therefore I filed https://bugs.debian.org/1099136 (dpkg: Please provide dpkg trigger activation timestamp or support removing triggers)
** Summary changed: - update-initramfs runs more often than necessary + update-initramfs is called twice for the same kernel ** Description changed: + When installing/upgrading packages (e. g. a kernel and initramfs-tools), + the same initrd is generated twice. Example from Ubuntu 24.04 (noble): + + ``` + $ apt-get install --no-install-recommends -y zstd initramfs-tools linux-image-generic + [...] + Setting up initramfs-tools-core (0.142ubuntu25.5) ... + Setting up initramfs-tools (0.142ubuntu25.5) ... + update-initramfs: deferring update (trigger activated) + Processing triggers for libc-bin (2.39-0ubuntu8.4) ... + Processing triggers for linux-image-6.8.0-54-generic (6.8.0-54.56) ... + /etc/kernel/postinst.d/initramfs-tools: + update-initramfs: Generating /boot/initrd.img-6.8.0-54-generic + Processing triggers for initramfs-tools (0.142ubuntu25.5) ... + update-initramfs: Generating /boot/initrd.img-6.8.0-54-generic + ``` + + This behavior is caused the kernel postinst running `run-parts + /etc/kernel/postinst.d` where `/etc/kernel/postinst.d/initramfs-tools` + calls update-initramfs. The initramfs-tools package uses the update- + initramfs dpkg trigger. This trigger is executed later and calls + `update-initramfs -u` (which updates the initrd for the latest kernel). + + Original report + =============== + A discussion that has come up before, but I figured I'd file a bug. When you 'apt-get install <some-packages>' often times: - a.) update-initramfs is called more than once for the same kernel - b.) update-initramfs might not even be called (such as in bug 1466960). + a.) update-initramfs is called more than once for the same kernel + b.) update-initramfs might not even be called (such as in bug 1466960). some conversation with infinity in #ubuntu-devel [1] indicates that he and apw have discussed how to do solve this. [1] http://irclogs.ubuntu.com/2015/06/19/%23ubuntu-devel.html#t18:04 ProblemType: Bug DistroRelease: Ubuntu 15.10 Package: initramfs-tools 0.103ubuntu15 ProcVersionSignature: User Name 3.19.0-21.21-generic 3.19.8 Uname: Linux 3.19.0-21-generic x86_64 ApportVersion: 2.17.3-0ubuntu4 Architecture: amd64 Date: Fri Jun 19 18:19:15 2015 Ec2AMI: ami-00000425 Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: aki-00000002 Ec2Ramdisk: ari-00000002 PackageArchitecture: all ProcEnviron: - TERM=xterm-256color - PATH=(custom, no user) - XDG_RUNTIME_DIR=<set> - LANG=en_US.UTF-8 - SHELL=/bin/bash + TERM=xterm-256color + PATH=(custom, no user) + XDG_RUNTIME_DIR=<set> + LANG=en_US.UTF-8 + SHELL=/bin/bash SourcePackage: initramfs-tools UpgradeStatus: No upgrade log present (probably fresh install) ** Also affects: dpkg (Ubuntu) Importance: Undecided Status: New ** Bug watch added: Debian Bug tracker #1099136 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1099136 ** Also affects: dpkg (Debian) via https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1099136 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to initramfs-tools in Ubuntu. https://bugs.launchpad.net/bugs/1466965 Title: update-initramfs is called twice for the same kernel Status in dpkg package in Ubuntu: New Status in initramfs-tools package in Ubuntu: Triaged Status in dpkg package in Debian: Unknown Bug description: When installing/upgrading packages (e. g. a kernel and initramfs-tools), the same initrd is generated twice. Example from Ubuntu 24.04 (noble): ``` $ apt-get install --no-install-recommends -y zstd initramfs-tools linux-image-generic [...] Setting up initramfs-tools-core (0.142ubuntu25.5) ... Setting up initramfs-tools (0.142ubuntu25.5) ... update-initramfs: deferring update (trigger activated) Processing triggers for libc-bin (2.39-0ubuntu8.4) ... Processing triggers for linux-image-6.8.0-54-generic (6.8.0-54.56) ... /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-6.8.0-54-generic Processing triggers for initramfs-tools (0.142ubuntu25.5) ... update-initramfs: Generating /boot/initrd.img-6.8.0-54-generic ``` This behavior is caused the kernel postinst running `run-parts /etc/kernel/postinst.d` where `/etc/kernel/postinst.d/initramfs-tools` calls update-initramfs. The initramfs-tools package uses the update- initramfs dpkg trigger. This trigger is executed later and calls `update-initramfs -u` (which updates the initrd for the latest kernel). Original report =============== A discussion that has come up before, but I figured I'd file a bug. When you 'apt-get install <some-packages>' often times: a.) update-initramfs is called more than once for the same kernel b.) update-initramfs might not even be called (such as in bug 1466960). some conversation with infinity in #ubuntu-devel [1] indicates that he and apw have discussed how to do solve this. [1] http://irclogs.ubuntu.com/2015/06/19/%23ubuntu-devel.html#t18:04 ProblemType: Bug DistroRelease: Ubuntu 15.10 Package: initramfs-tools 0.103ubuntu15 ProcVersionSignature: User Name 3.19.0-21.21-generic 3.19.8 Uname: Linux 3.19.0-21-generic x86_64 ApportVersion: 2.17.3-0ubuntu4 Architecture: amd64 Date: Fri Jun 19 18:19:15 2015 Ec2AMI: ami-00000425 Ec2AMIManifest: FIXME Ec2AvailabilityZone: nova Ec2InstanceType: m1.small Ec2Kernel: aki-00000002 Ec2Ramdisk: ari-00000002 PackageArchitecture: all ProcEnviron: TERM=xterm-256color PATH=(custom, no user) XDG_RUNTIME_DIR=<set> LANG=en_US.UTF-8 SHELL=/bin/bash SourcePackage: initramfs-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1466965/+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