Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

insmod

Load one module file into the kernel (insmod) or remove a loaded module (rmmod) — without dependency handling.

Level
Everyday Linux
Group
Kernel and hardware
Needs root
Yes
Package
kmod
Also called
rmmod

What it does

insmod FILE loads exactly that .ko file; it does not load dependencies or read /etc/modprobe.d. rmmod NAME removes a module that has no users. In daily work use modprobe and modprobe -r instead; insmod is for testing your own or special modules.

How to write it

insmod FILE [PARAMETER=VALUE]...
rmmod [-f] [-s] [-v] MODULE...

Options 7

Most used

insmod

FILE
The path of the module file (.ko, .ko.xz).
PARAMETER=VALUE
Module parameters.

rmmod

-f, --force
Remove even if in use (very dangerous; may crash).
-s, --syslog
Errors to syslog.
-v, --verbose
Verbose.
-V, --version
Show the version.
-h, --help
Show help.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1Load a file

    insmod /lib/modules/$(uname -r)/kernel/fs/fat/fat.ko.xz

    Dependencies must be loaded first by hand.

  2. 2Error because of a missing dependency

    insmod /lib/modules/$(uname -r)/kernel/fs/fat/vfat.ko.xz
    insmod: ERROR: could not insert module …: Unknown symbol in module

    modprobe vfat would load fat automatically.

  3. 3Remove a module

    rmmod vfat

    Must not be in use.

  4. 4Module in use

    rmmod xfs
    rmmod: ERROR: Module xfs is in use

    Unmount the file systems first.

  5. 5With parameters

    insmod ./mydriver.ko debug=1

    Testing your own driver.

  6. 6Find the file of a module

    modinfo -n vfat

    Then insmod that file.

  7. 7Prefer modprobe

    modprobe vfat; modprobe -r vfat

    Handles dependencies and config.

  8. 8Check signature enforcement (Secure Boot)

    mokutil --sb-state

    With Secure Boot, unsigned modules are refused.

  9. 9Log of module loading

    journalctl -k | grep -i module

    Load and taint messages.

  10. 10Check the kernel taint state

    cat /proc/sys/kernel/tainted
    0

    Not 0 = an unsigned, out-of-tree or forced module was loaded.

Exit codes

0 :: Done. 1 :: Error.

Full manual

This page explains the command in simple words. The original manual has every detail.

In your terminal: man 8 insmod