Contents
What is kernel module dependencies?
Some kernel modules have module dependencies, meaning that other modules must be loaded first for it to load. The /sbin/modprobe command checks for these dependencies and loads the module dependencies before loading the specified module. To unload kernel modules, use the /sbin/rmmod command followed by the module name.
What two commands are used to load kernel modules?
You can load any module that has been compiled and installed to a /lib/modules subdirectory using two commands: insmod and modprobe.
How do I define dependency among…modules?
If a second module uses this symbol, that second module clearly depends on the first module. These dependencies can get quite complex. depmod creates a list of module dependencies by reading each module under /lib/modules/version and determining what symbols it exports and what symbols it needs.
How to define dependency among Linux kernel modules?
To accomplish the same by modifying the module1 code, you would use this line: Linux kernel modules can provide services (called “symbols”) for other modules to use (using one of the EXPORT_SYMBOL variants in the code). If a second module uses this symbol, that second module clearly depends on the first module.
When do I need to manually load a kernel module?
On modern systems, kernel modules are automatically loaded by various mechanisms when the conditions call for it. However, there are occasions when it is necessary to load or unload modules manually, such as when one module is preferred over another although either could provide basic functionality, or when a module is misbehaving.
What’s the best way to unload a kernel?
Although the rmmod command can be used to unload kernel modules, it is recommended to use modprobe -r instead. Like the kernel itself, modules can also take parameters that change their behavior. Most of the time, the default ones work well, but occasionally it is necessary or desirable to set custom parameters for a module.