Difference between revisions of "Kernel module"

From ArchWiki
Jump to: navigation, search
m (Blacklisting: forgot to remove also this one)
(Using files in {{Filename|/etc/modprobe.d/}}: taken from Italian article; rewording)
Line 58: Line 58:
 
===Using files in {{Filename|/etc/modprobe.d/}}===
 
===Using files in {{Filename|/etc/modprobe.d/}}===
  
You can blacklist modules using the {{Codeline|blacklist}} keyword:
+
Create a {{Filename|.conf}} file inside {{Filename|/etc/mdoprobe.d/}} and append a line for each module you want to blacklist, using the {{Codeline|blacklist}} keyword. If for example you want to prevent the {{Codeline|pcspkr}} module from loading:
  
 
{{File|/etc/modprobe.d/nobeep.conf|content=<nowiki># Do not load the pcspkr module on boot
 
{{File|/etc/modprobe.d/nobeep.conf|content=<nowiki># Do not load the pcspkr module on boot
 
blacklist pcspkr</nowiki>}}
 
blacklist pcspkr</nowiki>}}
  
Alternatively, one can force nothing to be installed to "blacklist" that module and any that depend on it:
+
Alternatively, one can force nothing to be installed, thus "blacklisting" that module and any that depend on it:
  
 
{{File|/etc/modprobe.d/modprobe.conf|content=<nowiki>install MODULE_1 /bin/false
 
{{File|/etc/modprobe.d/modprobe.conf|content=<nowiki>install MODULE_1 /bin/false

Revision as of 21:49, 9 June 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

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

This article will cover the methods for managing kernel modules.

About

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).

Modules are stored in Template:Filename (use the command Template:Codeline to print your current kernel release).

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. It is not recommended to use the Template:Filename file, since it will be likely deprecated in the future (see Template:Codeline).

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

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 should better page it with:

$ modprobe -c | more

To display the configuration of a particular module, use:

$ modprobe -c | grep module_name

Aliasing

Template:File

Blacklisting

Blacklisting, when referring to Kernel modules, is a mechanism to prevent the kernel module from loading. This could be useful if for example the associated hardware is not required to be used, 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 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 initramfs once you have blacklisted the modules.

Warning: Blacklisting modules in rc.conf has been obsoleted and no longer works in initscripts 2011.06.1-1, so you'll have to use one of the following methods.

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:

Template:File

Alternatively, one can force nothing to be installed, thus "blacklisting" that module and any that depend on it:

Template:File

Using kernel command line

You can also blacklist modules on the kernel command line using the following syntax:

modprobe.blacklist=modname1,modname2,modname3

For example using GRUB:

Template:File

Alternatively:

modname1.disable=1

Example:

Template:File

The Template:Codeline option blacklists modules loaded by that name only. But if some other module depends on that module, that module will get loaded because blacklisting does not match dependent modules.

Dependencies

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:
$ lsmod
$ modinfo MODULE_1
$ modprobe --show-depends MODULE_2

Example

Template:File

See also