I want to create a systemctl service that mounts partitions required by lighttpd. In the my-service.service file, I wrote the following:




But when I want to enable it, I have the following error printed in syslog:

systemd[1]: Reloading.
systemd[1]: /etc/systemd/system/my-service.service:2: Failed to add dependency on lighttpd, ignoring: Invalid argument

I don't understand how I can force lighttpd to be launched after my-service...

From the manual:

Before=: The units listed in this directive will not be started
         until the current unit is marked as started if they are
         activated at the same time. This does not imply a dependency
         relationship and must be used in conjunction with one of the
         above directives if this is desired.
  • you don't put your partition in the /etc/fstab? – c4f4t0r May 28 '19 at 18:32
  • the service does more than that. Actually it's related to the mount of an encrypted folder with custom things to be done – Jav May 29 '19 at 7:56

The name of the unit is lighttpd.service, not just lighttpd, so that is what you need to specify.

| improve this answer | |

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.