0

I`m trying to add driver for specific hardware at startup.

Module file is located at /lib/modules/4.4.0-66-generic/kernel/drivers/misc/. Also I've tried /lib/modules/4.4.0-66-generic/kernel/drivers/misc/.

Module is successfully loaded with command:

$ sudo insmod /lib/modules/4.4.0-66-generic/kernel/drivers/misc/tmk1553b.ko d0=1 t0="MRTAI" nrt=8 misc=1

But couldn’t load module at startup.

Configuration:

OS: Ubuntu 16.04.2

$ uname -a
Linux dmitry-ws2 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/modules
# /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.

tmk1553b d0=1 t0="MRTAI" nrt=8 misc=1

Made command:

$ depmod

After restarting computer or service systemd-load-module module tmk1553b doesn’t appear into loaded kernel modules list.

Diagnostic returns Failed to find module "tmk1553b ..." error.

$ sudo systemctl restart systemd-modules-load.service 
Job for systemd-modules-load.service failed because the control process exited with error code. See "systemctl status systemd-modules-load.service" and "journalctl -xe" for details.
$ systemctl status systemd-modules-load.service 
● 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 Чт 2017-03-30 11:22:17 MSK; 25s ago
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 3971 ExecStart=/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
 Main PID: 3971 (code=exited, status=1/FAILURE)

мар 30 11:22:17 dmitry-ws2 systemd[1]: Stopped Load Kernel Modules.
мар 30 11:22:17 dmitry-ws2 systemd[1]: Starting Load Kernel Modules...
мар 30 11:22:17 dmitry-ws2 systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
мар 30 11:22:17 dmitry-ws2 systemd[1]: Failed to start Load Kernel Modules.
мар 30 11:22:17 dmitry-ws2 systemd[1]: systemd-modules-load.service: Unit entered failed state.
мар 30 11:22:17 dmitry-ws2 systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.
$ journalctl -xe
мар 30 11:22:17 dmitry-ws2 sudo[3968]:   dmitry : TTY=pts/1 ; PWD=XXX; USER=root ; COMMAND=/bin/systemctl restart systemd-modules-load.service
мар 30 11:22:17 dmitry-ws2 sudo[3968]: pam_unix(sudo:session): session opened for user root by dmitry(uid=0)
мар 30 11:22:17 dmitry-ws2 systemd[1]: Stopped Load Kernel Modules.
-- Subject: Завершена остановка юнита systemd-modules-load.service.
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Процесс остановки юнита systemd-modules-load.service был завершен.
мар 30 11:22:17 dmitry-ws2 systemd[1]: Starting Load Kernel Modules...
-- Subject: Начинается запуск юнита systemd-modules-load.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Начат процесс запуска юнита systemd-modules-load.service.
мар 30 11:22:17 dmitry-ws2 systemd-modules-load[3971]: Failed to find module 'tmk1553b d0="1" t0="MRTAI" nrt=8 misc=1'
мар 30 11:22:17 dmitry-ws2 systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
мар 30 11:22:17 dmitry-ws2 systemd[1]: Failed to start Load Kernel Modules.
-- Subject: Ошибка юнита systemd-modules-load.service
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Произошел сбой юнита systemd-modules-load.service.
-- 
-- Результат: failed.

What is going wrong?

UPDATE 1:

$ cat /lib/modules/4.4.0-66-generic/modules.dep | grep tmk1553b
kernel/drivers/misc/tmk1553b.ko:

modprobe command returns with success

$ sudo modprobe tmk1553b d0=1 t0="MRTAI" nrt=8 misc=1

UPDATE 2:

Actions I made during driver installation:

$ cp tmk1553b.ko /lib/modules/`uname -r`/kernel/drivers/misc/
$ echo tmk1553b d0=1 t0="MRTAI" nrt=8 misc=1 >> /etc/modules
$ depmod
$ reboot

This sequence works well on Ubuntu 14.04 but fails on Ubuntu 16.04.2

  • Solution found: systemd-modules-load could not divide module name and options. Module options must be specified in /etc/modprobe.d/*.conf – Dmitry Petrov Apr 12 '17 at 8:54
  • 1
    Please don't edit the solution in your question. If a given answer solved your problem, accept it, you can add more information in comments under the answer. If none of the given answers solved your problem you can answer your own question. Only accepting an answer will mark your question as "solved". – Gerald Schneider Apr 12 '17 at 10:13
2

In order to be loaded successfully at boot time, your module should be loadable using modprobe instead of insmod. You can try using:

modprobe tmk1553b d0=1 t0="MRTAI" nrt=8 misc=1

Running sudo depmod is necessary after installing the module under the path /lib/modules/$(uname -r). You can confirm this looking for your module file in the file:

/lib/modules/$(uname -r)/modules.dep
  • modprobe works well, module tmk1553b present in modules.dep. See update 1 – Dmitry Petrov Mar 30 '17 at 12:29
2

Investigations revealed that systemd is unable to load modules with options. Solution worked for me:

  • place module name to /etc/modules
  • place module options to /etc/modprobe.d/options-tmk1553b.conf
$ cat /etc/modules
tmk1553b
$ cat /etc/modprobe.d/options-tmk1553b.conf
options tmk1553b d0=1 t0="MRTAI" nrt=8 misc=1

Seems this is common behavior for linux distributions with systemd init system

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.