Linux Command: modprobe
Load and remove kernel modules with dependency handling
The modprobe command intelligently loads and removes Linux kernel modules along with their dependencies. Unlike insmod which loads a single module without dependency resolution, modprobe reads module dependency information from /lib/modules/$(uname -r)/modules.dep and automatically loads all required prerequisite modules. modprobe is the recommended way to manage kernel modules on modern Linux systems. It handles driver loading (network, GPU, storage, USB), filesystem support (overlay, btrfs, zfs), network features (WireGuard, bridge, bonding), and virtualization (kvm, vhost). Modules can be loaded temporarily or configured to load automatically at boot. System administrators use modprobe to enable hardware support, troubleshoot driver issues, blacklist problematic modules, and configure module parameters. It integrates with udev for automatic module loading when hardware is detected.
Syntax
modprobe [OPTIONS] MODULE_NAME [PARAMETERS]Key Options
MODULE— Load a kernel module and its dependencies-r MODULE— Remove (unload) a module and unused dependencies-n— Dry run - show what would be done without doing it-v— Verbose - show each step being performed--show-depends— Show module dependencies without loading-c— Show current modprobe configuration
Examples
Load a kernel module
sudo modprobe wireguard && lsmod | grep wireguardOutput: wireguard 90112 0
Remove a kernel module
sudo modprobe -r wireguardLoad module at boot
echo "wireguard" | sudo tee /etc/modules-load.d/wireguard.confPro Tips
- After blacklisting a module, rebuild initramfs: update-initramfs -u (Debian/Ubuntu) or dracut -f (RHEL/Fedora). Otherwise the module may still load from initramfs.
- Before loading with parameters, check available options: modinfo -p MODULE_NAME lists all module parameters with descriptions.
- Always use modprobe instead of insmod. modprobe handles dependencies automatically and respects blacklists. insmod is a low-level tool that loads a single .ko file.
Learn more: Full modprobe reference →
Related Resources