XPost: linux.debian.bugs.dist
Package: dpkg
Version: 1.22.15
Severity: normal
X-Debbugs-Cc:
[email protected]
Dear Maintainer,
When installing/upgrading packages (e. g. a kernel and initramfs-tools),
the same initrd is generated twice:
```
$ apt-get install --no-install-recommends -y zstd initramfs-tools linux-image-generic
[...]
Setting up initramfs-tools-core (0.145) ...
Setting up initramfs-tools (0.145) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-6.12.16-amd64 (6.12.16-1) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-6.12.16-amd64
I: /initrd.img.old is now a symlink to boot/initrd.img-6.12.16-amd64
I: /vmlinuz is now a symlink to boot/vmlinuz-6.12.16-amd64
I: /initrd.img is now a symlink to boot/initrd.img-6.12.16-amd64 /etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.12.16-amd64
Setting up linux-image-amd64 (6.12.16-1) ...
Processing triggers for libc-bin (2.40-7) ...
Processing triggers for initramfs-tools (0.145) ...
update-initramfs: Generating /boot/initrd.img-6.12.16-amd64
```
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).
Generating the initrd takes seconds of fast systems and minutes on slow systems. Therefore I like to avoid generating the initrd twice. I have following ideas to solve this. It requires two changes (I and II).
Ia. Support for deleting triggers. Then
/etc/kernel/postinst.d/initramfs-tools could delete the
update-initramfs trigger in case the kernel version is the latest
kernel version.
Ib. Alternative to Ia: Provide the information when the dpkg trigger was
activated. dpkg would need to provide the timestamp were the trigger
was activated the last time. Then the update-initramfs trigger can
check if the initrd is newer than the trigger timestamp.
II. Dpkg would need to support ordering triggers so that the
update-initramfs trigger could always be ordered after the kernel
postinst. See also bug Debian #1004001.
I found no solution to this problem without changing the dpkg triggers.
For the record, here are the approaches that I had to discard:
1. Skip generating the initrd in /etc/kernel/postinst.d/initramfs-tools.
This cannot be done, because postinst hooks might rely on the initrd
to be generated.
2. The update-initramfs tool could record the timestamp when it
activates the trigger. This will work for installing initramfs-tools
together with a kernel, but it will not work if other packages are
installed that await the update-initramfs trigger.
--
Benjamin Drung
Debian & Ubuntu Developer
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)