Skip to content

feat: attempt rebuilding all initramfs before exiting

Tin Lai requested to merge soraxas/pkgbuilds:main into main

My Garuda currently had installed 3 kernels (where zen is my main one)

$ find /boot/vmli*

/boot/vmlinuz-linux-lts
/boot/vmlinuz-linux-mainline
/boot/vmlinuz-linux-zen

Old behaviour

When I was rebuilding initramfs, the command

$ sudo dracut-rebuild

:: Building initramfs for linux-mainline (6.10.0-rc6-1-mainline)
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
:: Building fallback initramfs for linux-mainline (6.10.0-rc6-1-mainline)
:: Building initramfs for linux-lts (6.6.37-1-lts)
libkmod: kmod_module_parse_depline: ctx=0x64e8967126d0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
libkmod: kmod_module_parse_depline: ctx=0x64e8967126d0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
libkmod: kmod_module_parse_depline: ctx=0x5c863be644a0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
dracut-install: could not get modinfo from 'nvidia_uvm': No such file or directory
libkmod: kmod_module_parse_depline: ctx=0x5c863be644a0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
libkmod: kmod_module_parse_depline: ctx=0x5dd639dce310 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia-modeset.ko.zst error=No such file or directory
realpath: updates/dkms/nvidia-modeset.ko.zst: No such file or directory
realpath: updates/dkms/nvidia-peermem.ko.zst: No such file or directory
realpath: updates/dkms/nvidia-drm.ko.zst: No such file or directory
realpath: updates/dkms/nvidia-uvm.ko.zst: No such file or directory
realpath: updates/dkms/nvidia.ko.zst: No such file or directory
dracut[F]: installkernel failed in module kernel-modules-extra

fails when it was attempting to build on the lts kernel (probably because the nvidia module is too new for the lts), and never attempts to build on the zen module.


New behaviour

This PR runs the build commands in subshell with the same -e flags, so that it can attempts building initramfs on all kernel (and stores any exit status) before exiting on error.

$ sudo dracut-rebuild

:: Building initramfs for linux-mainline (6.10.0-rc6-1-mainline)
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
:: Building fallback initramfs for linux-mainline (6.10.0-rc6-1-mainline)
:: Building initramfs for linux-lts (6.6.37-1-lts)
libkmod: kmod_module_parse_depline: ctx=0x63ffdae446d0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
libkmod: kmod_module_parse_depline: ctx=0x63ffdae446d0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
libkmod: kmod_module_parse_depline: ctx=0x64e47f4a14a0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
dracut-install: could not get modinfo from 'nvidia_uvm': No such file or directory
libkmod: kmod_module_parse_depline: ctx=0x64e47f4a14a0 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia.ko.zst error=No such file or directory
libkmod: kmod_module_parse_depline: ctx=0x6411f7823310 path=/lib/modules/6.6.37-1-lts//updates/dkms/nvidia-modeset.ko.zst error=No such file or directory
realpath: updates/dkms/nvidia-modeset.ko.zst: No such file or directory
realpath: updates/dkms/nvidia-peermem.ko.zst: No such file or directory
realpath: updates/dkms/nvidia-drm.ko.zst: No such file or directory
realpath: updates/dkms/nvidia-uvm.ko.zst: No such file or directory
realpath: updates/dkms/nvidia.ko.zst: No such file or directory
dracut[F]: installkernel failed in module kernel-modules-extra
:: Building initramfs for linux-zen (6.9.8-zen1-1-zen)
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
dracut[E]: Module 'systemd-pcrphase' depends on 'tpm2-tss', which can't be installed
:: Building fallback initramfs for linux-zen (6.9.8-zen1-1-zen)

Merge request reports