modprobe Command in Linux: Load and Manage Kernel Modules

By 

•

Updated on

•

11 min read

Gold hexagonal tiles with terminal and gear icons and the label modprobe command

A network card that does not show up, a driver that needs a different parameter, or an open-source graphics driver that conflicts with the one you want to install: all of these problems lead to the same tool.

modprobe is a command-line utility that adds and removes modules from the Linux kernel. It loads a module by name, automatically loads any modules it depends on, and applies the options defined in /etc/modprobe.d/.

This guide explains how to use modprobe to load, unload, reload, blacklist, and configure kernel modules.

Kernel Modules

The Linux kernel is the core component of the Linux operating system. It manages the system’s resources and acts as a bridge between your computer’s hardware and software.

The Linux kernel has a modular design. A kernel module, often referred to as a driver, is a piece of code that extends the kernel’s functionality. Modules are either compiled as loadable modules or built into the kernel. Loadable modules can be loaded and unloaded in the running kernel on request, without the need to reboot the system.

Generally, modules are loaded on demand by udev (the device manager). However, sometimes you may need to fine-tune how modules are loaded. For example, you may need to load a module with additional parameters or prevent a module from loading automatically.

You can manually load a module into the kernel using the modprobe command, or automatically at boot time using /etc/modules-load.d/*.conf files. modprobe is part of kmod, a package that implements multiple utilities for managing Linux kernel modules.

Syntax

The general syntax for the modprobe command is:

txt
modprobe [OPTIONS] module_name [parameter=value ...]

Common options:

  • -r - Remove (unload) a module from the kernel
  • -a - Treat every argument as a module name, so you can load several modules at once
  • -v - Verbose mode, show each step as modules are loaded or unloaded
  • -n - Dry run, do everything except actually load or unload the module
  • -c - Show the current modprobe configuration
  • --show-depends - List the dependencies of a module without loading it
  • -q - Quiet mode; suppress “module not found” messages, but still return a non-zero exit status
  • --first-time - Fail if the module is already loaded (useful in scripts)

Loading Kernel Modules

Kernel modules are stored in the /lib/modules/<kernel_version> directory. You can find the version of the running kernel with the uname -r command.

Only users with administrative privileges can manage kernel modules.

To load a module, invoke modprobe followed by the module name:

Terminal
sudo modprobe module_name

modprobe loads the given module and any dependencies it requires. By default, everything after the module name is treated as a module parameter. To load several modules in one command, use the -a option:

Terminal
sudo modprobe -a overlay br_netfilter

Use the lsmod command to confirm that the module is loaded:

Terminal
lsmod | grep module_name

To see exactly what modprobe does when loading a module, add the -v (verbose) flag:

Terminal
sudo modprobe -v module_name

To preview the actions modprobe would take without loading a module, use the -n (dry run) option together with -v:

Terminal
sudo modprobe -n -v module_name

A dry run does not ask the kernel to load the module, so it cannot verify signatures, kernel compatibility, or parameter values.

Loading Modules with Parameters

Some modules accept parameters that change their behavior. To load a module with parameters, pass them as parameter=value pairs after the module name:

Terminal
sudo modprobe module_name parameter=value

The command accepts multiple parameter=value pairs separated by spaces.

To see what parameters a module supports, use modinfo:

Terminal
modinfo -p module_name

Making Parameters Persistent

To set module parameters that apply every time the module is loaded, create a configuration file in /etc/modprobe.d/. Files must end with .conf and can have any name:

/etc/modprobe.d/module_name.confsh
options module_name parameter=value

For example, to always load the snd_hda_intel sound module with power_save=1:

/etc/modprobe.d/snd_hda_intel.confsh
options snd_hda_intel power_save=1

The settings in /etc/modprobe.d/ are read by modprobe every time the module is loaded, whether manually or at boot.

Loading Modules at Boot

To load a module automatically at boot time, add its name to a file in /etc/modules-load.d/. Each file lists one module name per line:

/etc/modules-load.d/modules.confsh
br_netfilter
vhost_net

These files are read by systemd-modules-load during startup. They only specify which modules to load; for parameters, use a separate file in /etc/modprobe.d/ as described above.

Removing Kernel Modules

To unload a module, invoke modprobe with the -r option followed by the module name:

Terminal
sudo modprobe -r module_name

modprobe will also remove any module dependencies that are no longer in use.

When invoked with -r, the command accepts multiple modules as arguments:

Terminal
sudo modprobe -r module_name1 module_name2
Tip
You can also use the rmmod command to unload a module from the Linux kernel. The difference is that rmmod only removes the specified module, while modprobe -r also removes unused dependencies.

Reloading a Module

modprobe has no reload option. To reload a module, for example after changing its options in /etc/modprobe.d/, unload it and load it again:

Terminal
sudo modprobe -r module_name && sudo modprobe module_name

The && operator runs the second command only if the module was unloaded successfully. If the module is in use, modprobe -r fails and the module stays loaded with its old settings.

Warning
Reloading a network driver drops the connection on that interface. Do not reload it over SSH unless you have another way to reach the machine.

Blacklisting Modules

If you want to prevent a kernel module from loading at boot time, you can blacklist it. Create a .conf file inside the /etc/modprobe.d/ directory:

/etc/modprobe.d/blacklist.confsh
blacklist module_name

If you want to blacklist multiple modules, add each one on a new line, or create separate .conf files.

To check how modprobe handles the module after the blacklist is in place, run a dry run with verbose output and -b so blacklist rules are applied to the module name:

Terminal
sudo modprobe -n -v -b module_name

After blacklisting a module, rebuild the initramfs so the change takes effect on the next boot:

Terminal
sudo update-initramfs -u

On Fedora, RHEL, and Derivatives, use dracut instead:

Terminal
sudo dracut --force
Warning
Blacklisting makes modprobe ignore a module’s device aliases. A blacklisted module can still be loaded manually with sudo modprobe module_name or pulled in as a dependency of another module. To block normal loading through modprobe, add install module_name /bin/false to the blacklist file. This override can be bypassed with modprobe --ignore-install or direct loading with insmod.

Listing and Inspecting Modules

To list all currently loaded modules, use lsmod :

Terminal
lsmod

To view detailed information about a specific module (including its description, author, license, parameters, and file path), use modinfo:

Terminal
modinfo module_name

For example, to inspect the br_netfilter module:

Terminal
modinfo br_netfilter
output
filename:       /lib/modules/7.0.0-31-generic/kernel/net/bridge/br_netfilter.ko.zst
description:    Linux ethernet netfilter firewall bridge
author:         Bart De Schuymer <bdschuym@pandora.be>
author:         Lennert Buytenhek <buytenh@gnu.org>
license:        GPL
srcversion:     0FA39ABF64A385B58F6871C
depends:        bridge
intree:         Y
name:           br_netfilter
vermagic:       7.0.0-31-generic SMP preempt mod_unload modversions aarch64
...

The filename line shows where the module lives on disk. The .ko.zst extension means the module is compressed with Zstandard, which is the default on current Ubuntu and Fedora releases. The depends line tells you that modprobe will load the bridge module first.

To list only the parameters a module accepts:

Terminal
modinfo -p module_name

modprobe does not have an option for listing modules. To see all modules that are available for the running kernel, including the ones that are not loaded, search the modules directory:

Terminal
find /lib/modules/$(uname -r) -type f -name '*.ko*'

Pipe the output to grep to narrow it down, for example | grep -i wifi.

Practical Examples

Loading Modules for Kubernetes

The required modules depend on the node’s container runtime and network plugin. For a node using OverlayFS storage and bridge networking that needs iptables filtering, load both overlay and br_netfilter:

Terminal
sudo modprobe -a overlay br_netfilter

To load them on every boot, list them in a file under /etc/modules-load.d/:

/etc/modules-load.d/k8s.confsh
overlay
br_netfilter

Blacklisting the Nouveau Driver

When installing the proprietary NVIDIA driver, you need to blacklist the open-source nouveau driver to prevent conflicts:

/etc/modprobe.d/blacklist-nouveau.confsh
blacklist nouveau
options nouveau modeset=0

Then rebuild the initramfs and reboot:

Terminal
sudo update-initramfs -u
sudo reboot

Checking Module Dependencies Before Loading

To see what dependencies a module requires without loading anything:

Terminal
modprobe --show-depends br_netfilter
output
insmod /lib/modules/7.0.0-31-generic/kernel/net/llc/llc.ko.zst
insmod /lib/modules/7.0.0-31-generic/kernel/net/802/stp.ko.zst
insmod /lib/modules/7.0.0-31-generic/kernel/net/bridge/bridge.ko.zst
insmod /lib/modules/7.0.0-31-generic/kernel/net/bridge/br_netfilter.ko.zst

Each line is a module that modprobe would insert, in the order it would insert them. Here, br_netfilter needs bridge, which in turn needs stp and llc. This is useful for debugging when a module fails to load due to missing dependencies.

Quick Reference

TaskCommand
Load a modulesudo modprobe module_name
Load with parameterssudo modprobe module_name param=value
Load several modulessudo modprobe -a module1 module2
Unload a modulesudo modprobe -r module_name
Reload a modulesudo modprobe -r module_name && sudo modprobe module_name
Preview loading a modulesudo modprobe -n -v module_name
Show module dependenciesmodprobe --show-depends module_name
Show modprobe configurationmodprobe -c
List loaded moduleslsmod
List available modulesfind /lib/modules/$(uname -r) -type f -name '*.ko*'
View module infomodinfo module_name
Blacklist a moduleecho "blacklist module_name" | sudo tee /etc/modprobe.d/blacklist-module_name.conf
Load at bootAdd module name to /etc/modules-load.d/*.conf

Troubleshooting

“modprobe: FATAL: Module module_name not found in directory /lib/modules/…”
The module does not exist for the running kernel version. Verify you are looking for the correct name with find /lib/modules/$(uname -r) -name '*.ko*' | grep keyword. On Ubuntu, you may need to install the linux-modules-extra-$(uname -r) package.

“modprobe: ERROR: could not insert ‘module_name’: Operation not permitted”
Loading modules requires root privileges, so first make sure you ran the command with sudo. Inside a Docker or Podman container, the error appears even as root, because containers do not get the CAP_SYS_MODULE capability. Load the module on the host instead. The same error appears when the kernel.modules_disabled sysctl is set to 1; this setting cannot be turned off until the next reboot.

“modprobe: ERROR: could not insert ‘module_name’: Key was rejected by service”
The kernel could not verify the module’s signature. Secure Boot or a kernel configured to enforce module signing can cause this error. Check the signing identity with modinfo -F signer module_name. On Ubuntu, if the module was signed with the key corresponding to /var/lib/shim-signed/mok/MOK.der, enroll that certificate with sudo mokutil --import /var/lib/shim-signed/mok/MOK.der, then reboot and confirm enrollment in the MOK manager. If the module is unsigned, sign it or rebuild it through DKMS before enrolling the matching certificate. If it uses a different signing key, enroll that key’s certificate instead.

“modprobe: command not found”
On minimal systems and container images, the kmod package may not be installed. Install it with sudo apt install kmod on Ubuntu, Debian, and Derivatives, or sudo dnf install kmod on Fedora, RHEL, and Derivatives. On Debian, the error also appears after switching to root with plain su, because /usr/sbin is not added to PATH. Use su - instead.

“modprobe: FATAL: Module module_name is in use.”
The module cannot be unloaded because other modules or processes depend on it. Run lsmod | grep module_name to see what is using it. Unload the dependent modules first, or stop the processes that hold references to the module.

Module loads manually but does not persist across reboot
modprobe only loads a module for the current session. To make it persistent, add the module name to a file in /etc/modules-load.d/ as described in the Loading Modules at Boot section.

Module is blacklisted but still loads
A blacklist entry prevents automatic loading through device aliases, but it does not block manual loading by name or loading as a dependency. Add install module_name /bin/false to the blacklist file to block normal loading through modprobe, then rebuild the initramfs. As explained in Blacklisting Modules , --ignore-install and insmod can bypass this override.

FAQ

What is the difference between modprobe and insmod?
insmod loads a single module file by its full path and does not resolve dependencies. modprobe loads a module by name, automatically resolves and loads all dependencies, and reads configuration from /etc/modprobe.d/. In practice, modprobe is almost always the better choice.

How do I check if a kernel module is loaded?
Run lsmod | grep module_name. If the command produces output, the module is loaded. You can also check /proc/modules directly.

How do I permanently load a module at boot?
Add the module name (one per line) to a .conf file in /etc/modules-load.d/. For module parameters, create a separate file in /etc/modprobe.d/ with options module_name parameter=value.

How do I undo a blacklist?
Remove or comment out the blacklist module_name line and any matching install module_name /bin/false line in /etc/modprobe.d/. Then rebuild the initramfs with sudo update-initramfs -u (or sudo dracut --force on Fedora/RHEL) and reboot.

Conclusion

The modprobe command loads and unloads kernel modules along with their dependencies, while /etc/modprobe.d/ and /etc/modules-load.d/ handle persistent configuration and boot-time loading. For related commands, see lsmod for listing loaded modules and rmmod for removing individual modules.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 1000+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page