Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

covers the tools provided to manage modules and then looks at a few
examples of using them.


Linux provides the following module management tools, all of which (along
with modprobe.conf) have man pages:


lsmod—This  command lists   the loaded  modules.    It  is  useful  to  pipe    this
through the less command because the listing is usually more than one
page long.
insmod—This command loads the specified module into the running
kernel. If a module name is given without a full path, the default location
for the running kernel, /lib/modules/*/, is searched. Several
options are offered for this command; the most useful is -f, which
forces the module to be loaded.
rmmod—This command unloads (removes) the specified module from the
running kernel. More than one module at a time can be specified.
modprobe—A more sophisticated version of insmod and rmmod, this
command uses the dependency file created by depmod and
automatically handles loading or, with the -r option, removing modules.
There is no force option, however. A useful option to modprobe is -t,
which causes modprobe to cycle through a set of drivers until it finds
one that matches your system. If you are unsure of what module will
work for your network card, use this command:

Click here to view code image
matthew@seymour:~$ sudo modprobe -t net


The term    net is  used    here    because that    is  the name    of  the directory
(/lib/modules/* /kernel/net) where all the network drivers are
kept. The modprobe command tries each one in turn until it loads one
successfully.
modinfo—This command queries a module’s object file and provides a
list of the module name, author, license, and any other information that is
there. It often is not very useful.
depmod—This program creates a dependency file for kernel modules.
Some modules need to have other modules loaded first; that is, they
“depend” on the other modules. (A lot of the kernel code is like this
because it eliminates redundancy in the code base.) During the boot
process, one of the startup files contains the command depmod -a, and
it is run every time you boot to re-create the file /lib/modules/*
Free download pdf