2

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.

  • 1
    Could you possibly rewrite parts of the init script that's found in the initramfs to perform the steps you require? – Hydranix Feb 4 '17 at 4:28
  • Well.. I don't think i know any way to make it update-persistent – Lapsio Feb 4 '17 at 4:33
  • A very dirty way that I've used once before what to set the immutable flag on the init file. You can always create a custom hook file and add it to the mkinitcpio.conf – Hydranix Feb 4 '17 at 4:41
0

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

0

Modules are automatically loaded after kernel boot by placing a conf file in /etc/modules-load.d/mymodules.conf.

# Modules to load.
mymodule.ko

That's it, you're good to go.

You may also blacklist modules that are not to be loaded. The usual place for blacklisted modules is in /etc/modprobe.d. Create a conf file here, and list the modules that are never to be loaded.

# Modules to prevent from loading.
blacklist mybadmodule.ko

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.