This reverts commit 7f2ed354cc8f966de444b8c278c208ea4e13ef75.
When installing a kernel package and a package with a trigger for
update-initramfs in one go, the update of the initramfs is skipped in
some cases.
In a clean chroot, populated with debootstrap for "trixie", run
```
apt install linux-image-amd64 plymouth-theme-mobian
```
Result:
```
[...]
Setting up linux-image-6.12.32-amd64 (6.12.32-1) ...
I: /vmlinuz.old is now a symlink to boot/vmlinuz-6.12.32-amd64
I: /initrd.img.old is now a symlink to boot/initrd.img-6.12.32-amd64
I: /vmlinuz is now a symlink to boot/vmlinuz-6.12.32-amd64
I: /initrd.img is now a symlink to boot/initrd.img-6.12.32-amd64
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-6.12.32-amd64
Setting up linux-image-amd64 (6.12.32-1) ...
Setting up plymouth-theme-mobian (1.1) ...
update-alternatives: using /usr/share/plymouth/themes/mobian/mobian.plymouth to provide /usr/share/plymouth/themes/default.plymouth (default.plymouth) in auto mode
Processing triggers for libc-bin (2.41-8) ...
Processing triggers for initramfs-tools (0.148.2) ...
update-initramfs: /boot/initrd.img-6.12.32-amd64 has already been updated since Mon Jun 23 06:07:09 2025.
```
The initramfs is updated after setup of the kernel package. It is NOT
updated again after setup of package plymouth-theme-mobian, which is
wrong. The files that are installed by package plymouth-theme-mobian are
missing in the initramfs (and the plymouth splash screen will not work).
This is what happens here:
1. Another package is installed that calls "update-initramfs -u". This
activates the trigger, and we store a timestamp for it.
2. linux-image-6.12.32-amd64 is installed. This calls the
initramfs-tools hook which synchronously builds the initramfs.
3. plymouth-theme-mobian is installed. This activates the trigger
through a triggers control file.
4. The trigger runs and passes the timestamp from (1) through to
update-initramfs. update-initramfs sees the current image is newer
than that, and skips the update.
We correctly handle the case where the trigger is only activated through
`update-initramfs -u`, or only through a triggers control file or direct
invocation of dpkg-trigger. But when both methods are used, this bug is
possible because a timestmap file is present and it is wrong.
So revert the optimised trigger handling until dpkg itself records
timestamps for trigger activation (see bug #1099136).
Closes: #1108204
/usr/bin/unmkinitramfs has been moved from initramfs-tools-core to
initramfs-tools-bin in 0.148.
Fixes: 9e37d8b38da7 ("Move unmkinitramfs to new initramfs-tools-bin package")
The kernel and mkinitramfs support lzma compression, but for some
reason this was not included in unmkinitramfs.
- Add a format code, magic entry, and decompression command for lzma
to unmkinitramfs
- Add lzma to the compression commands in the test case
Signed-off-by: Ben Hutchings <benh@debian.org>
Many arm devices rely on drivers to bring up their display panels properly.
Include all of drivers/gpu/drm/panel, drivers/gpu/drm/bridge and
drivers/video/backlight to make sure the display is working in the
initrd (to show disk unlock dialogue etc).
Found on a Qualcomm CRD Snapdragon Laptop but this seems to affect
many similar machines too.
Our current panel driver loading mechanism when using MODULES=dep
is faulty because it matches on driver names that include "*panel*".
This is not true for many of the panel drivers in Linux as can be
seen by running `grep -Er "\s+.name\s+="" drivers/gpu/drm/panel`
in the Linux source tree.
Examples:
panel-feiyang-fy07024di26a30d.c: .name = "feiyang-fy07024di26a30d",
panel-ilitek-ili9881c.c: .name = "ili9881c-dsi",
panel-magnachip-d53e6ea8966.c: .name = "d53e6ea8966-panel",
A better way to find ALL panel drivers is to also include
/sys/module/*panel*/drivers/*/* where the file names are derived
from the *.c source files which all include panel,
see `ls drivers/gpu/drm/panel`.
We originally unpacked each cpio archive into its own subdirectory for
security reasons. Since we are now able to stitch together multiple
cpio archives to feed to a single cpio process, that concern no longer
applies.
We maintained the split up to the release of "trixie" out of concern
for possible breakage of callers that relied on this split. Since
that release is done, stop splitting and always unpack everything
directly into the output directory.
Signed-off-by: Ben Hutchings <benh@debian.org>
Add a test that exercises unmkinitramfs with:
- 0-2 early cpio archives
- 0-2 main cpio archives
- All supported compressors, including none, for the last main archive
and verifies that the output is as expected.
Signed-off-by: Ben Hutchings <benh@debian.org>
Since unmkinitramfs is now native code, it needs to be built as part
of an arch:any package. Introduce initramfs-tools-bin and move it
there.
CI: Remove the variables that disable arch:any builds.
Signed-off-by: Ben Hutchings <benh@debian.org>
Parsing uncompressed cpio archives in this shell script requires
running multiple processes for each archive member.
This was not too bad when there were usually only a few microcode
blobs in an uncompressed archive, but now that we put compressed
kernel modules in an uncompressed archive, it became very slow indeed.
Rewrite it in C so that it's acceptably fast.
This should have no functional changes, except that it adds support
for an initramfs with no compressed part.
Fixes: 81fd41f72dd8 ("Put compressed kernel modules and firmware in an uncompressed cpio")
Signed-off-by: Ben Hutchings <benh@debian.org>
The driver for coreboot firmware-initialized framebuffer can be built as
a module. Debian kernels so far have it as built-in because they would
not be probed automatically when built as a module. This is fixed now,
likely with a patchset included in v6.9-rc1, so we might encounter it as
a module either in Debian or with custom-built kernels.
For MODULES=dep, check for the coreboot framebuffer in a different block
from other platform drivers, and include the framebuffer_coreboot module
if we find the device. For MODULES=most, add driver to the framebuffer
modules list. Explicitly try to probe the module for break=top because
it would not automatically probe there otherwise. Since it requires a
driver for the "simple-framebuffer" device, add simpledrm and simplefb
as its hidden dependencies.
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Recent Debian kernels have the simplefb driver built-in on a few
architectures, except in cloud flavours. It handles 'simple-framebuffer'
devices registered from elsewhere: possibly in a device-tree fragment,
or from another driver like framebuffer_coreboot, or via SYSFB_SIMPLEFB.
The more modern alternative to it is simpledrm which also handles
the same 'simple-framebuffer' devices.
We haven't switched to simpledrm, but if we do it's possible we will
want it to be a module, since it depends on the drm subsystem and would
require that to be built-in otherwise. Regardless of what we choose for
Debian kernels, it's still possible for custom-built kernels to have
either/both of simplefb and simpledrm as modules instead of built-in.
Include these modules in initramfs unconditionally when MODULES=dep.
For MODULES=most, add the two drivers to the framebuffer modules list.
When MODULES=dep and these drives are (probed) modules, our check for
platform framebuffers always finds a "module" directory in the driver's
sysfs directory and incorrectly skips handling graphics modules, ignore
the false positive.
Unfortunately, these drivers sometimes do not get probed automatically.
One such case is efifb with SYSFB_SIMPLEFB=y, which is quite important.
Add a init-top script that tries to probe simpledrm, with a fallback to
simplefb. Explicitly try to probe these modules for break=top as well.
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
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
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
```
Add a `-s` parameter to `update-initramfs` to set a Unix time stamp
(seconds since 1970) for the update mode. An existing initramfs will
only be updated if it is not newer than the specified Unix time stamp.
This feature is the first step to avoid generating the initrd twice.
LP: #1466965
dracut-install can filter modules by symbol (`--mod-filter-symbol`) to
select modules more fine-grain. Harmonize the set of modules that
initramfs-tools and dracut install.
The modules mptfc, mptsas, mptscsih, mptspi, and zfcp are covered by
including `=drivers/message/fusion` to the block devices.
LP: #2031841
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Including only UFS storage drivers that match the symbol regexp
`${blockfuncs}|iscsi_register_transport` is not enough.
Move UFS storage drivers to the `block` class instead of the more
specific `scsi`.
LP: #2081020
Ubuntu's dracut package ships an `update-initramfs` command with the
same interface as initramfs-tools'. The difference is that it calls
dracut instead of mkinitramfs.
When installing dracut without purging initramfs-tools,
`/etc/kernel/postinst.d/initramfs-tools` will still execute
`update-initramfs` (in addition to dracut's kernel postinst hook).
So query the newly add `--version` parameter to determine which package
provided the `update-initramfs` script. Only run the kernel postinst
hook when the provider matches.
The current behaviour of creating sub-directories for multi-archive
initramfs images was never documented. Document what we do now, with
a note that we may stop creating sub-directories in future.
Signed-off-by: Ben Hutchings <benh@debian.org>