mirror of
https://salsa.debian.org/kernel-team/initramfs-tools.git
synced 2026-01-26 15:39:08 +00:00
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.146) ... Setting up initramfs-tools (0.146) ... update-initramfs: deferring update (trigger activated) Setting up linux-image-6.12.20-amd64 (6.12.20-1) ... I: /vmlinuz.old is now a symlink to boot/vmlinuz-6.12.20-amd64 I: /initrd.img.old is now a symlink to boot/initrd.img-6.12.20-amd64 I: /vmlinuz is now a symlink to boot/vmlinuz-6.12.20-amd64 I: /initrd.img is now a symlink to boot/initrd.img-6.12.20-amd64 /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-6.12.20-amd64 Setting up linux-image-amd64 (6.12.20-1) ... Processing triggers for initramfs-tools (0.146) ... update-initramfs: Generating /boot/initrd.img-6.12.20-amd64 ``` Remember the timestamp when the dpkg trigger is set in the file `/run/update-initramfs.dpkg-trigger`. Then only update the initramfs if it is not newer than the time the trigger was created. This will solve the example given above: ``` $ apt-get install --no-install-recommends -y zstd initramfs-tools linux-image-generic [...] Setting up initramfs-tools-core (0.146) ... Setting up initramfs-tools (0.146) ... update-initramfs: deferring update (trigger activated) Setting up linux-image-6.12.20-amd64 (6.12.20-1) ... I: /vmlinuz.old is now a symlink to boot/vmlinuz-6.12.20-amd64 I: /initrd.img.old is now a symlink to boot/initrd.img-6.12.20-amd64 I: /vmlinuz is now a symlink to boot/vmlinuz-6.12.20-amd64 I: /initrd.img is now a symlink to boot/initrd.img-6.12.20-amd64 /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-6.12.20-amd64 Setting up linux-image-amd64 (6.12.20-1) ... Processing triggers for libc-bin (2.41-6) ... Processing triggers for initramfs-tools (0.146) ... update-initramfs: /boot/initrd.img-6.12.20-amd64 has already been updated since Tue Mar 25 11:48:49 2025. ``` This approach will not help, when the update-initramfs trigger is set by another package (e. g. clevis-initramfs). That would need support from the dpkg trigger (see Debian bug #1099136). LP: #1466965
Description
initramfs-tools
Languages
Shell
68.3%
Roff
22.3%
C
9.3%