systemd

systemd apparently not finding .service file


I've put together a foo.service file for our foo service that runs as a daemon. The service runs fine when I run systemctl start foo (and stop) but systemtcl enable foo results in Failed to issue method call: Invalid argument. The unit file is placed in /etc/systemd/system/foo.service, and has permissions 0755. Setting systemd to debug and running enable gives

Looking for unit files in (highest priority first):`
    /etc/systemd/system
    /run/systemd/system
    /usr/local/lib/systemd/system
    /usr/lib/systemd/system
Looking for SysV init scripts in:
    /etc/rc.d/init.d
Looking for SysV rcN.d links in:
    /etc/rd.c
Failed to issue method call: Invalid argument

Googling around, it seems like systemctl isn't finding the .service file. Is there any way to verify that? If so, how can I fix that? Any other ideas about what might be wrong? Is there more debugging I can enable? The debug info given doesn't really help me narrow down the problem.

foo.service looks like:

[Unit]
Description=Blah Blah Blah

[Service]
ExecStart=/usr/bar/doof/foo
Type=simple
PIDFile=/var/run/foo.pid

[Install]
WantedBy=multi-user.target,graphical.target

EDIT: Yes, I did run systemctl daemon-reload.


Solution

  • For people from Google: