kernel modules

Find which Linux modules are used or needed

Table of Contents

Tools

With lspci

In the sample output below, see the kernel driver in use, and those available:

$ man lspci
# lspci -k
....
01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)
        Subsystem: Gigabyte Technology Co., Ltd GM107 [GeForce GTX 750 Ti]
        Kernel driver in use: nouveau
        Kernel modules: nvidiafb, nouveau

With lsmod

See the "used by" field:

$ man lsmod
# lsmod
Module Size Used by
cfg80211 552960 0

/lib/modules/

Linux Kernel modules (drivers, etc.) are placed is sub-directories of /lib/modules/.
The sub-directories are named after the kernel release (version and build), e.g.:
(on an older system):

# ls -1 /lib/modules/
2.6.35-22-generic
2.6.38-11-generic
2.6.38-12-generic

You can use the output of 'uname -r' in scripts to get the proper directory to search in, according to the kernel release.

# uname -r
4.4.21-gentoo
# ls -1 /lib/modules/
4.4.21-gentoo
# tree -fia /lib/modules/`uname -r`/ | grep -i nvidia

Which linux kernel driver is being used: nvidia or nouveau?

Add here different ways to answer the above question.

With lspci

One way is to check the output of lspci:

# lspci -nnk | grep -iA2 vga
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] [10de:1380] (rev a2)
        Subsystem: Gigabyte Technology Co., Ltd GM107 [GeForce GTX 750 Ti] [1458:3681]
        Kernel driver in use: nouveau

See the 3rd line: "Kernel driver in use: nouveau".

Syndicate content