Unload kernel modules at system runtime

You can use the modprobe command to find and unload a kernel module at system runtime from the currently loaded kernel.

Before you begin

  • You have root permissions on the system.
  • The kmod package is installed.

About this task

Warning

You must not unload the kernel modules that are active in the running system. This can lead to an unstable or non-operational system.

Procedure

  1. List all the loaded kernel modules:
    # lsmod
  2. Select the kernel module to unload.

    If a kernel module has dependencies, unload those before unloading the kernel module.

  3. Unload the relevant kernel module:
    # modprobe -r <pass:quotes[MODULE_NAME]>

    When entering the name of a kernel module, do not append the .ko.xz extension to the end of the name. Kernel module names do not have extensions; their corresponding files do.

    Important

    Unloading inactive kernel modules will not disable modules configured for automatic loading at boot. These modules will be automatically loaded again when the system restarts.

Results

  • Optionally, verify the relevant module is unloaded:
    $ lsmod | grep <pass:quotes[MODULE_NAME]>

    If the module is unloaded successfully, this command does not display any output.