Linux rmmod command

Updated: 11/30/2020 by Computer Hope
rmmod command

On Linux operating systems, the rmmod command removes a module from the Linux kernel.

Description

rmmod is a simple program which removes (unloads) a module from the Linux kernel. In most cases, you will want to use modprobe with the -r option instead, as it is more robust and handles dependencies for you.

Syntax

rmmod [-f] [-w] [-s] [-v] [modulename]

Options

-v, --verbose Verbose mode; print messages about what the program is doing. If this option is not specified, rmmod only prints messages if something goes wrong.
-f, --force Force the operation to occur, no matter what. This option can be extremely dangerous, so use with extreme caution. If specified, this option can remove modules that are currently in use, which are not designed to be removed, or are marked as unsafe.

This option has no effect unless CONFIG_MODULE_FORCE_UNLOAD was set when the kernel was compiled.
-w, --wait Normally, rmmod will refuse to unload modules that are in use. If this option is specified, however, and you attempt to remove a module that is in use, rmmod will isolate it and wait until it is no longer in use. Nothing new can use the module after it's isolated in this way.
-s, --syslog Send errors to the syslog instead of to standard error.
-V, --version Show rmmod's version information, and exit.

Examples

Warning

It is strongly recommended to use modprobe -r, rather than rmmod, to remove your kernel modules, to ensure that removal does not break any dependencies.

sudo rmmod /lib/modules/3.2.0-4-686-pae/kernel/sound/ac97_bus.ko

Remove the kernel module ac97_bus. Any other modules which depend upon this module will cease to function. Only perform this removal if you are certain of what you are doing.

depmod — Generate a list of kernel module dependencies and associated map files.
insmod — Insert a module into the Linux kernel.
lsmod — Show the status of Linux kernel modules.
modinfo — Show information about a Linux kernel module.
modprobe — Add and remove modules from the Linux kernel.