Explicit kernel module load at startup

grsecuritykernel-modulesstartup

I'm using grsecurity kernel which disallows automatic kernel load thus several systemd services don't work. After manually loading modules with modprobe and restarting module everything works correctly but it's quite dirty solution. I'd like to do it "properly" during startup.

OS is Arch linux with grsec kernel.

Best Answer

It'll depend somewhat on your init system (systemd, or ..) But the options are:

  • kernel command line parameter

    modules_load=

  • /etc/modules-load.d/modules.conf

    # /etc/modules: kernel modules to load at boot time.
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.

For desktop/laptops, people usually expect to be able to plug in devices and for the driver modules to load.

If this isn't your use case, you could also look at compiling the kernel with the relevant module code statically linked in (so no module loading occurs at all) and disabling the module system entirely. There are limits on kernel binary size (limiting number of modules that can be compiled statically) on 32-bit architectures.

See : "make localmodconfig"

Related : using sysctl to prevent further module loading

Related: Fedora, loading modules at startup

Related Question