šŸŽ New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

modprobe Command

Intermediate System Information man(8)

Load and remove kernel modules with dependency handling

šŸ“… Updated: Mar 16, 2026
SYNTAX
modprobe [OPTIONS] MODULE_NAME [PARAMETERS]

What Does modprobe Do?

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.

Options & Flags

OptionDescriptionExample
MODULE Load a kernel module and its dependencies sudo modprobe wireguard
-r MODULE Remove (unload) a module and unused dependencies sudo modprobe -r wireguard
-n Dry run - show what would be done without doing it sudo modprobe -n -v overlay
-v Verbose - show each step being performed sudo modprobe -v bridge
--show-depends Show module dependencies without loading modprobe --show-depends kvm
-c Show current modprobe configuration modprobe -c | grep blacklist
MODULE param=value Load module with specific parameters sudo modprobe bonding mode=4 miimon=100
-b Apply blacklist directives (used by udev) modprobe -b nouveau

Practical Examples

#1 Load a kernel module

Load the WireGuard module and verify it is loaded. modprobe automatically resolves and loads dependencies.
$ sudo modprobe wireguard && lsmod | grep wireguard
Output: wireguard 90112 0

#2 Remove a kernel module

Unload WireGuard and any dependencies no longer in use. Fails if the module is currently in use.
$ sudo modprobe -r wireguard

#3 Load module at boot

Configure a module to load automatically at every boot by creating a .conf file in modules-load.d.
$ echo "wireguard" | sudo tee /etc/modules-load.d/wireguard.conf

#4 Blacklist a module

Prevent a module from loading automatically. Common for replacing open-source GPU drivers with proprietary ones.
$ echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf && sudo update-initramfs -u

#5 Load bonding with parameters

Load the bonding module with LACP (802.3ad) mode for link aggregation with 100ms monitoring.
$ sudo modprobe bonding mode=802.3ad miimon=100 lacp_rate=fast

#6 Show module dependencies

List all modules that would be loaded as dependencies of kvm_intel without actually loading them.
$ modprobe --show-depends kvm_intel

#7 Set persistent module parameters

Set default parameters for a module in a modprobe.d config file. Applied every time the module is loaded.
$ echo "options bonding mode=4 miimon=100" | sudo tee /etc/modprobe.d/bonding.conf

Tips & Best Practices

Rebuild initramfs after blacklist: After blacklisting a module, rebuild initramfs: update-initramfs -u (Debian/Ubuntu) or dracut -f (RHEL/Fedora). Otherwise the module may still load from initramfs.
Use modinfo for parameters: Before loading with parameters, check available options: modinfo -p MODULE_NAME lists all module parameters with descriptions.
modprobe vs insmod: 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.
Debug module loading: If a module fails to load, check dmesg for kernel messages: sudo modprobe module && dmesg | tail -20

Frequently Asked Questions

How do I permanently load a kernel module at boot?
Create a file in /etc/modules-load.d/ with the module name: echo "module_name" | sudo tee /etc/modules-load.d/module.conf. Or add it to /etc/modules.
How do I blacklist a kernel module?
Create /etc/modprobe.d/blacklist-module.conf with "blacklist module_name". Then rebuild initramfs and reboot.
Why does modprobe -r fail?
The module is in use (Used by count > 0). Check with lsmod | grep module. You must stop the service using the module first, or remove dependent modules.
How do I pass parameters to a kernel module?
Temporarily: sudo modprobe module param=value. Permanently: echo "options module param=value" > /etc/modprobe.d/module.conf

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →