modprobe

Automatically handle loadable modules

Supplementary instructions

modprobe command is used to intelligently load modules into or remove modules from the kernel.

modprobe can load a specified individual module, or a group of dependent modules. modprobe will decide which modules to load based on the dependencies generated by depmod. If an error occurs during the loading process, modprobe will uninstall the entire set of modules.

grammar

modprobe(options)(parameters)

Options

-a or --all: load all modules;
-c or --show-conf: Display the setting information of all modules;
-d or --debug: use debugging mode;
-l or --list: Display available modules;
-r or --remove: When the module is idle, the module will be automatically uninstalled;
-t or --type: Specify the module type;
-v or --verbose: Display detailed information during execution;
-V or --version: display version information;
-help: Display help.

Parameters

Module name: The name of the module to be loaded or removed.

Example

View the configuration file of modules:

modprobe -c

Here, you can view the configuration file of modules, such as what is the alias of the module, etc. Many lines of information will be printed. For example, one of the lines will be similar to the following:

alias symbol:ip_conntrack_unregister_notifier ip_conntrack

List all modules in the kernel that are or are not mounted:

modprobe -l

Here, we can view the modules we need, and then mount them according to our needs; in fact, the module list read by modprobe -l is located in the /lib/modules/`uname -r` directory; where uname -r is the kernel version. For example, one of the lines of the output is:

/lib/modules/2.6.18-348.6.1.el5/kernel/net/netfilter/xt_statistic.ko

Mount vfat module:

modprobe vfat

Here, use the format modprobe modulename to mount a module. After mounting, you can use lsmod to view the mounted modules. Module names cannot have suffixes. The modules we see through modprobe -l all have .ko or .o suffixes.

Remove loaded modules:

modprobe -r module name

Here, the loaded module is removed, which has the same function as rmmod.