1728 Commits

Author SHA1 Message Date
Ben Hutchings
bdc4348472 Merge branch 'revert-avoid-double-generation' into 'debian/latest'
Revert "Avoid updating the initramfs twice for some cases"

See merge request kernel-team/initramfs-tools!177
2025-06-29 11:52:38 +00:00
Benjamin Drung
e1d0775be0 Revert "Avoid updating the initramfs twice for some cases"
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
2025-06-26 17:50:13 +02:00
Ben Hutchings
2c0bd2d293 Releasing version 0.149.
Signed-off-by: Ben Hutchings <benh@debian.org>
v0.149
2025-06-13 00:18:20 +02:00
Ben Hutchings
1f479fd08f Merge branch 'missing-breaks' into 'debian/latest'
Add missing Breaks to initramfs-tools-bin (for moved unmkinitramfs)

See merge request kernel-team/initramfs-tools!174
2025-06-12 22:15:59 +00:00
Ben Hutchings
a49262b73f Merge branch 'fix-zfcp' into 'debian/latest'
Re-add s390 specific scsi drivers

See merge request kernel-team/initramfs-tools!175
2025-06-12 22:13:19 +00:00
Bastian Blank
39e24feb81 Re-add s390 specific scsi drivers
Closes: #1107689
Fixes: kernel-team/initramfs-tools!149
2025-06-12 09:38:58 +02:00
Benjamin Drung
8842365ef2 Add missing Breaks to initramfs-tools-bin (for moved unmkinitramfs)
/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")
2025-06-10 13:29:15 +02:00
Ben Hutchings
c2c719fe93 Merge branch 'unmkinitramfs-lzma' into 'debian/latest'
unmkinitramfs: Add support for lzma compression

See merge request kernel-team/initramfs-tools!171
2025-06-01 15:05:48 +00:00
Ben Hutchings
02bd63ab71 unmkinitramfs: Add support for lzma compression
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>
2025-05-31 18:18:05 +02:00
Ben Hutchings
e28d365867 Merge branch 'panels' into 'debian/latest'
Fix inclusion of panel drivers

See merge request kernel-team/initramfs-tools!170
2025-05-28 18:15:21 +00:00
Ben Hutchings
f4ff132415 Merge branch 'unmkinitramfs-unsplit' into 'debian/latest'
unmkinitramfs: Stop splitting into "early"  and "main" subdirectories

See merge request kernel-team/initramfs-tools!169
2025-05-28 18:13:39 +00:00
Ben Hutchings
d04a3289d8 Merge branch 'log-copy_file-failures' into 'debian/latest'
hook-functions: Print error message on copy_file failure

See merge request kernel-team/initramfs-tools!167
2025-05-28 18:13:23 +00:00
Ben Hutchings
e375f529c8 Merge branch 'simple-framebuffer-modules' into 'debian/latest'
Handle simple-framebuffer drivers and framebuffer_coreboot built as modules

