Chapter 14 Flashcards

Tending Kernel Modules

1
Q

Describe the locations of kernel module files. 

A

Kernel module files have a .ko file extension and are typically located in a subdirectory of the /lib/modules/ directory. There is a subdirectory for each particular Linux kernel version. Some distributions have additional directories, such as /usr/lib/modules/, which are hard-linked to the /lib/modules/ directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Distinguish the locations of module configuration files. 

A

Older Linux distributions use a single file, /etc/modules.conf, as their kernel modules configuration file. More modern distributions use configuration directories, which can be the /etc/modprobe.d/, /etc/modules-load.d/, /lib/modprobe.d/, /usr/lib/modprobe.d/, and/or /run/modprobe.d/ directory. Within configuration directories, module configuration files have a .conf file extension.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Summarize the utilities used to troubleshoot modules. 

A

Because when kernel modules fail they often issue a kernel message, you can employ the dmesg utility to view recent kernel messages or peruse the /var/log/dmesg file, if available, for boot time kernel problems. The lsmod utility displays all the currently loaded modules, the number of processes and other modules using them, and the other modules’ names. The modinfo program is very helpful because it displays detailed information concerning a module, including its dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Compare the utilities used to install kernel modules. 

A

The low-level insmod utility requires a full module filename in order to insert a module into the kernel, which can be cumbersome. In addition, it does not load any module dependencies. On the other hand, the modprobe utility only requires the module’s name. Also, it searches the modules.dep file to determine and load any module dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the utilities used to remove kernel modules. 

A

The rmmod utility is a low-level utility. Though it does not require a full module filename in order to unlink a module from the kernel, it does not unload any module dependencies. So you could end up with unneeded modules, still linked to the kernel. The modprobe utility, using the -r option, will unload the module and unlink any module dependencies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following is true concerning a kernel module? (Choose all that apply.)

It is a self-contained driver library file.
It is compiled into the Linux kernel.
It allows the addition of functionality when required.
It can be loaded when needed.
It keeps the Linux kernel lighter and more agile.
A

A, C, D, E. A kernel module is a self-contained driver library file, which is not precompiled into the Linux kernel. It can be loaded and unloaded as needed, which provides additional functionality when required. These kernel modules keep the Linux kernel lighter and more agile. Therefore, options A, C, D, and E are all correct answers. The only incorrect answer is option B, and it is wrong because kernel modules are not compiled into the kernel.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where are module files stored? (Choose all that apply.)

A /lib/modules/kernel/ subdirectory
A /lib/modules/KernelVersion/ subdirectory
A /usr/lib/modules/kernel/ subdirectory
A /usr/lib/modules/KernelVersion/ subdirectory
A /lib/kernel/modules subdirectory
A

B, D. Kernel module files, depending on the distribution, can be stored in a subdirectory of /lib/modules/KernelVersion/ or /usr/lib/modules/KernelVersion/. If the /usr/lib/modules/KernelVersion/ directory is used, it is typically hard-linked to the /lib/modules/KernelVersion/ directory. Therefore, options B and D are correct answers. The other directory names are made up. Thus, options A, C, and E are incorrect choices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Where can a module’s configuration information be stored? (Choose all that apply.)

