Difference between revisions of "Kernel modules"

(→‎Overview: the file is not located in /etc/modprobe.d/modprobe.conf http://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/module-init-tools&id=e36f69dac74d07e8af9c6dcf398a5266ff979f4d)

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.

Note: Module names often use underscores ("_") or dashes ("-"), however those symbols are interchangeable both when using the Template:Codeline command and in configuration files in Template:Filename.

Loading

To manually load (or add) a module, run:

# modprobe module_name

For informations on loading modules automatically at system boot, see rc.conf.

Removal

Occasionally you could need to remove (or unload) a module; in this case use the following command:

# modprobe -r module_name

Or, alternatively:

# rmmod module_name

Configuration

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

Options

To pass a parameter to a kernel module you can use a modprobe conf file or use the kernel command line.

To pass options to a module using modprobe config files, a .conf file with any name (you can even use modprobe.conf) needs to be placed in /etc/modprobe.d/ with this syntax:
Template:File
for example:
Template:File

Using kernel command line

If the module is built into the kernel you can also pass options to the module using the kernel command line (e.g. in GRUB, LILO or Syslinux) using the following syntax:

modname.parametername=parametercontents

for example:

thinkpad_acpi.fan_control=1

Aliasing

This article or section needs expansion.

Reason:please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Kernel modules#)

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

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.

Note: The Template:Codeline command will blacklist a module so that it will not be loaded automatically, but may be loaded if another non-blacklisted module depends on it or if it is loaded manually.

However, there is a workaround for this behaviour; the Template:Codeline command instructs modprobe to run a custom command instead of inserting the module in the kernel as normal, so you can force the module to always fail loading with: