The insmod command is used to add modules to the currently running kernel.
Syntax
The syntax of the insmod command is as follows:
# insmod [module_name]
The exact location of the module needs to be specified. For example:
# insmod /usr/lib/modules/3.19.8-100.fc20.x86_64/kernel/fs/ fat.ko
With insmod command you have to know the exact location of the module. If the module has any dependencies (a module that needs another module), it will fail to load. It is low-level form of module loading, that forms the base of other module loading methods, and is the one we will use in this book. On the other hand, there is modprobe, mostly used by sysadmins or in a production system. modprobe is a clever command that parses the modules.dep file in order to load dependencies first, prior to loading the given module. It automatically handles module dependencies, as a package manager does.
Syntax
The syntax of the insmod command is:
# insmod filename [module-options]
If you enciunter below error while running the insmod command:
insmod: command not found
you may try installing the below package as per yout choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install kmod |
Ubuntu | apt-get install kmod |
Alpine | apk add kmod |
Arch Linux | pacman -S kmod |
Kali Linux | apt-get install kmod |
CentOS | yum install kmod |
Fedora | dnf install kmod |
Raspbian | apt-get install kmod |