Bug#1008883: initramfs-tools: 'Missing kernel modules' failure aborts ramdisk image update for any kernel
Package: initramfs-tools
Version: 0.133+deb10u1
Severity: normal
Dear Maintainer,
for this context i'm assuming multiple debian installs (even different
versions) on different partitions placing their kernel images into a
_shared_ '/boot' partition. When updating the ramdisk this may fail when
a corresponding version is found in '/boot' but not available in
'/lib/modules' which aborts the whole process with an error.
root@host:~# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-5.10.0-12-amd64
W: missing /lib/modules/5.10.0-12-amd64
W: Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/5.10.0-12-amd64: No
such
file or directory
depmod: FATAL: could not search modules: No such file or directory
cat:
/var/tmp/mkinitramfs_r1ST3a/lib/modules/5.10.0-12-amd64/modules.builtin:
No such file or directory
find: ‘/var/tmp/mkinitramfs_r1ST3a/lib/modules/5.10.0-12-amd64/kernel’:
No such
file or directory
W: initramfs-tools configuration sets
RESUME=UUID=1ac5d496-d890-460c-b773-6d6d0ec7ac8a
W: but no matching swap device is available.
I: The initramfs will attempt to resume from /dev/sdc7
I: (UUID=a49ec51e-eebb-441c-8e9c-41f40ea3e115)
I: Set the RESUME variable to override this.
It looks like 'get_sorted_versions()' of update-initramfs script obtains
kernel versions via 'linux-version' and tests their existence against
${BOOTDIR} folder but omitting '/lib/modules' folder. This only happens
when one or more version entries (or some in between) are not available
on the current root partition (but maybe on another one) which aborts
the whole process even for versions which might be available or are even
in need of an update (!) eg:
5.10.0-0.bpo.8-amd64
5.10.0-10-amd64
5.10.0-12-amd64
5.7.0-0.bpo.2-amd64
... when checking additionally '/lib/modules' folder this list boils
down to:
5.10.0-0.bpo.8-amd64
5.7.0-0.bpo.2-amd64
... which would succeed. So instead of aborting the whole process it
should at least build those ramdisk images for which it fulfills the
prerequisites. Most recent version 0.140 has still this behavior.
Patch Proposal:
diff --git a/update-initramfs b/update-initramfs
index 746a6c1..49f33ee 100755
--- a/update-initramfs
+++ b/update-initramfs
@@ -186,7 +186,7 @@ get_sorted_versions()
version_list="$(
linux-version list |
while read -r version; do
- test -e "${BOOTDIR}/initrd.img-$version" && echo
"$version"
+ (test -e "${BOOTDIR}/initrd.img-$version" && test -e
"/lib/modules/$version") && echo "$version"
done |
linux-version sort --reverse
)"
Kind regards,
Branko Mikić
Reply to: