Load all modules linux

MODPROBE

modprobe [ −adnqv ] [ −C config ] module [ symbol=value . ]
modprobe
[ −adnqv ] [ −C config ] [ −t type ] pattern
modprobe
−l [ −C config ] [ −t type ] pattern
modprobe
−c [ −C config ]
modprobe
−r [ −dnv ] [ −C config ] [ module . ]
modprobe
-V

OPTIONS

Load all matching modules instead of stopping after the first successful loading.

Show the currently used configuration.

Show information about the internal representation of the stack of modules.

Set ’autoclean’ on loaded modules. Used by the kernel when it calls on modprobe to satisfy a missing feature (supplied as a module). The −q option is implied by −k. These options will automatically be sent to insmod.

Don’t actually perform the action, just show what would be done.

Do not complain about insmod failing to install a module. Continue as normal, but silently, with other possibilities for modprobe to test. This option will automatically be sent to insmod.

Remove module (stacks) or do autoclean, depending on whether there are any modules mentioned on the command line.

Report via syslog instead of stderr. This options will automatically be sent to insmod.

Only consider modules of this type. modprobe will only look at modules whose directory path includes exactly «/moduletype/». moduletype can include more than one directory name, e.g. −t drivers/net would list modules in xxx/drivers/net/ and its subdirectories.

Print all commands as they are executed.

Show the release version of modprobe.

Use the file configfile instead of (the optional) /etc/modules.conf to specify the configuration. The environment variable MODULECONF can also be used to select (and override) a different configuration file from the default /etc/modules.conf (or /etc/conf.modules (deprecated)).

DESCRIPTION

The modprobe and depmod utilities are intended to make a Linux modular kernel more manageable for all users, administrators and distribution maintainers.

Modprobe uses a «Makefile»-like dependency file, created by depmod, to automatically load the relevant module(s) from the set of modules available in predefined directory trees.

Modprobe is used to load a set of modules, either a single module, a stack of dependent modules, or all modules that are marked with a specified tag.

Modprobe will automatically load all base modules needed in a module stack, as described by the dependency file modules.dep. If the loading of one of these modules fails, the whole current stack of modules loaded in the current session will be unloaded automatically.

Читайте также:  Using ftp with linux

Modprobe has two ways of loading modules. One way (the probe mode) will try to load a module out of a list (defined by pattern ). Modprobe stops loading as soon as one module loads successfully. This could be used to autoload one Ethernet driver out of a list.
The other way modprobe can be used is to load all modules from a list. See EXAMPLES below.

With the option −r, modprobe will automatically unload a stack of modules, similar to the way rmmod −r does. Note that using just modprobe −r will clean up unused autoloaded modules and also perform the pre- and post-remove commands in the configuration file /etc/modules.conf.

With the option −l combined with the option −t a list all available modules of a certain type will be shown.

Option −c will print the currently used configuration (default + configuration file).

CONFIGURATION

The behavior of modprobe (and depmod ) can be modified by the (optional) configuration file /etc/modules.conf
For a more detailed description of what this file can contain, as well as the default configuration used by depmod and modprobe, see modules.conf(5).

Note that the pre- and post-remove commands will not be executed if a module is «autocleaned» by kerneld! Look for the up-coming support for persistent module storage instead.
If you want to use the pre- and post-install features, you will have to turn off autoclean for kerneld and instead put something like the following line in your crontab (this is used for kmod systems as well) to do autoclean every 2 minutes:
*/2 * * * * test −f /proc/modules && /sbin/modprobe −r

STRATEGY

The idea is that modprobe will look first in the directory containing modules compiled for the current release of the kernel. If the module is not found there, modprobe will look in the directory common to the kernel version (e.g. 2.0, 2.2). If the module is still found, modprobe will look in the directory containing modules for a default release, and so on.

When you install a new linux, the modules should be moved to a directory related to the release (and version) of the kernel you are installing. Then you should do a symlink from this directory to the «default» directory.

Each time you compile a new kernel, the command make modules_install will create a new directory, but won’t change the

When you get a module unrelated to the kernel distribution you should place it in one of the version-independent directories under /lib/modules.

This is the default strategy, which can be overridden in /etc/modules.conf.

EXAMPLES

Load one of the modules that are stored in the directory tagged «net». Each module are tried until one succeeds.

Читайте также:  Check configuration in linux

All modules that are stored in directories tagged boot will be loaded.

This will attempt to load the module slhc.o if it was not previously loaded, since the slip module needs the functionality in the slhc module. This dependency will be described in the file «modules.dep» that was created automatically by depmod

will unload the slip module. It will also unload the slhc module automatically, unless it is used by some other module as well (like e.g. ppp).

FILES

