This question already has an answer here:

I've read several sources so far. Here are the three options I have encountered:




I was originally putting my service in /lib/systemd/system, and it seems a bunch of other services are in that directory as well. However, it's supposed to be in /etc/systemd/system?? This source never talks about the third option: Where do I put my systemd unit file on Arch Linux?

Also, this tutorial seems to put it in that directory. http://www.raspberrypi-spy.co.uk/2015/10/how-to-autorun-a-python-script-on-boot-using-systemd/

Please help clarify for me. Enabling my unit is leading to an error message: "Failed to enable unit: Invalid argument" I hypothesize because the directory is wrong. (I am using Arch Linux)

marked as duplicate by don_crissti, Rui F Ribeiro, Romeo Ninov, Anthon, Shadur Jul 19 '17 at 6:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @don_crissti Sorry, my mistake so in that case the tutorial i posted is not accurate? – Goldname Jul 18 '17 at 23:08

I use Systemd services to launch "kiosk"-style Pi (running CentOS) systems. Systemd pulls from a few configuration directories, but generally you should put Systemd services in /etc/systemd/system/

There are, of course, some requirements of what must be contained in the service file, but as long as it's in that directory, a sudo systemctl enable foo.service enables that service. If you put your services in that directory and are still encountering errors, check your service file. It should contain at least:

Description=Sample Script Startup



The Type and WantedBy attributes may vary, depending on what you're trying to achieve, so read the docs!

  • ah ok thanks. So for the After = ... should I spell out the full directory since these services will be in different directories? – Goldname Jul 18 '17 at 23:09
  • 1
    No, you shouldn't have to do that. After should understand target names (bar.target) and should not need full paths. – Klaatu von Schlacker Jul 19 '17 at 0:31

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