Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there any differences between insmod and modprobe?

share|improve this question
up vote 16 down vote accepted

Per man insmod:

Most users will want to use modprobe instead, which is more clever and can handle module dependencies.

share|improve this answer
    
ah sorry, missed that line. – NES Jan 4 '11 at 20:52

modprobe reads the modules from /lib/modules/$(uname -r)/modules.dep.bin (or without the .bin suffix 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).

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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