systemd apparently not finding .service file

For people from Google:

  • Validate with sudo systemd-analyze verify NAME.service
  • When using a symlink, make sure it uses absolute path
  • Make sure the name is like /etc/systemd/system/*.service
  • Do sudo systemctl daemon-reload after changes

The issue in my case was the file was symlinked from another partition and systemd do not support that.

Unit files have to reside on a partition that is mounted at the moment the host PID 1 is invoked. i.e. either on the root partition or some other partition that the initrd premounts.

I'm answering to an old question because this is a top result while googling on the issue and might help someone


I found this question over google, searching for "systemctl unit not found"

In my case I generated a *.service file via podman and no matter what I did, systemctl wouldn't find the service file.

Solution was to check selinux and set the correct labels. Example:

/sbin/restorecon -v /etc/systemd/system/container_httpd.service

Tags:

Systemd