You can load, unload and list modules using the simple insmod
, lsmod
, and rmmod
commands. Here they are shown loading the dummy driver:
# insmod /lib/modules/4.1.10/kernel/drivers/dummy.ko # lsmod dummy 1248 0 - Live 0xbf009000 (O) # rmmod dummy
If the module is placed in a subdirectory in /lib/modules/<kernel release>
, as in the example, you can create a modules dependency database using the command depmod
:
# depmod -a # ls /lib/modules/4.1.10/ kernel modules.builtin.bin modules.order modules.alias modules.dep modules.softdep modules.alias.bin modules.dep.bin modules.symbols modules.builtin modules.devname modules.symbols.bin
The information in the module.*
files is used by the command modprobe
to locate a module by name rather than the full path. modprobe
has many other features which are described in the manual.
The module dependency information is also used by device managers, udev
in particular. When new hardware is detected, for example a new USB device, the udevd
daemon is alerted and passed the vendor, and product IDs are read from the hardware. udevd
scans the module dependency files looking for a module that has registered those IDs. If one is found, it is loaded using modprobe
.