modprobe

{{lowercase}}

modprobe is a Linux program that provides for loading a loadable kernel module into a Linux kernel, unloading a loaded module and many other related features. It provides an ability to make decisions about which modules to load, awareness of module dependencies, so that when requested to load a module, it adds other required modules first and resolution of recursive module dependencies.

It is commonly used indirectly. For example, udev relies upon modprobe to load drivers for automatically detected hardware.{{citation needed|date=January 2016}}

Modprobe was originally written by Rusty Russell and is distributed as part of the software package "kmod"{{cite web |url=https://git.kernel.org/cgit/utils/kernel/kmod/kmod.git |title = kernel/kmod/kmod.git - kmod - module management}} (maintained by Lucas De Marchi and others). It was previously developed as:

  • "module-init-tools",{{cite web |url=http://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools/ |title=Index of /Pub/Linux/Utils/Kernel/Module-init-tools |accessdate=2008-09-22 |url-status=dead |archiveurl=https://web.archive.org/web/20080609070918/http://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools/ |archivedate=2008-06-09 }} for Linux kernel version 2.6 and later (maintained by Jon Masters and others)
  • "modutils"{{cite web |url=http://ftp.kernel.org/pub/linux/utils/kernel/modutils/ |title=Index of /Pub/Linux/Utils/Kernel/Modutils |accessdate=2008-09-22 |url-status=dead |archiveurl=https://web.archive.org/web/20090223192439/http://ftp.kernel.org/pub/linux/utils/kernel/modutils/ |archivedate=2009-02-23 }} for use with Linux versions 2.2.x and 2.4.x. .

Operation

When invoked with no switches, the program adds/inserts/installs the module specified by name. Arguments after the module name are passed to the kernel. Configuration file options are also passed.

In some versions of modprobe, the configuration file is called modprobe.conf, and in others, the equivalent is the collection of files called in the /etc/modprobe.d directory.

modprobe looks only in the standard module directories. To install modules from the working directory insmod is required. Alternatively, a symbolic link file can be used so that depmod can find it.

Root privileges are typically required to perform the actions that modprobe attempts.

Features

The {{mono|modprobe}} program has more configuration features than other similar utilities. It is possible to define module aliases allowing for some automatic loading of modules. When the kernel requires a module, it actually runs modprobe to request it; however, the kernel has a description of only some module properties (for example, a device major number, or the number of a network protocol), and modprobe does the job of translating that to an actual module name via aliases.

The program also has the ability to run programs before or after loading or unloading a given module. For example, setting the mixer right after loading a sound card module, or uploading the firmware to a device immediately prior to enabling it. Although these actions must be implemented by external programs, modprobe synchronizes their execution with module loading/unloading.

Blacklist

There are cases where two or more modules both support the same devices, or a module invalidly claims to support a device: the blacklist keyword indicates that all of a particular module's internal aliases are to be ignored.[http://linux.die.net/man/5/modprobe.conf modprobe.conf(5) - Linux man page]

There are a couple of ways to blacklist a module, and depending on the method used to load it depends on where this is configured.

There are two ways to blacklist a module using modprobe, employing the modprobe.conf system, the first is to use its blacklisting system in /etc/modprobe.d/. Any filename ending with .conf can be used:

cat /etc/modprobe.d/blacklist.conf

blacklist ieee1394

blacklist ohci1394

blacklist eth1394

blacklist sbp2

An install primitive is the highest priority in the config file and will be used instead of the blacklisting method above, requiring this second method:

cat /etc/modprobe.d/ieee1394.conf

install ieee1394 /bin/true

install ohci1394 /bin/true

install eth1394 /bin/true

install sbp2 /bin/true

Alternately, you can modify /etc/modprobe.conf:

alias sub_module /dev/null

alias module_main /dev/null

options module_main needed_option=0

See also

  • {{Annotated link|lsmod}}

References

{{Reflist}}