这是indexloc提供的服务,不要输入任何密码

Debian Bug report logs - #1099136
dpkg: Please provide dpkg trigger activation timestamp or support removing triggers

version graph

Package: dpkg; Maintainer for dpkg is Dpkg Developers <debian-dpkg@lists.debian.org>; Source for dpkg is src:dpkg (PTS, buildd, popcon).

Reported by: Benjamin Drung <bdrung@ubuntu.com>

Date: Fri, 28 Feb 2025 18:45:03 UTC

Severity: normal

Found in version dpkg/1.22.15

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, bdrung@debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>:
Bug#1099136; Package dpkg. (Fri, 28 Feb 2025 18:45:04 GMT) (full text, mbox, link).


Acknowledgement sent to Benjamin Drung <bdrung@ubuntu.com>:
New Bug report received and forwarded. Copy sent to bdrung@debian.org, Dpkg Developers <debian-dpkg@lists.debian.org>. (Fri, 28 Feb 2025 18:45:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Benjamin Drung <bdrung@ubuntu.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: dpkg: Please provide dpkg trigger activation timestamp or support removing triggers
Date: Fri, 28 Feb 2025 19:42:22 +0100
Package: dpkg
Version: 1.22.15
Severity: normal
X-Debbugs-Cc: bdrung@debian.org

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



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Tue Jul 29 09:30:40 2025; Machine Name: berlioz

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.