Every time a Linux system is booted, there are a number of kernel modules that will be loaded by the system and used to provide additional support for filesystems, new hardware, and many other things. Obtaining information about particular kernel modules may a be an important troubleshooting skill. In this tutorial, we will explain how to obtain module information such as description, dependency, author or relevant object file name using the
modinfo command and its various options.
In this tutorial you will learn:
- How to check the currently loaded Linux kernel
- How to see which kernel modules are currently loaded
- How to see detailed information about any loaded kernel module
|Category||Requirements, Conventions or Software Version Used|
|System||Any Linux distro|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to check kernel module info with modinfo command
Any loadable kernel module is, by default, installed within the
/lib/modulesdirectory. For each particular kernel, a separate directory is created to contain modules to be used with that particular kernel:
$ ls /lib/modules/ 5.15.0-25-generic 5.15.0-30-generic
From the output on our test system, we can see that this particular system has two kernels installed. It is typical for Linux systems to have an extra kernel or two remaining on the system, in case there is an error and it needs to fall back to an older version. But remember that only one kernel can be run at any given time.
We can see which kernel is currently in use with the
$ uname -a Linux linuxconfig 5.15.0-30-generic #31-Ubuntu SMP Thu May 5 10:00:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
uname command output shows that
5.15.0-30-generic is the current system’s running kernel and thus modules loaded from
/lib/modules/5.15.0-30-generic/ directory are in use. To list all currently loaded kernel modules, we can use the
View info of loaded modules with modinfo
Now we will use the
modinfo command to check information about our currently loaded kernel modules. Check out some of the examples below and note what the individual command options do.
- First, let’s get the general description of a particular module with the
$ modinfo -d psmouse PS/2 mouse driver
- Next, let’s find out what is the actual object file location for this particular module with the
$ modinfo -n psmouse /lib/modules/5.15.0-30-generic/kernel/drivers/input/mouse/psmouse.ko
- To see an object file location for any given installed Linux kernel, use the
-kswitch and specify the kernel name.
$ modinfo -k 5.15.0-30-generic -n psmouse /lib/modules/5.15.0-30-generic/kernel/drivers/input/mouse/psmouse.ko
- Gather information about the module’s author by using the
$ modinfo -a psmouse Vojtech Pavlik
- Lastly, to find a module’s dependency information, we can use the
$ modinfo -F depends ppdev parport
Note that if nothing is returned in the output, then the module does not have any dependencies.
In this tutorial, we saw how to check information about a kernel module on a Linux system. Since modules extend the functionality of our Linux system, and provide additional support for hardware and software, it is important for system administrators to know the basics of troubleshooting them. Now that you know how to check information about loaded kernel modules, check out our other tutorial on Basic Linux Kernel commands for module administration to learn how to load and unload kernel modules on Linux.