[pkg-cryptsetup-devel] Bug#1036049: cryptsetup-initramfs: support for compressed modules

Kevin Locke kevin at kevinlocke.name
Sun May 14 14:26:03 BST 2023


Package: cryptsetup-initramfs
Version: 2:2.6.1-4~deb12u1
Severity: wishlist
Tags: patch

Dear Maintainer,

When Linux is configured with CONFIG_MODULE_COMPRESS_{GZIP,XZ,ZSTD},
modules are compressed and stored with a .ko.{gz,xz,zst} extension.
This causes the cryptroot hook script not to add the modules to the
initramfs, which can cause boot failures.  Although compression is not
currently enabled in any Debian kernel configuration that I'm aware
of, it would be nice if cryptsetup-initramfs could support this
configuration for downstream distributions and users with custom
kernels.

I've attached a patch to add support, as done by initramfs-tools:
https://salsa.debian.org/kernel-team/initramfs-tools/-/commit/8c806b446fab5f5807651a5c7869141837592ecd
Note that the situation has changed a bit since that commit and kmod
now supports zstd (Bug 990092) in addition to xz (Bug 772628).

Thanks for considering,
Kevin

-- Package-specific info:

-- System Information:
Debian Release: 12.0
  APT prefers testing-debug
  APT policy: (990, 'testing-debug'), (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-security'), (500, 'stable-debug'), (500, 'unstable'), (500, 'stable'), (101, 'experimental'), (1, 'experimental-debug')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.4.0-rc1+ (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages cryptsetup-initramfs depends on:
ii  busybox                                 1:1.35.0-4+b3
ii  cryptsetup                              2:2.6.1-4~deb12u1
ii  debconf [debconf-2.0]                   1.5.82
ii  initramfs-tools [linux-initramfs-tool]  0.142

Versions of packages cryptsetup-initramfs recommends:
ii  console-setup  1.220
ii  kbd            2.5.1-1+b1

cryptsetup-initramfs suggests no packages.

-- debconf information excluded
-------------- next part --------------
>From e52a22ea1ccc9bc66f80d1e3d2eb9ed5e92e4022 Mon Sep 17 00:00:00 2001
Message-Id: <e52a22ea1ccc9bc66f80d1e3d2eb9ed5e92e4022.1684069670.git.kevin at kevinlocke.name>
From: Kevin Locke <kevin at kevinlocke.name>
Date: Sat, 13 May 2023 22:37:01 -0600
Subject: [PATCH] initramfs: cryptroot support compressed modules

When Linux is configured with CONFIG_MODULE_COMPRESS_{GZIP,XZ,ZSTD},
modules are compressed and stored with a .ko.{gz,xz,zst} extension. This
causes the cryptroot hook script not to add the modules to the
initramfs, which can cause boot failures.

Match module files with additional extensions, as in
https://salsa.debian.org/kernel-team/initramfs-tools/-/commit/8c806b446fab5f5807651a5c7869141837592ecd
for initramfs-tools.  Note that kmod now supports zstd (Bug 990092) in
addition to xz (Bug 772628).

Signed-off-by: Kevin Locke <kevin at kevinlocke.name>
---
 debian/initramfs/hooks/cryptroot | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/debian/initramfs/hooks/cryptroot b/debian/initramfs/hooks/cryptroot
index 35577865..7b438593 100644
--- a/debian/initramfs/hooks/cryptroot
+++ b/debian/initramfs/hooks/cryptroot
@@ -266,8 +266,8 @@ populate_CRYPTO_MODULES() {
 add_modules() {
     local glob="$1" found=n
     shift
-    for mod in $(find -H "$@" -name "$glob.ko" -type f -printf '%f\n'); do
-        manual_add_modules "${mod%.ko}"
+    for mod in $(find -H "$@" -name "$glob.ko*" -type f -printf '%f\n'); do
+        manual_add_modules "${mod%.ko*}"
         found=y
     done
     [ "$found" = y ] && return 0 || return 1
-- 
2.39.2



More information about the pkg-cryptsetup-devel mailing list