Kernel Modules Autoload

Hi,

I am preparing kernel snap with kernel modules. I am able to load using insmod. How can I instruct UC to autoload the kernel modules (.ko) during boot?

Some kernel modules are automatically loaded via /etc/modules-load.d files for specific interfaces (eg. kvm). There is also kernel-module-control which is privileged and will require an assertion to auto-connect, but IIRC you cannot manipulate /etc/modprobe.d or /etc/modules-load.d. I know that @pedronis was writing a spec for a separate interface that gives more control over module loading, including passing specific parameters and so on, but this is a work in progress thing.

Actually, we already have a branch with the proposed implementation: https://github.com/snapcore/snapd/pull/10977

It’s just waiting for review :slight_smile:

if you create a whole image it is pretty easy to define all force-loaded modules on your kernel cmdline via the modules_load parameter in your gadget:

https://www.freedesktop.org/software/systemd/man/systemd-modules-load.service.html#

(the same goes for blacklisting any modules, works from cmdline as well)