FlexMcMurphy
FlexMcMurphy

Reputation: 523

How to identify the name of a needed linux kernel module

I am trying to build the linux Parted tool following these instructions.

After building Parted you can run tests on it and those instructions state:

About 20 % more tests are run if the following kernel module is built:

enter image description here

Despite this information I am still not sure what is the name of the kernel module or modules I need to have?

I have been searching my Linux/Manjaro system with these commands for hints but not sure if I have the needed kernel module or not because I don't know the name of the module(s) I need or if I am even looking in the right place for them.

lsmod
lsmod | grep scsi
tail /proc/modules
ls -l /sys/module | grep scsi
modinfo -p scsi_mod

My current kernel is: 6.1.94-1-MANJARO

find /lib/modules/6.1.94-1-MANJARO/ -type f -name '*.ko*'
find /lib/modules/6.1.94-1-MANJARO/ -type f -name '*.ko*' | grep scsi

Upvotes: 0

Views: 149

Answers (1)

FlexMcMurphy
FlexMcMurphy

Reputation: 523

As is often the case right after I posted my question I think I found the answer...

The "< m >" alongside "SCSI debugging host and device simulator" is the hint that I need one module and its name is in the square brackets --> scsi_debug.

According to kernel.io this ?driver also has the ?description "SCSI debugging host simulator" and confirms that the actual name of the module is: scsi_debug.

That link also states that the module scsi_debug has been in the linux kernel since v2.6.12 but another way to check if it was "built" in to your kernel is described on this site:

zcat /proc/config.gz > filename.config

The file will be saved to the directory you ran the command from and then opening that file gave me this:

...
..
CONFIG_SCSI_WD719X=m
CONFIG_SCSI_DEBUG=m
CONFIG_SCSI_PMCRAID=m
..
...

The 'm' means that in my kernel scsi_debug has been built as a loadable module. This means it is not built-in and therefore not automatically available on boot up but it can be loaded and unloaded dynamically as needed.

As I am running Manjaro I visited the Arch Wiki and found info about how to inspect what modules are loaded on my system and how to load/unload them. I think these commands work on any linux distro...

Modules are stored in /usr/lib/modules/kernel_release. Mine is 6.1.94-1-MANJARO which I confirmed with this command:

uname -r

Confirm that I have the scsi_debug module this way:

find /usr/lib/modules/6.1.94-1-MANJARO/ -type f -name '*.ko*' | grep scsi_debug

Show if scsi_debug is loaded:

lsmod | grep scsi_debug

Modules can be made to load at boot by placing files with various settings in places like /etc/modprobe.d/ and /etc/modules-load.d/ or they can be started manually after boot up like this:

sudo modprobe scsi_debug

Or if you had that module in a location other than "/usr/lib/modules/kernel_release" you would do it like this...

insmod path_to_filename [args]

Then unload the module manually like this:

sudo modprobe -r scsi_debug

I probably don't need to do any of the above to get the 20% more tests of Parted after building it. Probably the script that runs those tests loads and unloads scsi_debug as needed.

Enjoy.

Upvotes: 0

Related Questions