rmmod Command Cheat Sheet
rmmod removes a module from the Linux Kernel. It is a simple program that does one thing: unload.
Recommended: modprobe -r is usually preferred because it handles dependencies and blacklists.
Synopsis
rmmod [options] modulename
Basic Usage
Unload a module (e.g., a driver).
sudo rmmod e1000e
Handling Dependencies
If the module is in use by another module, rmmod will fail.
rmmod: ERROR: Module e1000e is in use by: other_module
Verbose (-v)
See what is happening.
sudo rmmod -v bluetooth
Force Removal (-f)
Extremely Dangerous. Forces removal even if the module is marked busy or in use. Can crash the kernel (Kernel Panic). Requires the kernel to be compiled with CONFIG_MODULE_FORCE_UNLOAD.
sudo rmmod -f broken_driver
rmmod vs modprobe -r
| Feature | rmmod |
modprobe -r |
|---|---|---|
| Dependency Handling | Fails if used | Removes unused dependencies too |
| Path | Needs name | checks /lib/modules |
| Safety | Low | High |
Notes
- Check loaded modules: Use
lsmodto find the correct name before removing. - Error: "No such file or directory" usually means the module is not loaded (or built-in to kernel).