/etc/modules.conf, (alternatively but deprecated: /etc/conf.modules) /lib/modules/*/modules.dep, /lib/modules/*

SEE ALSO

depmod(8), lsmod(8), kerneld(8), ksyms(8), rmmod(8), modules(2)

SAFE MODE

If the effective uid is not equal to the real uid then modprobe treats its input with extreme suspicion. The last parameter is always treated as a module name, even if it starts with ’-’. There can only be one module name and options of the form «variable=value» are forbidden. The module name is always treated as a string, no meta expansion is performed in safe mode. However meta expansion is still applied to data read from the config file.

euid may not be equal to uid when modprobe is invoked from the kernel, this is true for kernels >= 2.4.0-test11. In an ideal world modprobe could trust the kernel to only pass valid parameters to modprobe. However at least one local root exploit has occurred because high level kernel code passed unverified parameters direct from the user to modprobe. So modprobe no longer trusts kernel input.

modprobe automatically sets safe mode when the environment consists only of these strings

HOME=/ TERM=linux PATH=/sbin:/usr/sbin:/bin:/usr/bin

This detects modprobe execution from the kernel on kernels 2.2 though 2.4.0-test11, even if uid == euid, which it does on the earlier kernels.

REQUIRED UTILITIES

NOTES

Patterns supplied to modprobe will often need to be escaped to ensure that it is evaluated in the proper context.

AUTHOR

Jacques Gelinas (jack@solucorp.qc.ca)
Bjorn Ekwall (bj0rn@blox.se)

copyright 1998-2007, devdaily.com, all rights reserved.
devdaily.com, an alvin j. alexander production.

Источник

How to Load and Unload Kernel Modules in Linux

A kernel module is a program which can loaded into or unloaded from the kernel upon demand, without necessarily recompiling it (the kernel) or rebooting the system, and is intended to enhance the functionality of the kernel.

In general software terms, modules are more or less like plugins to a software such as WordPress. Plugins provide means to extend software functionality, without them, developers would have to build a single massive software with all functionalities integrated in a package. If new functionalities are needed, they would have to be added in new versions of a software.

Читайте также:  Machine type on linux

Likewise without modules, the kernel would have to be built with all functionalities integrated directly into the kernel image. This would mean having bigger kernels, and system administrators would need to recompile the kernel every time a new functionality is needed.

A simple example of a module is a device driver – which enables the kernel to access a hardware component/device connected to the system.

List All Loaded Kernel Modules in Linux

In Linux, all modules end with the .ko extension, and they are normally loaded automatically as the hardware is detected at system boot. However a system administrator can manage the modules using certain commands.

To list all currently loaded modules in Linux, we can use the lsmod (list modules) command which reads the contents of /proc/modules like this.

Module Size Used by rfcomm 69632 2 pci_stub 16384 1 vboxpci 24576 0 vboxnetadp 28672 0 vboxnetflt 28672 0 vboxdrv 454656 3 vboxnetadp,vboxnetflt,vboxpci bnep 20480 2 rtsx_usb_ms 20480 0 memstick 20480 1 rtsx_usb_ms btusb 45056 0 uvcvideo 90112 0 btrtl 16384 1 btusb btbcm 16384 1 btusb videobuf2_vmalloc 16384 1 uvcvideo btintel 16384 1 btusb videobuf2_memops 16384 1 videobuf2_vmalloc bluetooth 520192 29 bnep,btbcm,btrtl,btusb,rfcomm,btintel videobuf2_v4l2 28672 1 uvcvideo videobuf2_core 36864 2 uvcvideo,videobuf2_v4l2 v4l2_common 16384 1 videobuf2_v4l2 videodev 176128 4 uvcvideo,v4l2_common,videobuf2_core,videobuf2_v4l2 intel_rapl 20480 0 x86_pkg_temp_thermal 16384 0 media 24576 2 uvcvideo,videodev .

How to Load and Unload (Remove) Kernel Modules in Linux

To load a kernel module, we can use the insmod (insert module) command. Here, we have to specify the full path of the module. The command below will insert the speedstep-lib.ko module.

# insmod /lib/modules/4.4.0-21-generic/kernel/drivers/cpufreq/speedstep-lib.ko

To unload a kernel module, we use the rmmod (remove module) command. The following example will unload or remove the speedstep-lib.ko module.

# rmmod /lib/modules/4.4.0-21-generic/kernel/drivers/cpufreq/speedstep-lib.ko

How to Manage Kernel Modules Using modprobe Command

modprobe is an intelligent command for listing, inserting as well as removing modules from the kernel. It searches in the module directory /lib/modules/$(uname -r) for all the modules and related files, but excludes alternative configuration files in the /etc/modprobe.d directory.

Here, you don’t need the absolute path of a module; this is the advantage of using modprobe over the previous commands.

To insert a module, simply provide its name as follows.

To remove a module, use the -r flag like this.

Note: Under modprobe, automatic underscore conversion is performed, so there is no difference between _ and – while entering module names.

For more usage info and options, read through the modprobe man page.

Do not forget to check out:

That’s all for now! Do you have any useful ideas, that you wanted us to add to this guide or queries, use the feedback form below to drop them to us.

Источник

Оцените статью
Adblock
detector