I am attempting to install a new version of a kernel module. To this end, I attempted to remove the old module with rmmod mod. This gave no output. When I tried modinfo mod, however, I received the same result I did before calling rmmod. What am I missing?

  • check lsmod before removing and then check again after removing. See if rmmod actually removed the module. – shiftas Mar 26 at 7:18
  • I see in lsmod that the module was removed. However, if modinfo doesn't update, how do I know if the loaded version is the one I want? – dkb Mar 26 at 7:23
  • modinfo fetches the list of known modules by reading the /lib/modules/$(uname -r)/modules.* files, which are usually updated with depmod. Try putting your module in that directory and running depmod -a and see if that helps – shiftas Mar 26 at 7:39

modinfo does not care whether the module is loaded or not - if you give it a module name (instead of a full pathname to a .ko file), it finds the module file on disk based on the current /etc/modprobe.d configuration and reports information on it.

So if you already replaced the old module in /lib/modules/... with a new version before running your first modinfo, it has probably been reporting information on the new version all along! That's why running rmmod did not change anything in the modinfo output.

If you want to know the version of a kernel module that is currently loaded (as opposed to what's on disk), use cat /sys/module/<module_name>/version.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.