Show Table of Contents
31.4. Unloading a Module
You can unload a kernel module by running
modprobe -r <module_name> as root. For example, assuming that the wacom module is already loaded into the kernel, you can unload it by running:
~]# modprobe -r wacom
However, this command will fail if a process is using:
- the
wacommodule, - a module that
wacomdirectly depends on, or, - any module that
wacom—through the dependency tree—depends on indirectly.
See Section 31.1, “Listing Currently-Loaded Modules” for more information about using
lsmod to obtain the names of the modules which are preventing you from unloading a certain module.
For example, if you want to unload the
firewire_ohci module (because you believe there is a bug in it that is affecting system stability, for example), your terminal session might look similar to this:
~]#modinfo -F depends firewire_ohcidepends: firewire-core ~]#modinfo -F depends firewire_coredepends: crc-itu-t ~]#modinfo -F depends crc-itu-tdepends:
You have figured out the dependency tree (which does not branch in this example) for the loaded Firewire modules:
firewire_ohci depends on firewire_core, which itself depends on crc-itu-t.
You can unload
firewire_ohci using the modprobe -v -r <module_name> command, where -r is short for --remove and -v for --verbose:
~]# modprobe -r -v firewire_ohci
rmmod /lib/modules/2.6.32-71.el6.x86_64/kernel/drivers/firewire/firewire-ohci.ko
rmmod /lib/modules/2.6.32-71.el6.x86_64/kernel/drivers/firewire/firewire-core.ko
rmmod /lib/modules/2.6.32-71.el6.x86_64/kernel/lib/crc-itu-t.ko
The output shows that modules are unloaded in the reverse order that they are loaded, given that no processes depend on any of the modules being unloaded.
Important
Although the
rmmod command can be used to unload kernel modules, it is recommended to use modprobe -r instead.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.