Linux – How to figure out why systemctl service “systemd-modules-load” fails

debiankernel-modulelinuxsystemdusb-hid

For some time I've seen some red text flashing by during boot. Today I decided to look into it. The systemctl service systemd-modules-load.service is failing with this text:

tomas@bonus-debian:~$ sudo systemctl status systemd-modules-load
● 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 ma. 2015-11-09 02:58:48 CET; 5min ago
     Docs: man:systemd-modules-load.service(8)
           man:modules-load.d(5)
  Process: 644 ExecStart=/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
 Main PID: 644 (code=exited, status=1/FAILURE)

nov. 09 02:58:48 bonus-debian systemd[1]: Starting Load Kernel Modules...
nov. 09 02:58:48 bonus-debian systemd-modules-load[644]: Failed to find module '-r usbhid'
nov. 09 02:58:48 bonus-debian systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
nov. 09 02:58:48 bonus-debian systemd[1]: Failed to start Load Kernel Modules.
nov. 09 02:58:48 bonus-debian systemd[1]: systemd-modules-load.service: Unit entered failed state.
nov. 09 02:58:48 bonus-debian systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.

I thought I'd start out by Googling the issue:

Screenshot

Ouch.

My system doesn't seem to mind that the driver failed to load, as I haven't noticed a degraded experience, but I'd still like to fix it.

Since Google got me nowhere, I'm stuck already. I have no idea where to start looking.

How do I figure out why systemctl service "systemd-modules-load" fails?

Best Answer

I too had this issue. I was able to solve it by following the instructions on the Arch Linux systemd wiki page. Here is a summary of what I did :

  1. Lets find the systemd services which fail to start

    $ systemctl --failed  
    ------------------------------------------------------------------------
    systemd-modules-load.service   loaded failed failed  Load Kernel Modules
    
  2. Ok, we found a problem with systemd-modules-load service. We want to know more.

    $ systemctl status systemd-modules-load  
    ------------------------------------------------------------------------
    systemd-modules-load.service - Load Kernel Modules      
       Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static)     
       Active: failed (Result: exit-code) since So 2013-08-25 11:48:13 CEST; 32s ago  
         Docs: man:systemd-modules-load.service(8).  
               man:modules-load.d(5)
      Process: 15630 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
    

    If the Process ID is not listed, just restart the failed service with

    $ systemctl restart systemd-modules-load
    
  3. Now we have the process id (PID) to investigate this error in depth. Enter the following command with the current Process ID (here: 15630):

    $ journalctl _PID=15630
    ----------------------------------------------------------------------
    -- Logs begin at Sa 2013-05-25 10:31:12 CEST, end at So 2013-08-25 11:51:17 CEST. --
    Aug 25 11:48:13 mypc systemd-modules-load[15630]: Failed to find module 'blacklist usblp'
    Aug 25 11:48:13 mypc systemd-modules-load[15630]: Failed to find module 'install usblp /bin/false'
    
  4. We see that some of the kernel module configs have wrong settings. Therefore we have a look at these settings in /etc/modules-load.d/

    $ ls -Al /etc/modules-load.d/
    ----------------------------------------------------------------------
    ...  
    -rw-r--r--   1 root root    79  1. Dez 2012  blacklist.conf  
    -rw-r--r--   1 root root     1  2. Mär 14:30 encrypt.conf  
    -rw-r--r--   1 root root     3  5. Dez 2012  printing.conf  
    -rw-r--r--   1 root root     6 14. Jul 11:01 realtek.conf  
    -rw-r--r--   1 root root    65  2. Jun 23:01 virtualbox.conf  
    ...  
    
  5. The Failed to find module 'blacklist usblp' error message might be related to a wrong setting inside of blacklist.conf. Lets deactivate it with inserting a trailing # before each option we found via step 3:

    /etc/modules-load.d/blacklist.conf  
    ----------------------------------------------------------------------
    # blacklist usblp  
    # install usblp /bin/false  
    
  6. Now, try to start systemd-modules-load:

    $ systemctl restart systemd-modules-load  
    

    If it was successful, this should not prompt anything. If you see any error, go back to step 3 and use the new PID for solving the errors left.

    If everything is ok, you can verify that the service was started successfully with:

    $ systemctl status systemd-modules-load
    ----------------------------------------------------------------------
    systemd-modules-load.service - Load Kernel Modules
       Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static)
       Active: active (exited) since So 2013-08-25 12:22:31 CEST; 34s ago
         Docs: man:systemd-modules-load.service(8)
               man:modules-load.d(5)
     Process: 19005 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=0/SUCCESS)
    Aug 25 12:22:31 mypc systemd[1]: Started Load Kernel Modules.
    
Related Question