Aug 11 2007

modprobe

Tag: Essential Commands, LinuxVlogcanic @ 3:55 pm

The program modprobe is a system administration command in Linux capable of managing (viewing, injecting and unloading) kernel modules. Module is Linuxspeak to address the kind of software that does the same trick as drivers do in Windows.

A brief description.

Upon boot modprobe typically checks the contents in three locations of the Linux filesystem:

  • /lib/modules/`uname -r` which is the directory where are the loadable modules and related files are stored for the current kernel.
  • /etc/modules, a text file containing a list of optional modules to be loaded by default.
  • /etc/modprobe.d/blacklist, another text file, the black list, which contains the module names that must not be loaded into the kernel under any circumstances.

note: this may vary depending on the distribution, the conventions described here are those used by Debian and Debian-based systems

Basic use and options.

Let’s say that modulename is the module you want to inject into the running kernel. In order to inject it you type

modprobe modulename

as the root user or

sudo modprobe modulename

otherwise. Once that’s done you can check that the module is indeed loaded by asking modprobe to show you a list of all the loaded modules

modprobe -l

or

modprobe --list

which is kind of impractical as the list is usually rather long. But you can also ask for a specific module or use wildcards

modprobe -l modulename

You can also unload the module from the kernel by calling modprobe with the remove option typing

modprobe -r modulename

as the root user or

sudo modprobe –remove modulename

otherwise.

Modprobe removes modules by calling the rmmod program, which you can also use directly.

For more options, look at your system’s manual documentation:

man modprobe