System and processes
The insmod command
Inserts one specific module from its .ko file, without resolving dependencies.
Most useful options
-f, --forceIgnores the module's version and vermagic fields when loading. Very dangerous: it can corrupt memory, crash the system or lose data. The long form exists since kmod 34--force-vermagicRemoves the vermagic string (kernel and compiler versions) if the kernel rejects it. Only in very recent kmod versions--force-modversionRemoves the interface version information if the kernel complains that it does not match. Only in very recent kmod versions-s, --syslogSends errors to syslog instead of standard error. Works since kmod 34; earlier versions ignore it-v, --verbosePrints what it is doing. Only since kmod 34-V, --versionShows the version and exits-h, --helpShows the help and exitsCopy-ready examples
$ sudo insmod ./driver.koinserts the module from that file, without searching /lib/modules.$ sudo insmod -v ./driver.kothe same, showing each step. Requires kmod 34 or later.$ sudo insmod ./driver.ko debug=1passes a parameter to the module. The parameters it accepts are shown with modinfo -p.$ sudo insmod -f ./driver.koforces the load, ignoring the version checks. Warning: only for a module you built yourself for this kernel, because it can crash the system.You can try them in the browser terminal: it does not touch your computer.
Common errors
| Message | Cause | Fix |
|---|---|---|
| insmod: ERROR: missing filename. | It was run without the path to the .ko file. | Pass the module path: sudo insmod ./driver.ko. |
| insmod: ERROR: this tool does not support loading from stdin! | The file name was '-', so it tried to read the module from standard input. | Give the path of a real .ko file. |
| insmod: ERROR: could not insert module ./driver.ko: <motivo> | The kernel rejected the module. The specific reason, such as an unresolved symbol or a version mismatch, appears after the colon and in dmesg. | Check dmesg right after the failure, install the missing dependency, or use modprobe, which resolves it. |
Typical mistakes
- It does not resolve dependencies: if the module uses symbols from another one that is not loaded, it fails. That is what modprobe is for.
- The error message is terse. The real detail is usually in dmesg, which the insmod manual recommends checking.
- With -f or --force-vermagic you can load a module that is incompatible with the kernel. It is a path to serious problems, not a fix for a loading error.
Differences from similar commands
FAQ
When does it make sense to use insmod instead of modprobe?
When you want to insert exactly one specific file, for example to test a module you just built. For everyday use, modprobe.
Where do I look for the reason when insmod fails?
In dmesg: the kernel writes the detail there, while insmod summarises it in one line. Check it right after the failure.
Do I need administrator rights?
Yes. Inserting code into the kernel requires privileges, which is why it is run with sudo.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course