dracut
dracut copied to clipboard
kernel-modules-extra: dracut failed if invalid .ko files exist in modules.dep
Describe the bug
dracut failed inside installkernel in module kernel-modules-extra.
# dracut -f ./test.img
realpath: weak-updates/test.ko: No such file or directory
dracut: installkernel failed in module kernel-modules-extra
Distribution used centos stream 9 (kernel version: 5.14.0-160.el9.x86_64)
Dracut version dracut 057-13.git20220816.el9
Init system systemd 250 (250-11.el9)
To Reproduce There exist invalid files in "/lib/modules/$(uname -r)/modules.dep", whose prefix directory is listed in config files under "/run/depmod.d/", "/etc/depmod.d/" or "/lib/depmod.d/".
For example, "weak-updates" is listed in "/etc/depmod.d/dist.conf", and "weak-updates/test.ko" actually does not exist but is recorded in "/lib/modules/uname -r/modules.dep".
# tail -n 1 /etc/depmod.d/dist.conf
search updates extra built-in weak-updates
Reproduce as following:
# echo "weak-updates/test.ko:" >> /lib/modules/$(uname -r)/modules.dep
# dracut -f ./test.img
realpath: weak-updates/test.ko: No such file or directory
dracut: installkernel failed in module kernel-modules-extra
Expected behavior dracut gives realpath warning and aborts generating initramfs image.
Additional context It is more appreciate that dracut just gives a warning message rather than aborting the process.
@jiayi0118 If you run "depmod" before running dracut, would the issue go away ?
Yes it is, but some developers may forget to refresh it.