I'm trying to check if this solution would help me with auto restarting after shutdown.

But command sudo systemctl enable haltusbpower.service is followed by error:

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

My /usr/lib/systemd/system/haltusbpower.service file:




My /usr/local/bin/haltusbpower.sh script:

for i in /sys/bus/usb/devices/*/power/control;
        do echo on > $i

It has execute option:

karol@karol:~$ ls -l /usr/local/bin/haltusbpower.sh
-rwxr-xr-x 1 root root 88 kwi 27 13:03 /usr/local/bin/haltusbpow

Why enabling haltusbpower doesn't work? And what followed error means? I don't understand where to look for errors.

  • 2
    I found my answer in this forum thread Long story short I had my old System V (service) file in my /etc/init.d directory so the system was trying to resolve the legacy code as well Dec 8, 2018 at 5:37

3 Answers 3


At the top of your /usr/local/bin/haltusbpower.sh script add something like this:

# Provides:          haltusbpower
# Required-Start:    $all
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Halts USB power...
  • 8
    Can you add some explanation to this?
    – Bugs Buggy
    Aug 20, 2018 at 17:20
  • 1
    "haltusbpower" should be replace with your service name. Feb 14, 2019 at 10:29
  • 1
    @BugsBuggy here is the official manual for LSBInitScripts: wiki.debian.org/LSBInitScripts
    – eapo
    Mar 16, 2022 at 2:39

I had the same error message but it included a message about missing LSB tags and overrides.

I looked in htop and had multiple processes tailing the log from when I tested the service using /usr/local/bin/./MyService.sh start and /usr/local/bin/./MyService.sh stop. Once I killed these processes it was successful.

The start and stop test command was taken from http://www.jcgonzalez.com/ubuntu-16-java-service-wrapper-example


I just wanted to repost the comment attached to original question as an answer since it was resolved my issue.

I had started with a shell script /etc/init.d/kafka and was using that with a start and stop flag. I then wrote a SystemD unit file and placed it in /etc/systemd/system/kafka.service. Many systemctl commands such as systemctl cat kafka and systemctl status kafka show that the unit-file was detected as the latter kafka.service file, yet somehow old one in /etc/init.d conflicted with this. As soon as I removed it, I was able to enable the service.

I cannot find any documentation on this behavior.

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.