See merge request kernel-team/initramfs-tools!142
2025-05-28 18:12:16 +00:00
Ben Hutchings
36c3ee4e10 Releasing version 0.148.
Signed-off-by: Ben Hutchings <benh@debian.org>
v0.148
2025-05-28 19:09:56 +02:00
Tobias Heider
d82a1e91ef Include all bridge, panel and backlight drivers if MODULES=most
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.
2025-05-06 21:56:15 +02:00
Tobias Heider
6fdd131444 Fix include of panel drivers if MODULES=dep
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`.
2025-05-06 21:55:09 +02:00
Benjamin Drung
ea2977533e hook-functions: Print error message on copy_file failure
Print an error message when copy_file cannot find the source file. This
will ease debugging in cases of failures like LP #1641230.
2025-04-25 11:19:30 +02:00
Ben Hutchings
c7fc4a424f Merge branch 'unmkinitramfs-c' into 'debian/latest'
unmkinitramfs: Rewrite in C to make it acceptably fast

See merge request kernel-team/initramfs-tools!168
2025-04-23 00:28:22 +00:00
Ben Hutchings
810421833a unmkinitramfs: Stop splitting into "early" and "main" subdirectories
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>
2025-04-22 03:10:23 +02:00
Ben Hutchings
49f3bbadce test: Add autopkgtest case for unmkinitramfs
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>
2025-04-22 03:09:39 +02:00
Ben Hutchings
9e37d8b38d Move unmkinitramfs to new initramfs-tools-bin package
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>
2025-04-22 02:37:00 +02:00
Ben Hutchings
a797b423d2 unmkinitramfs: Rewrite in C to make it acceptably fast
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>
2025-04-22 02:37:00 +02:00
Alper Nebi Yasak
72899f8d89 Handle framebuffer_coreboot driver built as a module
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>
2025-04-21 09:05:08 +03:00
Alper Nebi Yasak
d11ba241dc Handle simple-framebuffer drivers built as modules
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>
2025-04-21 09:05:08 +03:00
Ben Hutchings
33075edd68 Releasing version 0.147.
Signed-off-by: Ben Hutchings <benh@debian.org>
v0.147
2025-03-28 02:38:25 +01:00
Ben Hutchings
203b5c85a8 Merge branch 'debian-policy' into 'debian/latest'
Bump Standards-Version to 4.7.2

See merge request kernel-team/initramfs-tools!166
2025-03-26 19:53:07 +00:00
Ben Hutchings
20cc17c2ee Merge branch 'test-order' into 'debian/latest'
test: run quick copy-file autopkgtest first

See merge request kernel-team/initramfs-tools!165
2025-03-26 19:51:44 +00:00
Benjamin Drung
32aa7432d2 Bump Standards-Version to 4.7.2
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
2025-03-26 12:35:44 +01:00
Benjamin Drung
dad2c90a74 test: run quick copy-file autopkgtest first
The autopkgtest copy-file is a quickly running test. Run it before the
more expensive tests are run.
2025-03-26 11:01:18 +01:00
Ben Hutchings
1f682eecf5 Merge branch 'spelling' into 'debian/latest'
Fix spelling mistakes in d/changelog

See merge request kernel-team/initramfs-tools!163
2025-03-26 00:07:17 +00:00
Ben Hutchings
0df1765e90 Merge branch 'block-modules' into 'debian/latest'
Filter block kernel modules by symbol regex from dracut

See merge request kernel-team/initramfs-tools!149
2025-03-25 23:58:06 +00:00
Ben Hutchings
f740273bb0 Merge branch 'avoid-double-generation' into 'debian/latest'
Avoid updating the initramfs twice for some cases

See merge request kernel-team/initramfs-tools!157
2025-03-25 23:53:49 +00:00
Benjamin Drung
7f2ed354cc Avoid updating the initramfs twice for some cases
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
2025-03-25 12:49:23 +01:00
Benjamin Drung
40694280ef update-initramfs: add -s parameter
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
2025-03-25 12:40:14 +01:00
Benjamin Drung
19b85a5685 Filter block kernel modules by symbol regex from dracut
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>
2025-03-25 11:55:34 +01:00
Benjamin Drung
3ed407721c hook-functions: Move UFS storage drivers to block class
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
2025-03-25 11:49:28 +01:00
Benjamin Drung
7ef47552c1 Fix spelling mistakes in d/changelog
lintian complains:

```
W: initramfs-tools: spelling-error-in-changelog depency dependency [usr/share/doc/initramfs-tools/changelog.gz]
W: initramfs-tools: spelling-error-in-changelog plaforms platforms [usr/share/doc/initramfs-tools/changelog.gz]
W: initramfs-tools-core: spelling-error-in-changelog depency dependency [usr/share/doc/initramfs-tools-core/changelog.gz]
W: initramfs-tools-core: spelling-error-in-changelog plaforms platforms [usr/share/doc/initramfs-tools-core/changelog.gz]
```
2025-03-25 11:38:49 +01:00
Ben Hutchings
8722bb830a Merge branch 'unmk-regression' into 'debian/latest'
unmkinitramfs: Restore split to "early" and "main" subdirectories

See merge request kernel-team/initramfs-tools!162
2025-03-24 23:50:00 +00:00
Ben Hutchings
f48fbc6e86 Merge branch 'iscsi' into 'debian/latest'
Add qemu-net-iscsi autopkgtest

See merge request kernel-team/initramfs-tools!154
2025-03-24 23:48:28 +00:00
Ben Hutchings
a781aa7924 Merge branch 'update-initramfs' into 'debian/latest'
kernel/postinst.d: check for correct update-initramfs provider

See merge request kernel-team/initramfs-tools!159
2025-03-24 23:39:50 +00:00
Benjamin Drung
2334de30e4 kernel/postinst.d: check for correct update-initramfs provider
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.
2025-03-24 11:31:13 +01:00
Benjamin Drung
65166a6ff3 update-initramfs: add --version parameter 2025-03-24 11:30:45 +01:00
Benjamin Drung
716491a8ce mkinitramfs: add --version parameter 2025-03-24 11:30:24 +01:00
Benjamin Drung
20c564a90b Add qemu-net-iscsi autopkgtest
Add an autopkgtest for iSCSI similar to TEST-70-ISCSI from dracut.

LP: #2091904
2025-03-24 11:06:05 +01:00
Benjamin Drung
ab1fe4e20d test-common: introduce intermediate _run_qemu_default_devices
Introduce an intermediate function `_run_qemu_default_devices` to allow
reusing `_run_qemu` for cases where block or network devices are not
wanted.
2025-03-24 10:55:12 +01:00
Benjamin Drung
5401bf3528 test: support setting a disk label in build_fs_ext2 2025-03-24 10:47:10 +01:00
Benjamin Drung
a6884dc1ad test: let run_qemu* take extra kernel parameters as single parameter
Let the run_qemu* functions take extra kernel parameters as one single
parameter. This allows taking additional parameters later.
2025-03-24 10:42:56 +01:00
Ben Hutchings
bab0ea332f Merge branch 'squashfs' into 'debian/latest'
hook-functions: add squashfs driver

See merge request kernel-team/initramfs-tools!151
2025-03-23 18:48:32 +00:00
Ben Hutchings
bbbe1d37b3 unmkinitramfs.8: Update and expand description of multi-archive handling
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>
2025-03-20 02:40:42 +01:00
Scott Moser
cec12d7d80 hook-functions: add squashfs driver
Add squashfs support by default.

LP: #1501834
2025-03-17 10:16:30 +01:00