How to force load kernel module (modprobe -f) on startup?

6,315

You should be able to override the install behaviour using a configuration file in /etc/modprobe.d, for example /etc/modprobe.d/module_name.conf:

install module_name /sbin/modprobe -i -f module_name

This instructs the module loading code to run /sbin/modprobe -i -f module_name when a request is made to install module_name. -i tells modprobe to ignore install directives when processing the command (otherwise we’d end up with a loop).

Share:
6,315

Related videos on Youtube

user335490
Author by

user335490

Updated on September 18, 2022

Comments

  • user335490
    user335490 almost 2 years

    I would like to load a custom kernel module upon startup on my system (Debian 9). The vermagic string of this module does not exactly match my kernel version, but I can load it using modprobe -f module_name or insmod -f /path/to/module and it seems to work fine.

    If I just add the name of the module to /etc/modules-load.d/modules.conf it does not work, systemctl shows that systemd-modules-load.service gets an error upon trying to load the module.

    Can I tell systemd to force load the module?