Skip to main content
Engineering LibreTexts

06-B.6: Kernel Modules - Configuration

  • Page ID
    32788
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Kernel Module Configuration

    The modprobe command can add or remove modules. Since modules have dependencies, we need a method of specifying what options are to be used with those modules. All .conf files within the /etc/modprobe.d directory extension specify the options required for the various modules. The configuration files can be used to create aliases (alternate names for a module), or they can override the normal modprobe behavior altogether for those with special requirements. The default location of the .conf files are in the /etc/modprobe.d directory. In older versions of Linux these configurations were in the /etc/modprobe.conf file.

    This video discusses a bit about the /etc/modprobe.d directory and the dmesg command, which we will see in a couple of pages.

    Loadable modules can be defined in .conf files in the /etc/modules.d directory in order to load them during the init portion of the system boot process. Each module is listed one per-line. For example the /etc/modules.d/networking.conf file contains a list of 3 modules that should be loaded at boot time.

    tun
    e1000e
    brcmfmac

    To avoid a module from loading, add it by name to a file in /etc/modprobe.d/ and precede each module name with the blacklist keyword:

    blacklist uhci_hcd
    blacklist nvidia

    There is also the capability to create aliases for module names. Aliases are alternate names for a module. In the following example we have a /etc/modprobe.d/myalias.conf file that contains a very short alias mymod, instead of the long module name.

    alias mymod really_long_module_name

    Adapted from:
    "Kernel modules" by Multiple contributors, Gentoo is licensed under CC BY-SA 3.0


    06-B.6: Kernel Modules - Configuration is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by LibreTexts.

    • Was this article helpful?