While I can use lsmod in order to show currently active kernel modules, how can I see which drivers are statically built into the kernel AND currently active?


You could do a cat /lib/modules/$(uname -r)/modules.builtin

From the Kernel Documentaton


This file lists all modules that are built into the kernel. This is used by modprobe to not fail when trying to load something builtin.

  • 1
    modules.builtin does not exist in my system with uname: Linux ecp 4.4.127-1.el6.elrepo.i686 #1 SMP Sun Apr 8 09:44:43 EDT 2018 i686 i686 i386 GNU/Linux. Is there another way to find what drivers are built in? – Danny Jul 15 '19 at 5:39
  • 1
    @Danny Make sure you use uname -r and not the more common uname -a – Nairou Jul 22 '19 at 2:16

If your linux has a /proc/config.gz

That has all the built modules. Copy it elsewhere and unzip it. Open the file everything with a "=M" is built as a module. Everything with a "=Y" is statically built.

hwinfo will list the "Driver:" check the above file to see if it is statically built.

FYI: All statically built drivers are always loaded into memory and ready for action. Without the corresponding hardware they will not do anything, but use memory.

  • 1
    What if there is no /proc/config.gz? – JohnnyFromBF Apr 5 '13 at 13:25
  • Ok I just found a .config file in the directory where I compiled the kernel, that's obviously what you meant. – JohnnyFromBF Apr 5 '13 at 13:51
  • 1
    This file also exists here: /boot/config-$(uname -r). – JohnnyFromBF Apr 5 '13 at 13:58

The sysfs module area /sys/module is a view into all the modules visible to the running kernel. Each module directory has a set of sysfs interface files to view and manage the module via userspace. Generally speaking, the LKMs have a refcnt file, which will be greater than 0 if it is being used along with a holder directory of those modules using it. The builtin modules do not have this file (or many others like initstate and taint.)

Try find /sys/module -name refcnt -printf '\n%p: ' -exec cat {} \; to see which are being used.

Under many modules is a parameters directory containing the parameters that can be viewed and modified from user-space. In the source this is generally a call to a module_param macro. For example, see kernel/printk.c and the module /sys/module/printk/parameters for some useful printk tuning.

All entities under /sys/module are set in the kernel module framework. Some are hardware drivers, some are netfilter, some are filesystems, some debug, etc.

ls /sys/module

seems to contain all built-in and external modules.

But it also appears to contain some entries which are not actually modules: https://unix.stackexchange.com/questions/225706/are-modules-listed-under-sys-module-all-the-loaded-modules

TODO: read the source and understand more precisely what gets put there.

The advantage of this method is that you don't rely on being able to find the kernel config under /boot or /proc/config.gz.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.