I have created the service sendir.service and put it in /etc/systemd/system

This is what the service looks like:




And this is the script for the service /usr/local/bin/sendir:


irsend SEND_ONCE ph_remote KEY_POWER

When I try to enable the service via sudo systemctl enable sendir.service --now I'm getting this error message

Synchronizing state of sendir.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable sendir
update-rc.d: error: sendir Default-Start contains no runlevels, aborting.

Does anybody know what I'm doing wrong?

2 Answers 2


The system is trying to keep the systemd System and Service Manager insync with the legacy SYSV (UNIX System V and BSD System and Service Manager).

systemd is controlled using systemctl, while SYSV is controlled using the service command.

I believe that this AskUbuntu answer is the fix for your problem. The only thing different about your situation is that your custom script runs at service stop instead of service start.

Try adding the following to your /usr/bin/local/sendir script:

# Provides:          sendir
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Execute sendir at service termination ...
  • The file already points at the service file: ExecStop=/usr/local/bin/sendir. It should be executed at every shutdown as you can see here.
    – jake
    Oct 9, 2018 at 1:00
  • @jake Ah, I didn't catch that ... you're saying that /usr/local/bin/sendir is the Bash script he shows. Perhaps then the sendir file just needs to include the BEGIN INIT INFO. I'll edit the question to show the name of the Bash script. Oct 9, 2018 at 14:39
  • Maybe he could put his one-liner directly into the service file. Like ExecStop=/bin/bash irsend SEND_ONCE ph_remote KEY_POWER. What do you think?
    – jake
    Oct 9, 2018 at 14:54
  • I have now tried both methods. I have added the BEGIN INIT INFO to the script and also put the command like @jake mentioned directly in the service. Bot I got the exact same error message again, when I try to enable the service. Can it be that somethings is wrong with the service file itself?
    – apfelcast
    Oct 9, 2018 at 18:38
  • @apfelcast What version of Raspbian are you using? I'm on Stretch version 9 and the enable worked for me. I need try again this time removing the INIT INFO to see if I can recreate your error. Oct 9, 2018 at 18:52

I now got the service running by changing the service it self and adding Before=shutdown.target to it.

The sendir.service now looks like this:

Description= sending



I could enable the service without any problems now and it also sends the ir signal like is should.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.