Single Blog Title

This is a single blog caption
25 May 2017

insmod vs modprobe LINUX

Posted By

Insmod vs Modprobe in LINUX

insmod vs modprobe in LINUX

insmod: Used to load a module
modprobe: Much same way as insmod, but also loads any other modules that are required by the module that you want to load.
Although you’ll still need insmod when loading your own modules from the current directory, because modprobe looks only in the standard installed module directories.

modprobe reads the modules from /lib/modules/$(uname -r)/modules.dep.bin (or without the .binsuffix if the other file is not available). From the same file, dependencies are loaded.

modprobe accepts the name of a .ko file in /lib/modules/$(uname -r) (e.g. nvidia-current for the file dkms/nvidia-current.ko) and aliases (modules.alias.bin). Builtins (modules.alias.bin) are recognized as well, but since these modules are loaded by default, there is not point in modprobing this kind of modules.

insmod on the other hand accepts paths to files. The module does not have to reside in /lib/modules/$(uname -r), but dependencies are not automatically loaded. This is the lower program used by modprobe to load modules.

Other programs related to modules are rmmod and modinfo.

rmmod removes a kernel name based on the name from /proc/modules. This name does not necessarily have to be the same as the one passed to modprobe (for the nvidia-current file, this is nvidia for example).

modinfo accepts a filename, or the filename without .ko suffix in /lib/modules/$(uname -r).

The modprobe utility is worth a quick mention. modprobe, like insmod, loads a mod- ule into the kernel. It differs in that it will look at the module to be loaded to see whether it references any symbols that are not currently defined in the kernel. If any such references are found, modprobe looks for other modules in the current module search path that define the relevant symbols. When modprobe finds those modules (which are needed by the module being loaded), it loads them into the kernel as well. If you use insmod in this situation instead, the command fails with an “unresolved symbols” message left in the system logfile