0

I have created a static systemd service file 'irtrans.service' as follows:

[Unit]
Description=irtrans daemon
After=network-online.target

[Service]
Type=forking
#EnvironmentFile=/etc/conf.d/lircd.conf
#PIDFile=/run/lirc/lircd.pid
ExecStartPre=/bin/mkdir -p /var/run/lirc
ExecStartPost=/bin/ln -s /dev/lircd /var/run/lirc/lircd 

ExecStart=/usr/local/irtrans/irserver64 -timestamp -logfile /var/log/irtrans.log -loglevel 4 -daemon 172.31.252.14

ExecStopPost=/bin/rm -f /dev/lircd
ExecStopPost=/bin/rm -fR /var/run/lirc

[Install]
#WantedBy=kodi.service

and a kodi.service file as follows:

[Unit]
Description = kodi-standalone using xinit
After = remote-fs.target systemd-user-sessions.service
Wants = irtrans.service

[Service]
User = kodi
Group = kodi
PAMName = login
Type = simple
ExecStart = /usr/bin/xinit /usr/bin/dbus-launch /usr/bin/kodi-standalone -- :0 -nolisten tcp
Restart = on-abort

[Install]
WantedBy = multi-user.target

On startup the kodi service starts, but the irtrans service fails. I can start the irtrans service manually after the system starts, but after bootup it fails to start automatically. The systemctl status for irtrans shows:

● irtrans.service - irtrans daemon
   Loaded: loaded (/etc/systemd/system/irtrans.service; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2016-12-24 17:44:52 EST; 1min 31s ago
  Process: 767 ExecStart=/usr/local/irtrans/irserver64 -timestamp -logfile /var/log/irtrans.log -loglevel 4 -daemon 172.31.252.14 (c
  Process: 755 ExecStartPre=/bin/mkdir -p /var/run/lirc (code=exited, status=0/SUCCESS)

Dec 24 17:44:47 pclivingroom.ocg.ca systemd[1]: Starting irtrans daemon...
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: irtrans.service: Control process exited, code=exited status=1
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: Failed to start irtrans daemon.
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: irtrans.service: Unit entered failed state.
Dec 24 17:44:52 pclivingroom.ocg.ca systemd[1]: irtrans.service: Failed with result 'exit-code'.

Can someone explain why this is happening and how to fix it? I assume it means irtrans is executable is failing to start, but it only depends on the network which I have listed as a dependency.

Suggestions?

  • Anything interesting in the logfile? (/var/log/irtrans.log)? – Bigon Dec 24 '16 at 23:22
  • Interesting messages in file...which makes me ask. By default what account do systemd service run under? – TSG Dec 25 '16 at 3:07
  • Why didnt you use rc.local to do it? Because the application generated log files. – supriady Dec 25 '16 at 6:39
  • By default it starts the services as root – Bigon Dec 25 '16 at 10:08
  • The messages indicated a permissions problem. When I added user=root to services section it started to work. Can someone explain that? – TSG Dec 25 '16 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.