Docs / Linux Basics / How to Manage Kernel Modules with modprobe

How to Manage Kernel Modules with modprobe

By Admin · Mar 15, 2026 · Updated Apr 24, 2026 · 164 views · 3 min read

Kernel modules are pieces of code that can be loaded into the Linux kernel on demand, adding support for hardware, filesystems, network protocols, and more — without rebooting. The modprobe command is the primary tool for managing these modules.

Understanding Kernel Modules

# List all currently loaded modules
lsmod

# The output shows:
# Module     Size  Used by
# nf_tables  32768  2 nf_tables_inet
# ip_tables  28672  0
# ext4      98304   1

# Size: Memory used by the module
# Used by: Count and list of dependent modules

Loading Modules

# Load a module (and its dependencies automatically)
sudo modprobe vhost_net       # Virtio networking
sudo modprobe br_netfilter    # Bridge netfilter (needed for Docker)
sudo modprobe ip_vs           # IPVS load balancing

# Load with parameters
sudo modprobe bonding mode=4 miimon=100

# Verify module is loaded
lsmod | grep vhost_net

Removing Modules

# Unload a module
sudo modprobe -r vhost_net

# Force removal (use with caution)
sudo modprobe -r -f module_name

# Cannot remove a module that is in use
# Check what is using it first:
lsmod | grep module_name

Getting Module Information

# Show module details
modinfo ext4

# Key fields:
# filename:    Path to the module file
# description: What the module does
# author:      Who wrote it
# license:     GPL, proprietary, etc.
# depends:     Other modules this one requires
# parm:        Configurable parameters

# Show only parameters
modinfo -p ext4

# Find a module by alias
modprobe -c | grep "alias.*usb"

Making Module Loading Persistent

# Load a module at boot
echo "br_netfilter" | sudo tee /etc/modules-load.d/bridge.conf

# Load multiple modules at boot
cat << EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
overlay
ip_vs
ip_vs_rr
ip_vs_wrr
ip_vs_sh
nf_conntrack
EOF

Blacklisting Modules

# Prevent a module from loading (e.g., disable IPv6, disable Nouveau)
echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf
echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf

# Rebuild initramfs after blacklisting
sudo update-initramfs -u    # Ubuntu/Debian
sudo dracut --force         # RHEL/Rocky

# Verify module is not loaded after reboot
lsmod | grep nouveau

Setting Module Parameters

# Set parameters at load time
sudo modprobe tcp_bbr

# Set parameters permanently
echo "options bonding mode=4 miimon=100" | sudo tee /etc/modprobe.d/bonding.conf

# View current parameter values
cat /sys/module/tcp_bbr/parameters/*
# Or for a specific parameter:
cat /sys/module/nf_conntrack/parameters/hashsize

Common Server Modules

# Docker/Kubernetes requirements
sudo modprobe overlay          # OverlayFS for container storage
sudo modprobe br_netfilter     # Bridge netfilter for container networking

# Performance modules
sudo modprobe tcp_bbr          # Google BBR congestion control
echo "net.core.default_qdisc=fq" | sudo tee -a /etc/sysctl.d/99-bbr.conf
echo "net.ipv4.tcp_congestion_control=bbr" | sudo tee -a /etc/sysctl.d/99-bbr.conf

# WireGuard VPN
sudo modprobe wireguard

Troubleshooting

# Module fails to load
# Check dmesg for error messages
dmesg | tail -20

# Verify module exists
find /lib/modules/$(uname -r) -name "*.ko*" | grep module_name

# Rebuild module dependencies
sudo depmod -a

# If module is missing, you may need to install kernel extras
sudo apt install linux-modules-extra-$(uname -r)

Was this article helpful?