This article covers the various methods for operating with kernel modules.
For a module to be recognized as such, it has to be compiled as a module in the kernel configuration (the line related to the module will therefore display the letter M).
The Template:Codeline command handles the addition and removal of modules from the Linux kernel.
The Template:Filename directory can be used to pass module settings to udev, which will use Template:Codeline to manage the loading of the modules during system boot. You can use configuration files with any name in the directory, given that they end with the Template:Filename extension.
To manually load (or add) a module, run:
# modprobe module_name
For informations on loading modules automatically at system boot, see rc.conf.
Occasionally you could need to remove (or unload) a module; in this case use the following command:
# modprobe -r module_name
# rmmod module_name
If you want to display the comprehensive configuration of all the modules you can use the command:
$ modprobe -c
Since the output of that command will probably turn out to be very long, you can page it with:
$ modprobe -c | less
To display the configuration of a particular module, use:
$ modprobe -c | grep module_name
To pass a parameter to a kernel module you can use a modprobe conf file or use the kernel command line.
Using files in /etc/modprobe.d/
To pass options to a module using modprobe config files, a .conf file with any name (you can even use Template:Filename) needs to be placed in Template:Filename with this syntax: Template:File for example: Template:File
Using kernel command line
Some modules have aliases which are used to autoload them when they are needed by an application. Disabling these aliases can prevent auto-loading, but will still allow the modules to be manually loaded. Template:File
Blacklisting, in the context of kernel modules, is a mechanism to prevent the kernel module from loading. This could be useful if, for example, the associated hardware is not needed, or if loading that module causes problems: for instance there may be two kernel modules that try to control the same piece of hardware, and loading them together would result in a conflict.
Some modules are loaded as part of the initramfs. Template:Codeline will print out all autodetected modules: to prevent the initramfs from loading some of those modules, blacklist them in Template:Filename. Running Template:Codeline will list all modules pulled in by the various hooks (e.g. filesystem hook, SCSI hook, etc.). Remember to rebuild the initramfs once you have blacklisted the modules and to reboot afterwards.
Using files in Template:Filename
Create a Template:Filename file inside Template:Filename and append a line for each module you want to blacklist, using the Template:Codeline keyword. If for example you want to prevent the Template:Codeline module from loading:
Using kernel command line
Examples using GRUB
The following commands can help determine the dependencies of a module from the module itself.
- Format the contents of Template:Filename and show what kernel modules are currently loaded:
$ modinfo MODULE_1
- Use Template:Codeline to show information about Template:Codeline (including aliases and install commands):
$ modprobe --show-depends MODULE_2