Linux – Why does modinfo say “could not find module”, yet lsmod claims the module is loaded

kernelkernel-moduleslinux

According to the man page of lsmod the command shows “what kernel modules are currently loaded”.

I wrote a script that uses modinfo to show what kernel object (.ko) files are actually in use:

#!/bin/sh
for i in `lsmod | awk '{print $1}' | sed -n '1!p'`; do
echo "###############################$i###############################"
echo ""
modinfo $i
echo ""
echo ""
done

Now I found out that modinfo nvidia shows the following output:

ERROR: modinfo: could not find module nvidia

Do you guys have any explanation for this?

Best Answer

Your nvidia module is perfectly loaded and working. The problem lies in modinfo.

modinfo fetch the list of known modules by reading the /lib/modules/$(uname -r)/modules.* files, which are usually updated with depmod.

If depmod -a has not been run after installing the nvidia module, then modinfo does not knows about it. This does not prevent anybody from loading the module with insmod and lsmod will show it just fine if loaded.

Related Question