Study Guide - Chap14: Tending Kernel Modules Flashcards
(15 cards)
1- 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.
- It is a self‐contained driver library file.
- It allows the addition of functionality when required.
- It can be loaded when needed.
- It keeps the Linux kernel lighter and more agile.
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.
2- Where are module files stored? (Choose all that apply.)
- /lib/modules/kernel/ subdirectory
- /lib/modules/KernelVersion/ subdirectory
- /usr/lib/modules/kernel/ subdirectory
- /usr/lib/modules/KernelVersion/ subdirectory
- /lib/kernel/modules subdirectory
- /lib/modules/KernelVersion/ subdirectory
- /usr/lib/modules/KernelVersion/ subdirectory
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.
3- 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
- The /etc/modules.conf file
- The /etc/modprobe.d/*.conf files
- The /lib/modprobe.d/*.conf files
- The /usr/lib/modprobe.d/*.conf files
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.
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
modinfo
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.
dmesg
Displays kernel ring buffer messages including boot messages, hardware detection, and driver loading information
insmod
Loads a single kernel module into the running kernel without handling dependencies automatically
lsmod
Lists all currently loaded kernel modules along with their size and usage count information
modprobe
Intelligently loads or unloads kernel modules while automatically handling dependencies and module parameters
modinfo
Displays detailed information about a kernel module including description, parameters, dependencies, and file location
depmod
a utility that creates a dependency database for kernel modules by analyzing module symbols and generating module dependency files
6- 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
depmod
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.
7- The modprobe utility uses the _____ file to determine any module dependencies.
- modules.dep
- /lib/modules
- /usr/lib/modules
- /etc/modprobe.d
- /lib/modprobe.d
modules.dep
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.
9- 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
rmmod
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.
10- 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
modprobe -r
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.
rmmod
a command-line utility that removes (unloads) a single kernel module from the running kernel without handling dependencies