modprobe
Add or remove kernel modules
TLDR
Pretend to load a module into the kernel, but don't actually do it
Load a module into the kernel
Remove a module from the kernel
Remove a module and those that depend on it from the kernel
Show a kernel module's dependencies
SYNOPSIS
modprobe [-c config-file] [-d module-dir] [-v] [-n] [-i] [-q] [-b] [-C] module [module parameters...]
modprobe -r [-n] [-i] [-q] module...
PARAMETERS
-c config-file
Use specified configuration file instead of the default.
-d module-dir
Search for modules in the specified directory instead of the default module directory.
-v
Verbose mode. Show what the command is doing.
-n
Dry run. Do everything except actually loading or unloading the module.
-i
Interactive mode. Ask for confirmation before loading or unloading a module.
-q
Quiet mode. Suppress error messages about modules that cannot be found.
-r
Remove a module. This unloads the specified module and its dependencies (if not in use).
-b
Forbid use of aliases. Only use exact module names.
-C
Capture standard output and standard error of modprobe. Use for testing.
module
The name of the module to load or unload.
module parameters...
Parameters to pass to the module when loading.
DESCRIPTION
The modprobe command intelligently adds or removes modules from the Linux kernel.
It searches the module directory (usually /lib/modules/`uname -r`) for modules and their dependencies. Unlike `insmod`, modprobe reads the module's configuration file (usually `modprobe.conf` or files under `modprobe.d/`) to determine dependencies and options. It can load dependencies automatically, and it handles module options specified in the configuration files. When removing modules, it ensures that no other modules depend on the target module. This prevents accidental unloading of critical system components.
It uses the `kmod` project tools to manage modules. Modprobe simplifies module management, making it easier to load and unload kernel modules safely and efficiently. The tool is essential for managing kernel extensions and drivers on Linux systems.
CAVEATS
Loading or unloading modules incorrectly can cause system instability. Be careful when using modprobe with administrative privileges.
MODULE CONFIGURATION
Module configuration files (e.g., under /etc/modprobe.d/) allow you to set module options, create aliases, and blacklist modules. Aliases enable you to load a module by a different name. Blacklisting prevents a module from being loaded automatically.
The format of the configuration files is based on simple directives such as 'options module option1=value1 option2=value2', 'alias alias_name module_name', and 'blacklist module_name'.
These configurations provide a flexible way to control module loading behavior without directly modifying kernel parameters.
HISTORY
modprobe evolved from simpler tools like insmod and rmmod to provide dependency resolution and configuration management. It was initially part of the module-init-tools package. Over time, it has become a standard utility for managing kernel modules on most Linux distributions.