Penguin

In computer software, a Module means an optional piece of code that isn't required for a program to run, but can be loaded when needed.

When talking about the Linux Kernel, it means a Driver or other piece of code that the kernel can load and use on request. Examples include DeviceDrivers for various pieces of hardware that aren't required for the computer to boot and work (such as sound card or graphics card drivers), and modules for various network protocols and disk formats that might not be used very often, so don't need to be loaded in memory all the time (such as the ISO-9660 disk format used by CDROMs, or the PPP or IPv6 network protocols).

Working with modules under Linux

To load a module into memory the format of the command is:

modprobe modulename

To remove a module from memory the format of the command is:

modprobe -r modulename

NB You cannot always remove a module, especially if in use or module removing has not been compiled into the Kernel

To see a list of all modules installed on the system:

modprobe -l

NB this does not show the modules running on the system. To do this type:

lsmod

Kernel options for modules.

There are a number of options you can alter for modules you can alter when building the kernel under "Loadable Modules Support" that may be use for you if you are Kernel developer.

Module options

Many modules take options when they are loaded. You can use

modinfo modulename

to see the list of supported options for a particular module.

To specify the options for a module on many LinuxDistributions on a 2.6 series LinuxKernel edit one of the files in the directory /etc/modprobe.d/ and use a line something like:

options ov51x led2=0

where the above example sets the led2 option to 0 for the ov51x module.

On a 2.4 series kernel, these settings go into /etc/modules.conf instead. (On Debian-based systems using a 2.4 kernel, put your settings into a file in the /etc/modutils/ directory and then run update-modules to re-create the modules.conf file.)

Regardless of which kernel you are running, you will need to unload and then load the module for new parameters to take effect.


See also KernelErrorMessages for some errors related to modules, and ModuleInitTools for information about modules with LinuxKernel2.6.