From: Antonio Alvarez Feijoo Date: Tue, 15 Apr 2025 15:16:22 +0000 (+0200) Subject: fix(dracut-init): assign real path to srcmods X-Git-Tag: 107~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb6d0c11d321cb71817bbc3f1dcd7bdcef8a8409;p=thirdparty%2Fdracut-ng.git fix(dracut-init): assign real path to srcmods On usrmerge systems, /lib is a symlink to /usr/lib, so the real path of the kernel directory is /usr/lib/modules/. The issue on these systems is that a kernel module can be added to the initrd (via dracut-install) by different dracut modules using both paths, and that causes libkmod to display the following type of errors in the middle of the dracut build: ``` libkmod: ERROR: kmod_module_new_from_path: kmod_module 'nvidia' already exists with different path: new-path='/lib/modules/6.14.1-1-default//weak-updates/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia.ko.zst' old-path='/usr/lib/modules/6.14.1-1-default/weak-updates/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia.ko.zst' libkmod: ERROR: kmod_module_parse_depline: ctx=0x560bbacad8f0 path=/lib/modules/6.14.1-1-default//weak-updates/updates/nvidia-open-driver-G06-signed-570.133.07/nvidia.ko.zst error=File exists ``` openSUSE bug report: https://bugzilla.opensuse.org/show_bug.cgi?id=1241114 --- diff --git a/dracut-init.sh b/dracut-init.sh index be8eb9fb5..27cda46de 100755 --- a/dracut-init.sh +++ b/dracut-init.sh @@ -58,7 +58,7 @@ if ! [[ $kernel ]]; then export kernel fi -srcmods="$dracutsysrootdir/lib/modules/$kernel/" +srcmods="$(realpath -e "$dracutsysrootdir/lib/modules/$kernel")" [[ $drivers_dir ]] && { if ! command -v kmod &> /dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then