Package: initramfs-tools-core
Version: 0.143.1
Severity: normal

Dear Maintainer,

## Description of the issue

I encountered the issue #1079022 which is about dracut-install
failing to execute due to an ABI change in libkmod.
Updating libkmod lead to this dracut-install failure:
---
/usr/lib/dracut/dracut-install: symbol lookup error: /usr/lib/dracut/dracut-
install: undefined symbol: kmod_module_get_weakdeps, version LIBKMOD_5
---

The issue I'm describing here is about the fact that mkinitramfs exit
code does not report a failure when dracut-install fails:
---
# mkinitramfs -o /boot/initrd.img-6.10.4-amd64.new 6.10.4-amd64 && echo
"Success!"
/usr/lib/dracut/dracut-install: symbol lookup error: /usr/lib/dracut/dracut-
install: undefined symbol: kmod_module_get_weakdeps, version LIBKMOD_5
/usr/lib/dracut/dracut-install: symbol lookup error: /usr/lib/dracut/dracut-
install: undefined symbol: kmod_module_get_weakdeps, version LIBKMOD_5
/usr/lib/dracut/dracut-install: symbol lookup error: /usr/lib/dracut/dracut-
install: undefined symbol: kmod_module_get_weakdeps, version LIBKMOD_5
Success!
---

If mkinitramfs would have catched this error, the initramfs would not
have been corrupted and caused a unbootable system but only a empty
`/boot/initrd.img-6.10.4-amd64.new` file.



## Reproduction steps

Either:
- Install kmod and libkmod2 version 33+20240816-1 and dracut-install
  version 103-1.
- Replace /usr/lib/dracut/dracut-install with a symlink to
  `/usr/bin/false`.

Then run `update-initramfs`.

I expect update-initramfs to return a non-0 exit code as the initrd
image was not correctly generated.



## Possible patch

I've tried to add `-e` to the shebang of mkinitramfs like this:
#!/bin/sh -e

This seems to fix the issue:
---
# mkinitramfs -o /boot/initrd.img-6.10.4-amd64.new 6.10.4-amd64 && echo
"Success!"
/usr/lib/dracut/dracut-install: symbol lookup error: /usr/lib/dracut/dracut-
install: undefined symbol: kmod_module_get_weakdeps, version LIBKMOD_5
---

No message "Success!" this time, as I would have expected.
The original /boot/initrd.img-6.10.4-amd64 is not modified.

Adding this `-e` might require more testing, maybe initramfs would fail
with this where it was working before, but I've not encountered such
issue.
So `-e` is still working fine for me (when dracut-install does not
fail).



## Logs of mkinitramfs with the patch

I've attached logs:
- mkinitramfs_patched_dash_e_with_dracut_error.txt:
  Behavior when upgrading a package (libkmod2 here) leading to
  dracut-install failure.
  In this case, the initramfs is unmodified, and the error bubble up to
  dpkg.
  The system is still bootable (using the previous initramfs).

