MODULES-LOAD.D(5)

โœจ MODULES-LOAD.D โœจ

okay bestie, gather round, because this is modules-load.d โ€” the manual page for telling your kernel which modules to load at boot ๐Ÿ’… it's page 5 of the manual, section modules-load.d, and yes it's giving very "quiet config directory that runs the whole show" energy.


๐ŸŒธ NAME ๐ŸŒธ

modules-load.d โ€” configure kernel modules to load at boot ๐Ÿงš


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

/etc/modules-load.d/*.conf
/run/modules-load.d/*.conf
/usr/local/lib/modules-load.d/*.conf
/usr/lib/modules-load.d/*.conf

four directories, that's the whole vibe check ๐Ÿ‘‘


๐Ÿ’– DESCRIPTION ๐Ÿ’–

so systemd-modules-load.service(8) reads the files in all those directories up there โ˜๏ธ and they contain kernel modules to load during boot, in a static list. every config file gets named in the style of /etc/modules-load.d/program.conf.

ngl though? usually it's a way better idea to just let the kernel auto-load modules by PCI IDs, USB IDs, DMI IDs or similar triggers that are baked right into the modules themselves instead of doing static config like this. fr fr, most modern kernel modules are already prepped for automatic loading. the static list is lowkey the backup plan, not the main character ๐ŸŒˆ


๐Ÿฆ‹ CONFIGURATION FORMAT ๐Ÿฆ‹

keep it simple, bestie: the config files should just contain a list of kernel module names to load, separated by newlines. that's it. that's the whole file ๐Ÿ’…

empty lines? ignored. lines whose first non-whitespace character is # or ;? also ignored. iconic behaviour, no notes โœจ


๐Ÿ‘‘ CONFIGURATION DIRECTORIES AND PRECEDENCE ๐Ÿ‘‘

okay this is the part where it gets a lil spicy ๐ŸŒถ๏ธ config files are read from /etc/, /run/, /usr/local/lib/, and /usr/lib/, in order of precedence, exactly as listed in the SYNOPSIS up there. files must have the .conf extension, no exceptions.

  • files in /etc/ override files with the same name in /run/, /usr/local/lib/, and /usr/lib/
  • files in /run/ override files with the same name under /usr/

and here's the twist ๐ŸŒ€ all configuration files are sorted by their filename in lexicographic order, regardless of which of those directories they live in. so if multiple files specify the same option, the entry in the file with the lexicographically latest name wins. periodt.

so the way you can change stuff is either:

  • replace a config completely โ€” drop a file with the same name in a directory with higher priority ๐Ÿ’ฅ
  • or just tweak individual settings โ€” add extra settings in a file with a different name that sorts later ๐ŸŽฏ

Packages should install their configuration files in /usr/lib/ (that's for distribution packages) or /usr/local/lib/ (that's for local installs) [1]. meanwhile /etc/ is reserved for the local administrator, who can use all this logic to override the config files that vendor packages installed. main character energy only ๐Ÿ’…


๐ŸŒŸ the naming convention (do this, it's cute) ๐ŸŒŸ

it is recommended to prefix all filenames with a two-digit number and a dash, because it makes the ordering so much easier to reason about ๐Ÿง โœจ

  • use the range 10-40 for configuration files in /usr/
  • use the range 60-90 for configuration files in /etc/ and /run/

why? so that local and transient configuration files will always take priority over the config files shipped by the OS vendor. slay, hierarchy, we love to see it ๐Ÿ‘‘


if the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to /dev/null in the configuration directory in /etc/, with the same filename as the vendor configuration file.

โš ๏ธ heads up: if the vendor configuration file is included in the initrd image, the image has to be regenerated. don't forget, or you'll be sitting there like ๐Ÿ˜ญ wondering why nothing changed.

๐Ÿ“ EXAMPLE ๐Ÿ“

Example 1. /etc/modules-load.d/virtio-net.conf example:

# Load virtio-net.ko at boot
virtio-net

look at her. one line. flawless. ๐Ÿ’–


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ


๐Ÿ’ฃ NOTES ๐Ÿ’ฃ

  1. ๐Ÿ’ฃ๐Ÿ’ฅ๐Ÿงจ๐Ÿ’ฅ๐Ÿ’ฅ๐Ÿ’ฃ Please note that those configuration files must be available at all times. If /usr/local/ is a separate partition, it may not be available during early boot, and must not be used for configuration. this one is serious bestie, do not skip it ๐Ÿ˜ค

and that's the whole page!! this was MODULES-LOAD.D(5) from systemd 262.1 โ€” yeah, that's the version, she's current, she's thriving ๐Ÿ’œ go forth and load your modules responsibly, ily ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms