Kernel Modules are pieces of code that can be loaded directly into the Kernel at runtime to extend functionality.[1] The Kernel itself can usually determine what modules it may need to properly run, but they can also be manually added, or removed by the user themselves.
Typically, The Linux Kernel ships with every modules built in by default, but this may vary depending on your Distribution, as such, there are some distributions that only provide modules your system needs rather than shipping ALL modules by default, This may help with performance on some systems (Typically older ones benefit the most) at the cost of new devices potentially not working when added. It is also possible to compile a Linux kernel on a pre-existing system to only use needed Kernel modules.
Obtaining information
Modules depend on the kernel release and the kernels version, though usually they are stored in /usr/lib/modules/kernel_release_version
.
To see which modules are loaded, lsmod
can be used. Obtaining information is achievable with modinfo <module_name>
Module loading
Automatic loading
Usually most needed modules are handled udev, so usually out of tree modules aren't needed, though there are cases where loading or blacklisting a module is needed for your setup to function properly.
Early module loading is generally handled by your initramfs generator of choice, usually dracut, booster or mkinitcpio.
Alternatively, systemd will load modules explicitly listed in /etc/modules-load.d/
,with the naming scheme of /etc/modules-load.d/program.conf
. Lines starting with ; or # are parsed as comments and ignored
Manual loading
Kernel modules can be manually loaded with modprobe <module_name>
, or loading a module that by file name (i.e. modules that are not installed in /usr/lib/modules/<kernel_release_version>
) can be achieved either of the following ways:
insmod file_name module_options
modprobe file_name
Removing a module can be achieved by:
rmmod module_name
modprobe -r module_name
modprobe --remove module_name
References
- ↑ https://linux-kernel-labs.github.io/refs/heads/master/labs/kernel_modules.html Kernel Labs Github, 2025 (imported 26th June 2025)