Ubuntu service debugging

List all services

  • systemctl list-units --type service  --no-pager

Example: nut-driver on Ubuntu 18.04

  • service nut-driver restart
    • Job for nut-driver.service failed because the control process exited with error code.
      See "systemctl status nut-driver.service" and "journalctl -xe" for details.
  • systemctl status nut-driver.service
    •  nut-driver.service - Network UPS Tools - power device driver controller
         Loaded: loaded (/lib/systemd/system/nut-driver.service; static; vendor preset: enabled)
         Active: failed (Result: exit-code) since Sun 2018-09-30 17:25:32 CEST; 7s ago
        Process: 1482 ExecStop=/sbin/upsdrvctl stop (code=exited, status=1/FAILURE)
        Process: 1471 ExecStart=/sbin/upsdrvctl start (code=exited, status=0/SUCCESS)

      Sep 30 17:25:32 xxx upsdrvctl[1471]: USB communication driver 0.33
      Sep 30 17:25:32 xxx upsdrvctl[1471]: Fatal error: 'maxretry' is not a valid variable name for this driver.
      Sep 30 17:25:32 xxx upsdrvctl[1471]: Look in the man page or call this driver with -h for a list of
      Sep 30 17:25:32 xxx upsdrvctl[1471]: valid variable names and flags.
      Sep 30 17:25:32 xxx upsdrvctl[1471]: Network UPS Tools - UPS driver controller 2.7.4
      Sep 30 17:25:32 xxx systemd[1]: nut-driver.service: Control process exited, code=exited status=1
      Sep 30 17:25:32 xxx upsdrvctl[1482]: Can't open /var/run/nut/usbhid-ups-auto.pid: No such file or directory
      Sep 30 17:25:32 xxx upsdrvctl[1482]: Network UPS Tools - UPS driver controller 2.7.4
      Sep 30 17:25:32 xxx systemd[1]: nut-driver.service: Failed with result 'exit-code'.
      Sep 30 17:25:32 xxx systemd[1]: Failed to start Network UPS Tools - power device driver controller.
  • cd /etc/nut
    • grep maxretry *
    • fix error
  • service nut-driver restart
  • service nut-driver status