The /etc/modules.conf file
The /etc/modprobe.d/*.conf files
The /etc/modules.d/*.conf files
The /lib/modprobe.d/*.conf files
The /usr/lib/modprobe.d/*.conf files
A

A, B, D, E. Older Linux distributions store module configuration information in a single configuration file, /etc/modules.conf. On more modern distributions, configuration information is stored in *.conf files within the /etc/modprobe.d/, /lib/modprobe.d/, /usr/lib/modprobe.d/, and run/modprobe.d/ directories. Therefore, options A, B, D, and E are all correct answers. The /etc/modules.d/ directory is made up, and thus option C is an incorrect choice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

You need to determine the dependencies of the unloaded xyz module. Which is the best utility to employ to accomplish this task?

dmesg
insmod
lsmod
modprobe
modinfo
A

E. The modinfo utility will allow you to view detailed information concerning a module passed as a command argument. This detailed information includes any dependencies. Therefore, option E is the correct answer. The dmesg command is helpful for viewing any kernel messages concerning module failures but does not display module dependency information. Thus, option A is a wrong answer. The insmod utility is used for loading modules dynamically, and therefore, option B is a wrong choice. The lsmod command displays currently loaded modules. While it does show other modules that are currently using the module, because it does not list dependencies or show information for unloaded modules, it is not the best choice. Thus, option C is also an incorrect answer. The modprobe utility is used for loading and unloading kernel modules, and therefore, it is not the best choice either. Thus, option D is an incorrect choice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

You need to install the xyz module, including all its needed dependencies. Which of the following utilities should you use?

insmod
modinfo
modprobe
lsmod
depmod
A

C. The modprobe utility will dynamically load the xyz utility, if you pass it as an argument to the command, and also load any of its needed dependencies. Therefore, option C is the correct answer. The insmod utility is used for loading modules dynamically. However, it will not load any of the module’s dependencies, and therefore, option A is an incorrect choice. The modinfo utility allows you to view detailed information concerning a module passed as a command argument, but it does not load modules. Therefore, option B is a wrong answer. The lsmod command displays currently loaded modules, and thus option D is an incorrect answer. The depmod command is used for scanning through the system in order to update the modules.dep file. Therefore, option E is also an incorrect choice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When you install a USB device on a Linux system, it appears that the device is not being detected. Which of the following is the best command to troubleshoot this particular situation?

lsmod
modinfo
dmesg
depmod
insmod
A

D. The Linux system typically will automatically detect new hardware and load any needed modules. The depmod command will scan through the system looking for any hardware that was not automatically detected. It determines any needed modules, reviews the modules’ dependencies, and updates the appropriate file. Therefore, option D is the correct answer. The lsmod command displays currently loaded modules, and thus option A is an incorrect answer. The modinfo utility allows you to view detailed information concerning a module passed as a command argument. However, if you don’t know the device’s associated module, this utility is of little use. Therefore, option B is a wrong choice. The dmesg command is helpful for viewing any kernel messages concerning module failures, so if it is a module failure issue, you can view it using this command. However, since the device was not detected, it is not the best command to start the troubleshooting process. Therefore, option C is a wrong answer. The insmod utility is used for loading modules dynamically, and therefore, option E is an incorrect choice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The modprobe utility uses the _____ file to determine any module dependencies.

modules.dep
/lib/modules
/usr/lib/modules
/etc/modprobe.d
/lib/modprobe.d
A

A. The modprobe utility uses the modules.dep file to determine any module dependencies. Therefore, option A is the correct answer. The other options contain directories involved in the kernel module management, and thus options B, C, D, and E are wrong choices.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

You need to insert the abc module into the Linux kernel. This module does not have any dependencies. What is the best utility to use?

lsmod
modinfo
dmesg
depmod
insmod
A

E. The insmod utility will allow you to quickly insert a module, whose name is passed as an argument to the command, into the Linux kernel. Therefore, option E is the correct answer. The lsmod command displays currently loaded modules, and thus option A is an incorrect answer. The modinfo utility allows you to view detailed information concerning a module passed as a command argument, but it does not load modules. Therefore, option B is a wrong answer. The dmesg utility displays the kernel’s ring buffer but does not allow you to insert modules into it. Thus, option C is also a wrong choice. The depmod command is used for scanning through the system in order to update the modules.dep file. Therefore, option D is also an incorrect choice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

You need to unload the abc module from the Linux kernel. This module does not have any dependencies. What is the best utility to use?

insmod
unload
rmmod
modprobe
rm -f
A

C. The rmmod command will quickly unload a module, but none of its dependencies, from the Linux kernel. Since the abc module does not have any dependencies, option C is the best answer. The insmod utility is used for loading (inserting) a module and not unloading one. Therefore, option A is a wrong answer. The unload command is made up, and thus option B is also an incorrect answer. The modprobe command used without any switches is for loading (inserting) modules, not unloading them. Thus, option D is a wrong choice. The rm -f command is used in removing files, not unloading modules. Therefore, option E is an incorrect answer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

You need to remove the xyz module and all of its dependencies. Which is the best command to employ?

dmesg
modprobe -r
lsmod
paste
groupdel
A

B. The modprobe -r command will remove the module whose name is passed to it as an argument and any of its dependent modules. Therefore, option B is the best answer. The dmesg command is helpful for viewing kernel messages related to module failures but not for unloading modules. Thus, option A is a wrong answer. The lsmod utility shows brief module information for loaded modules but is not involved in the unlinking process. Therefore, option C is also an incorrect answer. The paste command allows you to sloppily put together two files side by side to STDOUT. However, it is not involved with kernel modules, so option D is also a wrong choice. The groupdel utility is used for removing user groups, and it also is not used with kernel modules. Therefore, option E is an incorrect choice.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
A