Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

rmmod asks the running Linux kernel to remove a loaded, unloadable module. Its basic form is sudo rmmod MODULE_NAME. It does not uninstall the module or delete its file. Before using it, identify the exact module and check what depends on or is using it; for routine administration, sudo modprobe -r MODULE_NAME is usually preferable because it can also remove unused dependencies.

What rmmod does—and does not do

A kernel module is code the kernel can load while running. Modules provide functions such as hardware drivers, filesystems, network protocols, virtualization, and security features. rmmod requests removal of one or more modules from the currently running kernel.

Removal is not uninstallation: the module’s file and package remain on disk. A module that is built into the kernel is not a separately loaded module and cannot be removed with rmmod. Even a loaded module may not be removable if the kernel lacks unloading support, another module depends on it, or a device, filesystem, service, or other kernel subsystem is using it. The rmmod manual documents the command’s behavior; exact behavior can vary with kernel configuration and the installed kmod version.

Check the module before removing it

Use the kernel module name, not necessarily the product name of the hardware or the module file’s name. Do not append extensions such as .ko, .ko.xz, or .ko.zst.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Check which kernel is running: uname -r. Module availability is associated with the running kernel.

  2. List loaded modules: lsmod. To search for a likely name, use lsmod | grep '^MODULE_NAME[[:space:]]', replacing MODULE_NAME with the exact name.

  3. Inspect metadata and dependencies: modinfo MODULE_NAME. The output may include a filename, description, version, license, and dependency information. To show dependency files and related operations without executing the displayed install commands, use modprobe --show-depends MODULE_NAME.

  4. Stop the service or workload that uses the module if appropriate. The relevant command depends on the subsystem; for a service managed by systemd, it may be sudo systemctl stop SERVICE_NAME. Check the impact first: removing a network driver can cut off a remote session, while a storage or filesystem module may support active mounts.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A module can be in use without an obvious user-space process. The reference may come from another module, an active interface, a mounted filesystem, a device, or a kernel subsystem. Dependency information is useful, but it does not by itself prove that removal will be safe.

Remove a module with rmmod

The syntax is rmmod [OPTIONS] MODULE_NAME. For example, to request removal of a module named dummy:

sudo rmmod dummy

Root privileges are normally required. To request removal of more than one module, provide multiple names:

sudo rmmod MODULE_ONE MODULE_TWO

The command handles the names one at a time. If one removal fails, it reports the error and continues processing later names; a missing module also produces an error. Check the result rather than assuming every requested removal succeeded.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For operational messages, use verbose mode:

sudo rmmod --verbose MODULE_NAME

A successful invocation commonly returns to the shell without printing anything. Verify whether the module remains loaded:

lsmod | grep '^MODULE_NAME[[:space:]]'

No matching line generally means it is no longer listed as loaded. Also check the command’s exit status if scripting or diagnosing a failure; output format can vary across systems.

When to use modprobe -r instead

rmmod makes the direct removal request. modprobe -r uses module dependency information and can also try to remove modules that become unused dependencies. That makes it the generally preferred choice for routine dependency-aware administration, while rmmod is useful when you specifically need the direct removal utility.

sudo modprobe -r MODULE_NAME

If a module is temporarily busy, current kmod documentation provides a wait option for modprobe -r:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo modprobe -r --wait 5000 MODULE_NAME

The value is a maximum wait time in milliseconds. This asks modprobe to retry removal while the module is busy; it does not resolve a persistent dependency or make it safe to interrupt an active workload. The available options are documented in the modprobe manual. Do not assume this wait option is an rmmod option.

Common errors and what to do

“Module is in use”

Do not jump straight to force removal. Find and stop the relevant service or workload, deactivate the interface or device only if safe, and inspect module dependencies. Then try sudo modprobe -r MODULE_NAME; use its wait option only if the busy state may clear shortly. If the module supports a critical path such as the active network connection, root storage, display, or input device, arrange another way to recover before proceeding.

“Module not found”

Check for a misspelling, a filename supplied instead of the module name, or a module that is not currently loaded. A module can also be built into the kernel, absent from the installed module package, or available only for another kernel version. Try:

lsmod
modinfo MODULE_NAME
find "/lib/modules/$(uname -r)" -type f -iname '*MODULE_NAME*'

Finding a file does not establish that it is loaded or removable. Red Hat’s kernel administration guide demonstrates using module names without the file extension.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

“Operation not permitted”

First make sure the command is run with elevated privileges, for example sudo rmmod MODULE_NAME. If it still fails, the system may be restricting module management through a container, namespace, security policy, or kernel configuration. Containers generally cannot remove modules from the host kernel; perform host module management on the host rather than weakening security controls casually.

The module is built into the kernel

A built-in driver is part of the kernel image, not a separately unloadable module. Removing a file from disk will not remove it from the running kernel. Depending on the driver, alternatives may include booting a differently configured kernel, using a supported kernel parameter, building or installing a kernel without that driver, or using a suitable device binding or driver-override mechanism.

The module loads again after removal

A device manager, service, dependent module, or configuration may request it again. Unloading is temporary. To investigate persistent loading behavior, review the module configuration and the modprobe.d documentation. Directives such as blacklist or install have context-dependent effects; do not apply a generic configuration without checking how the device, distribution, and boot process load the module.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why force removal is a last resort

Do not use this as the normal fix for “module is in use.” The command is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo rmmod --force MODULE_NAME

The rmmod manual warns that force removal is extremely dangerous. It has no effect unless the kernel was compiled with CONFIG_MODULE_FORCE_UNLOAD; when enabled, it can remove a module despite conditions that normally prevent unloading. That can cause a crash, data corruption, hardware failure, or system instability, and it does not fix the underlying dependency or active workload. Restrict any such experiment to a controlled development system, disposable virtual machine, or maintenance setting with a recovery path.

Reload a module or check kernel messages

If removal was part of a test and the module is still available for the running kernel, reload it with:

sudo modprobe MODULE_NAME

Reloading may not restore the prior hardware or service state; some changes require reinitializing the device or rebooting. For clues about a failed removal or subsequent behavior, inspect recent kernel messages with sudo dmesg | tail -n 50, or on a system using the systemd journal, sudo journalctl -k -n 50.

Related module commands

Command Purpose
lsmod Lists modules currently loaded in the kernel.
modinfo MODULE_NAME Displays available metadata about a module.
rmmod MODULE_NAME Requests direct removal of a loaded module.
modprobe -r MODULE_NAME Requests removal with dependency-aware handling.
modprobe MODULE_NAME Loads a module using modprobe’s dependency and configuration handling.
insmod FILE Inserts a module from a specified file; unlike modprobe, it does not handle dependencies for you.
depmod Generates module dependency and map files used by module tools.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.