insmod vs modprobe: How Kernel Modules Get Loaded
insmod loads one .ko by path, and modprobe loads by name with dependencies from modules.dep and modprobe.d. See how each works, what fails and which to use.

Two commands, one system call
Linux gives you two everyday tools to load a kernel module, insmod and modprobe, and they differ in how much they do for you. Both are part of the kmod package, and both end up calling the same kernel interface: finit_module(2), which passes an open file descriptor for the .ko file and a parameter string to the kernel. The difference is everything that happens before that call.
This post compares them on the dimensions that matter, shows what each does with a real module, explains the dependency file modprobe depends on, and ends with a decision table. The behavior is that of kmod 33 on Linux 6.12 LTS, as described in the insmod(8) and modprobe(8) manual pages.
insmod: load exactly this file
insmod takes a path to a module file and loads it. It does nothing else: no dependency resolution, no search path, no configuration files.
sudo insmod ./hello.ko
sudo insmod ./params.ko count=3 greeting=hiThe first loads the file in the current directory. The second passes parameters, which insmod forwards as one string to the kernel. If the module needs symbols from another module that is not loaded, the load fails, and the error is not very informative:
insmod: ERROR: could not insert module ./mydrv.ko: Unknown symbol in moduleThe kernel log has the specifics:
sudo dmesg | tail -n 2mydrv: Unknown symbol helper_register (err -2)
mydrv: Unknown symbol helper_unregister (err -2)The missing symbols come from a module (helper.ko here) that must be loaded first. insmod expects you to know the order and load it yourself. That makes it the right tool for exactly one job: loading a module you just built, from a path, without installing it anywhere.
modprobe: load by name, with dependencies
modprobe takes a module name, not a path, and does the bookkeeping:
sudo modprobe dummy
sudo modprobe dummy numdummies=2To find the file for a name, it reads a database generated by depmod, in /lib/modules/<release>/:
| File | Content |
|---|---|
modules.dep | For each module path, the modules it depends on |
modules.alias | Alias patterns, such as pci:v00008086d00001502sv*, mapped to module names |
modules.symbols | Which module exports which symbol |
modules.softdep | Soft dependencies, loaded before or after if available |
modules.builtin | Modules compiled into this kernel |
A line in modules.dep looks like this, with the dependency after the colon:
kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko: kernel/drivers/ptp/ptp.komodprobe e1000e therefore loads ptp.ko first, then e1000e.ko, in that order, so the second finds the symbols it needs. You can see the plan without executing it:
modprobe --show-depends e1000einsmod /lib/modules/6.12.9-amd64/kernel/drivers/ptp/ptp.ko
insmod /lib/modules/6.12.9-amd64/kernel/drivers/net/ethernet/intel/e1000e/e1000e.koThe output shows the insmod commands that modprobe would run, which is also a neat way to learn what insmod is. For a dry run with verbose output, modprobe -n -v e1000e shows the same list without loading anything. Your module names and paths will differ.
What modprobe adds
Beyond dependencies, modprobe reads configuration from /etc/modprobe.d/*.conf and /lib/modprobe.d/*.conf. That is where three important mechanisms live.
Options. options e1000e InterruptThrottleRate=3000 in a .conf file passes parameters on every load, whoever triggers it. The next-but-one post covers this.
Aliases. The kernel and udev request modules by alias when hardware appears: a device with a matching PCI ID triggers modprobe pci:v..., and modules.alias maps it to a module name. insmod does not know about aliases.
Blacklists and install commands. blacklist stops alias-based auto-loading of a module, and install replaces the load with a command of your choice.
modprobe also removes: modprobe -r name unloads a module and any modules that were loaded only as its dependencies and are now unused. rmmod is the counterpart of insmod, removing exactly the named module and failing if it is in use.
The database must be current
The dependency data is only as fresh as the last depmod run. When you install a module with make modules_install or from a package, depmod -a runs and updates the files. If you copy a .ko into /lib/modules/<release>/ by hand, modprobe will not find it until you run depmod yourself:
sudo cp hello.ko /lib/modules/"$(uname -r)"/updates/
sudo depmod -a
sudo modprobe helloIf you skip depmod, you get:
modprobe: FATAL: Module hello not found in directory /lib/modules/6.12.9-amd64Build-system installs place modules under updates/ or extra/, and the default search order puts updates/ ahead of the kernel's own copy, so an updated module overrides the stock one.
Seeing the system call
strace shows that both commands reach the same place:
sudo strace -e trace=finit_module,init_module insmod ./hello.kofinit_module(3, "", 0) = 0
+++ exited with 0 +++The 3 is the file descriptor of the opened .ko, the empty string is the parameter list and the zero is flags. Running modprobe hello under strace prints the same call after reading the database and opening the file.
Decision table
| Situation | Use | Reason |
|---|---|---|
| Testing a module you just built | insmod ./x.ko | No install step, path is explicit |
| Loading an installed module or a driver | modprobe name | Resolves dependencies, honors options |
| Module needs other modules | modprobe | insmod fails with unknown symbols |
| Script that must work on any machine | modprobe | Does not depend on file locations |
| Removing a module | rmmod name or modprobe -r name | The second also removes unused dependencies |
| Debugging why a module does not load | modprobe -v, then dmesg | Shows the insmod commands it would run |
A reasonable workflow for development uses both: insmod while you iterate on a module in your own directory, and modprobe once you install it, because that is how the system loads it at boot and when hardware appears.
Soft dependencies and module aliases in practice
Real systems use two features of modprobe that insmod cannot imitate. A soft dependency, declared in a configuration line such as softdep nvidia pre: ipmi_devintf, asks modprobe to try loading another module before or after this one without failing if it is missing. It suits cases where a driver works without the helper but works better with it. An alias such as alias eth0 e1000e maps a convenient name to a module, which is how old network setups named drivers and how udev maps a hardware ID to a driver when a device appears.
Hotplug is the reason the machinery exists. When you plug a USB device, the kernel emits an event with a module alias derived from the device's vendor and product IDs. A user-space daemon (udev, or systemd-udevd) runs modprobe with that alias, which resolves through modules.alias to the driver, and then loads the driver and its dependencies. Nobody types a command, and the whole chain depends on modprobe being name-based and database-driven. A module loaded with insmod by hand skips all of it, which is also why a hand-loaded module does not come back after a reboot.
What the kernel itself requests
The kernel can ask for modules too. When code calls request_module("fs-ext4"), for example because you mount an ext4 file system and the driver is not loaded, the kernel executes the program named in /proc/sys/kernel/modprobe, normally /sbin/modprobe, with that name. Alias resolution then finds ext4. This is why mount just works with file systems that are not built in, and why the path in that file matters on a system with a custom user space. If auto-loading is unwanted, the modules_disabled sysctl and the module signing lockdown modes remove the option, and then only a root-privileged load of an already-allowed module works.


