SysTutorials

Loading a Kernel Module Automatically at Boot on CentOS

· updated April 12, 2026

To load a kernel module automatically at system startup, create a configuration file in /etc/modules-load.d/ with a .conf extension. The systemd-modules-load.service daemon reads these files during early boot and loads the specified modules.

Basic method

Create a new configuration file. For the ixgbe driver example:

echo "ixgbe" | sudo tee /etc/modules-load.d/ixgbe.conf

Or use your editor of choice:

sudo nano /etc/modules-load.d/ixgbe.conf

Add the module name, one per line:

ixgbe

Save and reboot to verify the module loads:

sudo reboot

After reboot, confirm the module is loaded:

lsmod | grep ixgbe

Or check with modinfo:

modinfo ixgbe

Loading multiple modules

If you need to load several related modules, add them all to the same file or create separate files — both approaches work fine:

sudo tee /etc/modules-load.d/network-drivers.conf << EOF
ixgbe
bnx2x
mlx5_core
EOF

The filename doesn’t matter, only the .conf extension. systemd processes all files in the directory, so you can organize them however makes sense for your infrastructure.

Module dependencies and ordering

systemd-modules-load.service respects module dependencies automatically. If module B depends on module A, listing only B will load both. However, if you need explicit ordering (rare), you can split into multiple files and use numeric prefixes:

/etc/modules-load.d/10-base-drivers.conf
/etc/modules-load.d/20-network-drivers.conf

Files are processed in lexicographic order, so 10 loads before 20.

Passing module parameters

If your module requires parameters, use /etc/modprobe.d/ instead. For example, with ixgbe:

sudo tee /etc/modprobe.d/ixgbe.conf << EOF
options ixgbe max_vfs=7
options ixgbe interrupt_type=msix
EOF

Then add the module name to /etc/modules-load.d/ as usual. The parameters defined in modprobe.d are applied when the module loads.

Troubleshooting

If a module fails to load at boot, check the journal:

sudo journalctl -u systemd-modules-load.service

Verify the module exists and is available for your kernel:

modprobe -l | grep ixgbe

If the module isn’t found, you may need to install a dkms package or verify the driver is available for your kernel version.

Test loading the module manually first:

sudo modprobe ixgbe

If it works manually but not at boot, check for parameter conflicts or missing dependencies in your modprobe.d configuration.

Checking boot-loaded modules

List all currently loaded modules:

lsmod

Verify your specific module is present in the output, or use grep for cleaner output:

lsmod | grep ixgbe

Check when the module was loaded during boot with dmesg:

dmesg | grep ixgbe

For detailed documentation on the modules-load.d configuration format, consult the man page:

man modules-load.d

Troubleshooting Common Issues

When encountering problems on Linux systems, follow a systematic approach. Check system logs first using journalctl for systemd-based distributions. Verify service status with systemctl before attempting restarts. For network issues, use ip addr and ss -tulpn to diagnose connectivity problems.

Package management issues often stem from stale caches. Run dnf clean all on Fedora or apt clean on Ubuntu before retrying failed installations. If a package has unmet dependencies, try resolving them with dnf autoremove or apt autoremove.

These commands are frequently used alongside the tools discussed in this article:

Quick Verification

After applying the changes described above, verify that everything works as expected. Run the relevant commands to confirm the new configuration is active. Check system logs for any errors or warnings that might indicate problems. If something does not work as expected, review the steps carefully and consult the official documentation for your specific version.

← All posts