Systemctl shows service file not-found, even though .service file is present

systemctlsystemd

I am running into a weird issue. I have a service file to start a custom application. systemctl command shows LOAD as not-found

resource-service-prod-prod.service not-found active running resource-service-prod-prod.service

however, file is shown in

ls -lrt /etc/systemd/system
lrwxrwxrwx  1 root root   96 Mar  5  2017 resource-service-prod.service -> /opt/app/daps-prod/resource-service/bin/resource-service-prod-prod.service

service status shows as running, but loaded: not-found (Reason: No such file or directory)

sudo service resource-service-prod status
Redirecting to /bin/systemctl status resource-service-prod.service
● resource-service-prod-prod.service
   Loaded: not-found (Reason: No such file or directory)
   Active: active (running) since Thu 2018-12-20 06:40:37 CST; 3 weeks 0 days ago
 Main PID: 12888 (node)
   CGroup: /system.slice/resource-service-prod-prod.service
           ├─12888 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12923 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12924 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12930 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12936 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12942 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12943 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12949 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12960 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12961 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12972 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           ├─12978 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js
           └─12984 /usr/bin/node /opt/app/daps-prod/resource-service/source/app.js

Application stops on issuing service stop, but while trying to start back, it wont (since file not found). Doing a systemctl daemon-reload helps start back the service and service file is shown as loaded. Any idea why this kind of a behaviour ?

actual service file is on a separate mount and it is a symlink in /etc/systemd/system

Best Answer

I know this is several months old, but for the record, also check the config file for the service. You can get this message because a dependency unit was not found. Systemd doesn't seem to give enough detail in the error message where it differentiates between the main unit you are starting and a dependent unit. Sometimes it will work around these issues at boot and then fail if you do it manually, which is quite maddening.