- mkinitramfs_patched_dash_e_without_dracut_error.txt:
  Behavior when there is no failure: mkinitramfs doesn't seem to have
  any regression due to `-e` in its shebang.

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 6.9.9-amd64 (SMP w/12 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr:en_US
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages initramfs-tools-core depends on:
ii  coreutils       9.4-3.1
ii  cpio            2.15+dfsg-2
ii  dracut-install  103-1
ii  e2fsprogs       1.47.1-1
ii  klibc-utils     2.0.13-4
ii  kmod            33+20240816-1
ii  logsave         1.47.1-1
ii  udev            256.5-1

Versions of packages initramfs-tools-core recommends:
ii  busybox  1:1.36.1-9+b1
ii  zstd     1.5.6+dfsg-1

Versions of packages initramfs-tools-core suggests:
ii  bash-completion  1:2.14.0-1

-- no debconf information

--
Alexis Murzeau
PGP: B7E6 0EBB 9293 7B06 BDBC  2787 E7BD 1904 F480 937F                |
 
root@DOC-PC3:/boot# ls -l /boot
total 90625
-rw-r--r-- 1 root root   276641 12 août  20:18 config-6.10.4-amd64
-rw-r--r-- 1 root root   275522 13 juil. 17:45 config-6.9.9-amd64
drwx------ 4 root root     1024  1 janv.  1970 efi
drwxr-xr-x 5 root root     4096 13 août  15:15 grub
-rw-r--r-- 1 root root 36633838 19 août  19:57 initrd.img-6.10.4-amd64
-rw-r--r-- 1 root root 36321706 19 août  19:26 initrd.img-6.9.9-amd64
-rw-r--r-- 1 root root       83 12 août  20:18 System.map-6.10.4-amd64
-rw-r--r-- 1 root root       83 13 juil. 17:45 System.map-6.9.9-amd64
-rw-r--r-- 1 root root  9693120 12 août  20:18 vmlinuz-6.10.4-amd64
-rw-r--r-- 1 root root  9574336 13 juil. 17:45 vmlinuz-6.9.9-amd64
root@DOC-PC3:/boot# apt install kmod libkmod2
Upgrading:                                      
  kmod  libkmod2

Summary:
  Upgrading: 2, Installing: 0, Removing: 0, Not Upgrading: 53
  Download size: 0 B / 158 kB
  Space needed: 1 024 B / 101 GB available

Récupération des rapports de bogue… Fait
Analyse des informations Trouvé/Corrigé… Fait
bogues de gravité critical sur libkmod2 (32+20240611-1 → 33+20240816-1) <En 
attente de traitement>
 b1 - #1079022 - kmod: symbol lookup error: /usr/lib/dracut/dracut-install: 
undefined symbol: kmod_module_get_weakdeps, version LIBKMOD_5
   Fusionné avec : 1079035
Résumé :
 libkmod2(1 bogue)
Êtes-vous certain(e) de vouloir installer/mettre à niveau les paquets ci-dessus 
? [Y/n/?/...] y
(Lecture de la base de données... 374793 fichiers et répertoires déjà 
installés.)
Préparation du dépaquetage de .../kmod_33+20240816-1_amd64.deb ...
Dépaquetage de kmod (33+20240816-1) sur (32+20240611-1) ...
Préparation du dépaquetage de .../libkmod2_33+20240816-1_amd64.deb ...
Dépaquetage de libkmod2:amd64 (33+20240816-1) sur (32+20240611-1) ...
Paramétrage de libkmod2:amd64 (33+20240816-1) ...
Paramétrage de kmod (33+20240816-1) ...
Traitement des actions différées (« triggers ») pour initramfs-tools (0.143.1) 
...
update-initramfs: Generating /boot/initrd.img-6.10.4-amd64
/usr/lib/dracut/dracut-install: symbol lookup error: 
/usr/lib/dracut/dracut-install: undefined symbol: kmod_module_get_weakdeps, 
version LIBKMOD_5
update-initramfs: failed for /boot/initrd.img-6.10.4-amd64 with 127.
dpkg: erreur de traitement du paquet initramfs-tools (--configure) :
 le sous-processus paquet initramfs-tools script post-installation installé a 
renvoyé un état de sortie d'erreur 127
Traitement des actions différées (« triggers ») pour libc-bin (2.39-7) ...
Traitement des actions différées (« triggers ») pour man-db (2.12.1-3) ...
Des erreurs ont été rencontrées pendant l'exécution :
 initramfs-tools
======  How can you help?  (doc: https://wiki.debian.org/how-can-i-help ) ======

-----  Show old opportunities as well as new ones: how-can-i-help --old  -----
Error: Sub-process /usr/bin/dpkg returned an error code (1)
root@DOC-PC3:/boot# ls -l /boot
total 90625
-rw-r--r-- 1 root root   276641 12 août  20:18 config-6.10.4-amd64
-rw-r--r-- 1 root root   275522 13 juil. 17:45 config-6.9.9-amd64
drwx------ 4 root root     1024  1 janv.  1970 efi
drwxr-xr-x 5 root root     4096 13 août  15:15 grub
-rw-r--r-- 1 root root 36633838 19 août  19:57 initrd.img-6.10.4-amd64
-rw-r--r-- 1 root root 36321706 19 août  19:26 initrd.img-6.9.9-amd64
-rw-r--r-- 1 root root       83 12 août  20:18 System.map-6.10.4-amd64
-rw-r--r-- 1 root root       83 13 juil. 17:45 System.map-6.9.9-amd64
-rw-r--r-- 1 root root  9693120 12 août  20:18 vmlinuz-6.10.4-amd64
-rw-r--r-- 1 root root  9574336 13 juil. 17:45 vmlinuz-6.9.9-amd64
root@DOC-PC3:/boot# ls -l /boot
total 90625
-rw-r--r-- 1 root root   276641 12 août  20:18 config-6.10.4-amd64
-rw-r--r-- 1 root root   275522 13 juil. 17:45 config-6.9.9-amd64
drwx------ 4 root root     1024  1 janv.  1970 efi
drwxr-xr-x 5 root root     4096 13 août  15:15 grub
-rw-r--r-- 1 root root 36633838 19 août  19:57 initrd.img-6.10.4-amd64
-rw-r--r-- 1 root root 36321706 19 août  19:26 initrd.img-6.9.9-amd64
-rw-r--r-- 1 root root       83 12 août  20:18 System.map-6.10.4-amd64
-rw-r--r-- 1 root root       83 13 juil. 17:45 System.map-6.9.9-amd64
-rw-r--r-- 1 root root  9693120 12 août  20:18 vmlinuz-6.10.4-amd64
-rw-r--r-- 1 root root  9574336 13 juil. 17:45 vmlinuz-6.9.9-amd64
root@DOC-PC3:/boot# aptitude
Performing actions...
dpkg: avertissement: dégradation (« downgrade ») de kmod depuis 33+20240816-1 
vers 32+20240611-1
(Lecture de la base de données... 374791 fichiers et répertoires déjà 
installés.)
Préparation du dépaquetage de .../kmod_32+20240611-1_amd64.deb ...
Dépaquetage de kmod (32+20240611-1) sur (33+20240816-1) ...
dpkg: avertissement: dégradation (« downgrade ») de libkmod2:amd64 depuis 
33+20240816-1 vers 32+20240611-1
Préparation du dépaquetage de .../libkmod2_32+20240611-1_amd64.deb ...
Dépaquetage de libkmod2:amd64 (32+20240611-1) sur (33+20240816-1) ...
Paramétrage de initramfs-tools (0.143.1) ...
update-initramfs: deferring update (trigger activated)
Paramétrage de libkmod2:amd64 (32+20240611-1) ...
Paramétrage de kmod (32+20240611-1) ...
Traitement des actions différées (« triggers ») pour libc-bin (2.39-7) ...
Traitement des actions différées (« triggers ») pour man-db (2.12.1-3) ...
Traitement des actions différées (« triggers ») pour initramfs-tools (0.143.1) 
...
update-initramfs: Generating /boot/initrd.img-6.10.4-amd64
======  How can you help?  (doc: https://wiki.debian.org/how-can-i-help ) ======

-----  Show old opportunities as well as new ones: how-can-i-help --old  -----
Press Return to continue, 'q' followed by Return to quit.
q
root@DOC-PC3:/boot# ls -l /boot
total 90625
-rw-r--r-- 1 root root   276641 12 août  20:18 config-6.10.4-amd64
-rw-r--r-- 1 root root   275522 13 juil. 17:45 config-6.9.9-amd64
drwx------ 4 root root     1024  1 janv.  1970 efi
drwxr-xr-x 5 root root     4096 13 août  15:15 grub
-rw-r--r-- 1 root root 36633800 19 août  20:03 initrd.img-6.10.4-amd64
-rw-r--r-- 1 root root 36321706 19 août  19:26 initrd.img-6.9.9-amd64
-rw-r--r-- 1 root root       83 12 août  20:18 System.map-6.10.4-amd64
-rw-r--r-- 1 root root       83 13 juil. 17:45 System.map-6.9.9-amd64
-rw-r--r-- 1 root root  9693120 12 août  20:18 vmlinuz-6.10.4-amd64
-rw-r--r-- 1 root root  9574336 13 juil. 17:45 vmlinuz-6.9.9-amd64

Attachment: OpenPGP_0xE7BD1904F480937F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to