Overview
Extending a running Linux system without triggering a reboot relies on dynamic kernel module management. Through hands-on examples on Ubuntu, this walkthrough demonstrates how insmod inserts kernel modules directly into memory and accepts runtime parameters, while contrasting its behavior with companion utilities such as modinfo, lsmod, rmmod, and modprobe.
Verifying insmod Availability and Inspecting Active Modules
To ensure the required tooling is on hand—specifically kmod (which ships insmod) and iproute2 for later interface verification—run apt-get update -qq && apt-get install -y kmod iproute2.

At its core, insmod injects a compiled kernel object file straight into the active Linux kernel.
Checking insmod --version reveals the installed package release (kmod version 31) alongside compiled-in compression and cryptographic support flags (+ZSTD, +XZ, -ZLIB, +LIBCRYPTO, -EXPERIMENTAL).
⚙️ [Key Options]
-V, --version : Prints the kmod version providing insmod and lists enabled or disabled build features.-h, --help : Displays syntax summary and available command-line flags for insmod.

To see which modules are currently resident in kernel space, administrators turn to lsmod.
Piping the output through lsmod | head -n 10 limits the view to the first ten lines for quick inspection.
Three columns organize the output: Module identifies the loaded component, Size reports its memory footprint, and Used by tracks active reference counts along with any dependent modules.

Checking Module Paths and Dependencies with modinfo
Because insmod cannot resolve bare module names on its own, start by querying modinfo for details about the dummy module.
Executing modinfo dummy | head -n 15 surfaces the opening 15 lines of metadata, covering attributes like the file location (filename), summary (description), prerequisites (depends), and tunable options (parm).
When the target module file is absent from the current environment, nothing is printed.

Filtering the metadata with modinfo -F filename dummy isolates just the filename field via the -F flag.
This gives you the exact filesystem path required as an argument to insmod for the dummy module, though the command returns empty output if the module file does not exist on the host.

Similarly, modinfo -F depends dummy pulls only the depends field so you can spot any prerequisite modules beforehand.
Unlike higher-level tools, insmod refuses to resolve dependencies automatically, meaning anything listed here must be inserted manually first; an empty result indicates either no dependencies or a missing module file.

Direct Module Loading and Parameter Passing with insmod
Before testing insertion, clear out any pre-existing instance of the module by running rmmod dummy 2>/dev/null || true so the environment starts clean.

Passing the resolved path inline via insmod $(modinfo -F filename dummy) instructs the kernel to load the dummy module directly.
Silence on the terminal is normal here—whether the insertion succeeds or the underlying module file is missing in the environment, no output is produced.

To verify whether the module actually entered kernel memory, filter the active list with lsmod | grep dummy.
In this run, the standalone dummy module is absent; only snd_seq_dummy (whose name merely contains the substring) and its consumer snd_seq show up, confirming that dummy itself was not loaded.

Before attempting to reload a module with custom parameters, rmmod dummy tears down any loaded dummy instance to reset its state, producing no console output upon completion.

Runtime configuration can be supplied inline at load time: insmod $(modinfo -F filename dummy) numdummies=2 passes numdummies=2 so the driver initializes two virtual network interfaces.
You can append options right after the module path as parameter=value pairs, and as before, this execution produces no terminal output.

Next, ip link show type dummy queries the networking stack for active interfaces of type dummy.
The empty output confirms that no virtual dummy interfaces exist, reflecting the fact that the dummy kernel module is not loaded in this environment.

Unloading Modules with rmmod and Comparing Against modprobe
Once testing wraps up, rmmod dummy cleanly detaches the standalone dummy module from the kernel.
As the direct counterpart to insmod, rmmod targets a single module without touching others and returns silently on success.

Running lsmod | grep dummy || echo "dummy module removed" checks whether dummy remains resident.
Because snd_seq_dummy and its referencing module snd_seq match the grep pattern, the fallback echo branch does not trigger; still, the absence of a standalone dummy entry confirms the module is not loaded.

Whereas insmod demands a full file path and manual dependency handling, modprobe dummy locates the module by name across standard kernel directories and resolves prerequisites automatically.
For everyday administration, modprobe is strongly preferred over insmod, and in this run the command exits without printing any messages.

Checking lsmod | grep dummy once more validates whether modprobe dummy placed the module into kernel memory.
Once again, only snd_seq_dummy and snd_seq appear while dummy itself stays missing from the list, indicating the module is unavailable in the current environment.

Finally, modprobe -r dummy unloads the specified module along with any stacked dependencies that are no longer needed.
Unlike rmmod, which operates strictly on a single target, modprobe -r handles dependency teardown automatically and finishes quietly without console output.

That wraps up the fundamentals of inserting Linux kernel modules directly with insmod on Ubuntu. In production systems, always weigh dependency chains and kernel stability carefully when choosing between low-level tools like insmod and rmmod versus dependency-aware management via modprobe.