Load kernel modules

You can load any module that has been compiled and installed to a /lib/modules subdirectory using two commands: insmod and modprobe. Although Linux does a good job of loading modules automatically, you can use these two commands to load a module to use some feature temporarily (such as loading a module to support a special file system) or for testing new modules.

The syntax of the insmod command is very simple; you just type insmod, followed by the module filename. For example, to load the md5 module, we can use the following command:

linux insmod command

Sometimes modules depend on other modules. In these cases, if you attempt to load a module that depends on others that aren’t loaded, insmod will fail. However, the modprobe command automatically loads any depended-on modules. The syntax of the command is:

modprobe MODULE_NAME

Here is an example:

linux modprobe command

With modprobe, you specify a module by its module name rather than the module filename. You can pass a few options to modify modprobe’s behavior. For example, to perform checks and all other operations except the actual module insertions, you can use the -n option. Combined with the -v (verbose) option, this option is useful for debugging problems:

linux modprobe check

The –show-depends option shows all the modules on which the specified module depends:

linux modprobe show dependencies

The -r option removes the specified module and any on which it depends (depended-on modules are not removed if they’re in use).

linux modprobe remove module

modprobe loads modules temporarily.To permanently add the module to your system, add the modprobe command line to one of the startup scripts.

Subscribe to our Newsletter

Like us on Facebook

top
Geek University 2019