LINUX - MANAGING KERNEL MODULES
LINUX - MANAGING KERNEL MODULES
Objectives
Completing this activity will help you to use content examples from the following syllabus objectives:
- 1.2 Given a scenario, install, configure, and monitor kernel modules
Enter lsmod | less to examine what modules are currently running
Briefly scan through the list of installed kernel modules.
Press q to quit.
Enter lsmod | grep bluetooth to filter the module information for bluetooth content.
Verify that there are no results.
You don't yet know the name of the relevant module, so this isn't necessarily definitive proof that it isn't loaded.
Search for the appropriate module.
Enter uname -r to retrieve the kernel version of the system.
Enter cd /lib/modules/[kernel version]/kernel/drivers
Remember to use tab completion to fill the kernel version automatically.
Enter ls | grep bluetooth and verify that there is a bluetooth directory.
Enter cd bluetooth to change to the bluetooth directory.
Enter ls to see the available Bluetooth driver modules.
Do any of these look like they could be a driver for a USB device that can send and receive Bluetooth signals? Click here for the answer.
Enter modinfo btusb.ko.xz | less to learn more about this module.
Read the information about this module, noting the following:
- The description indicates that this is a generic Bluetooth USB driver.
- It has many different aliases that aren't very user friendly.
- It depends on several other modules.
Press q to quit.
Configure an alias for the Bluetooth USB module.
Enter cd /etc/modprobe.d to change to the modprobe.d directory.
Enter sudo vim btusb.conf to create a configuration file for the module.
Create a new empty file by using Vim, and then type alias blue btusb as the first line.
Save and close the file.
Insert the Bluetooth USB module into the running kernel.
Enter sudo depmod to update the dependencies database.
Enter sudo modprobe -a blue
Enter lsmod | grep btusb
Verify that the btusb module is listed, indicating that it is inserted into the kernel.
Notice that there are other modules that begin with bt, as well as a module called bluetooth. Why were these added to the kernel as well? Click here for the answer.
Monitoring Kernel Modules
Scenario
Now that you installed the USB Bluetooth module, you want to make sure it was successfully loaded by the kernel and that there are no errors. You also want to identify your kernel version details in case you need to reference it during troubleshooting.
Objectives
Completing this activity will help you to use content examples from the following syllabus objectives:
- 1.2 Given a scenario, install, configure, and monitor kernel modules
Enter cat /proc/version and use the result to answer the following questions.
When was the kernel last compiled? Click here for the answer.
What version of the GCC is your kernel running? Click here for the answer.
Why might this information be useful? Click here for the answer.
Enter dmesg -h to examine the kernel message help.
Note the different facilities and log levels available. Examples include warn, err, notice, etc.
Enter dmesg -H
Don't forget to use the man pages to discover the meaning of the different options for commands. What is the meaning of the -H option for dmesg?
Verify that you can navigate through many pages of kernel messages.
Not all of the information here will be useful to you, so you'll need to filter what you're looking for.
Press q.
Filter the kernel message buffer for more useful messages.
Enter dmesg -H -l warn
Verify that the results have been filtered.
All of these messages are marked as warning conditions. These don't necessarily indicate errors but call attention to behavior that might be worth checking.
If necessary, press q.
Enter dmesg -H -l err
These messages do indicate errors. You might not have any results, which means the kernel hasn't recorded any errors thus far.
If necessary, press q.
Enter dmesg -H | grep usb to search the kernel message buffer for evidence of USB drivers being loaded.
Examine the results.
The kernel records when USB storages devices are found and when drivers are registered. It also identifies when input devices that use USB are found—like a mouse, keyboard, webcam, etc.
Enter dmesg -H | grep btusb to use grep to search for Bluetooth USB information.
Verify that the kernel is reporting that a new interface driver was registered for the btusb module you installed earlier.
Comments
Post a Comment