0

Would like to know if there is a specific list or location for the name of the kernel modules that are loaded when the system is booted.

Commands like lsmod or cat /proc/kallsyms only show those that have been loaded.

Want to determine which are the modules that have been loaded manually.

Thanks in advance!

1 Answer 1

3

There might be multiple lists: one for kernel modules loaded within initramfs (i.e. modules necessary for basic I/O and accessing the root filesystem) and another list loaded once the root filesystem has been mounted.

For Debian and related Linux distributions like Ubuntu, there's /etc/initramfs-tools/modules for modules to be loaded in initramfs (in the specific order listed), and /etc/modules-load.d/ drop-in directory for specifying modules to be loaded after the root filesystem is accessible.

For any distribution using the dracut initramfs creator, you might want to look into /etc/dracut.conf and/or /etc/dracut.conf.d/*.conf files for add_drivers, force_drivers and/or filesystems lines: these will cause the specified modules to be added into initramfs, and in case of force_drivers, explicitly loaded regardless of hardware detection.

Besides those, on modern systems, many modules are usually loaded by hardware auto-detection: the kernel will format the hardware IDs detected on any autodetection-capable bus into specific module alias names, and the modules themselves will contain wildcard strings matching the hardware they support. If a match is found, the matching module is loaded. Each driver module will usually have a more detailed hardware detection routine that can further verify the compatibility between the module and the hardware.

On architectures with no auto-detection-capable system buses (e.g. RasPi and various embedded devices), a "device tree", a .dtb file either appended to the kernel image or loaded separately by the bootloader, will describe the system hardware: it includes identifiers for compatible "programming models", which will be used by the kernel to form module alias strings for automatic loading of appropriate modules.

The aim of kernel developers is to make the loading of kernel modules as automatic as reasonably possible.

2
  • Thank you very much for the reply!! Very comprehensive. Would like to also check, if that is the case, is there a list or modules where the Linux distributions loads by default? Like those that comes install with the machine. Basically those kernel modules that comes pre-installed inside Ubuntu and are loaded into the kernel automatically when booted.
    – user357066
    Jun 27, 2019 at 7:03
  • There is no "single list of modules to be loaded common to all Linux distributions". This is one of the things each distribution may do differently, and the list of modules to load may depend on software packages you have installed. For example, if you install the NFS client packages on Debian/Ubuntu, the package will include a drop-in file for the initramfs generator that tells it to include the NFS modules in the initramfs, and a script snippet for initramfs that causes the modules to be loaded if e.g. kernel boot options indicate that the root filesystem is on NFS.
    – telcoM
    Jun 27, 2019 at 8:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .