Linux rmmod Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki

Linux rmmod Guide

Complete beginner-friendly guide to rmmod on Linux, covering Arch Linux, CachyOS, and other distributions including removing kernel modules, unloading drivers, and module removal.


Table of Contents

  1. Understanding rmmod
  2. rmmod Basics
  3. Removing Modules
  4. Force Removal
  5. Troubleshooting

Understanding rmmod

What is rmmod?

rmmod (remove module) unloads kernel modules.

Uses:

  • Remove modules: Unload kernel modules
  • Manual removal: Remove modules manually
  • Low-level: Direct module removal
  • Module management: Manage modules

Note: Prefer modprobe -r for automatic dependency handling.


rmmod Basics

Remove Module

Basic usage:

# Remove module
sudo rmmod module-name

# Unloads module

Module Name

Just name:

# Module name only (not path)
sudo rmmod module-name

# Not: module.ko

Removing Modules

Check Dependencies

Verify dependencies:

# Check if in use
lsmod | grep module-name

# Shows if module is loaded and used

Force Removal

Force unload:

# Force removal (dangerous)
sudo rmmod -f module-name

# -f = force (removes even if in use)

Force Removal

Warning

Be careful:

# Force removal can cause issues
# Only use if necessary
sudo rmmod -f module-name

# May cause system instability

Troubleshooting

Module in Use

Check usage:

# Check what's using module
lsmod | grep module-name

# Unload dependent modules first
sudo modprobe -r dependent-module
sudo rmmod module-name

Summary

This guide covered rmmod usage, module removal, and low-level module management for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.