insmod
Insert modules into the Linux kernel
TLDR
Insert a kernel module into the Linux kernel
SYNOPSIS
insmod [options] <module.ko> [<symbol>=<value> ...]
PARAMETERS
-f, --force
Force load even with unresolved symbols or kernel version mismatch
-v, --verbose
Print verbose loading details and symbol table
-q, --quiet
Suppress non-fatal error messages
-x
Do not export module's external symbols
-k
Load kernel symbols only (no module exports); implies -q
-V, --version
Display insmod version and exit
-h, --help
Show usage summary and exit
DESCRIPTION
insmod is a command-line utility for inserting kernel modules into the running Linux kernel without rebooting. Kernel modules (.ko files) provide dynamic extensibility, adding features like device drivers, filesystems, or network protocols.
Unlike modprobe, which automatically resolves dependencies and searches module paths, insmod requires an explicit full path to the module file and manual loading of prerequisites. It performs symbol resolution, inserts the module via init_module syscall, and supports passing parameters as symbol=value pairs at invocation.
Primarily used for testing or when modprobe is unavailable. Execution demands root privileges (sudo). Output includes module name, size, and resolved symbols on success.
Security note: Loading unverified modules risks kernel crashes, privilege escalation, or malware. Verify sources and use signed modules on secure boot systems.
Modern distributions favor modprobe for safety and convenience. insmod remains in kmod package for compatibility.
CAVEATS
Requires root privileges.
Does not auto-resolve dependencies or search paths.
Loading faulty modules can panic kernel.
Deprecated; prefer modprobe.
Secure Boot may block unsigned modules.
EXAMPLE
sudo insmod /lib/modules/$(uname -r)/kernel/drivers/net/veth.ko veth_net_id=42
Loads veth module with parameter.
ERROR HANDLING
Common errors: 'disagrees about version' (mismatch), 'symbol lookup error' (missing deps). Check dmesg for details.
HISTORY
Introduced in early Linux (pre-2.6) with module support. From module-init-tools; evolved into kmod project (2011+). Usage declined with modprobe's dependency handling.


