3

Given a kernel module, my-module.ko, I have taken the following steps to try and automatically load the module at boot:

cp my-module.ko /lib/modules/$(uname -r)/my-module.ko
echo my-module >> /etc/modules-load.d/my-module.conf
# alt: echo my-module >> /etc/modules
echo my-module.ko: >> /lib/modules/$(uname -r)/modules.dep
# alt: depmod
systemctl restart systemd-modules-load
# alt: reboot the machine

No matter what variation I try, the error is always the same:

● systemd-modules-load.service - Load Kernel Modules
   Loaded: loaded (/lib/systemd/system/systemd-modules-load.service; static; vendor preset: enabled)
   Active: failed (Result: exit-code) since <date>; 9s ago
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 318 ExecStart=/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
 Main PID: 318 (code=exited, status=1/FAILURE)

Feb 14 03:19:58 localhost systemd[1]: Starting Load Kernel Modules...
Feb 14 03:19:58 localhost systemd-modules-load[318]: Failed to find module 'my-module'
Feb 14 03:19:58 localhost systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
Feb 14 03:19:58 localhost systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.
Feb 14 03:19:58 localhost systemd[1]: Failed to start Load Kernel Modules.

Specifically "Failed to find module." I can run modprobe my-module and the module is discovered and loaded just fine. I glossed over the sources for systemd and libkmod, and the default module directory is /lib/modules/$(uname -r) as expected. Also the name is compared against the various files modules.dep, modules.alias, etc. so the service technically should be able to find it.

What more can I try to get this working? I would prefer to use the systemd-modules-load service rather than writing my own service that does virtually the same thing.

System Specs: ARMv7, Debian, Linux Kernel v4.9.37, Systemd v241-7~deb10u2; Note: depmod is a simlink to busybox

1 Answer 1

0

Upon closer inspection from within libkmod, I discovered that modules.dep.bin was being used as the reference source file as apposed to modules.dep.

ls -al /sbin | grep depmod yielded depmod -> /bin/busybox

Changing things up:

rm /sbin/depmod
apt install kmod
ln -s /usr/bin/kmod /sbin/depmod
depmod

Now everything is working beautifully! Turns out the busybox version of depmod was not properly updating the module.dep.bin file - hence why systemd "Failed to find module."

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .