0

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

  • 2
    OK, so where did the service file go? – Michael Hampton Jan 10 at 21:10
  • service file is present in the path /opt/app/daps-prod/resource-service/bin/resource-service-prod-prod.service and symlink is also present (not broken) /etc/systemd/system/resource-service-prod.service ... Problem is systemctl shows LOAD as not-found for this service. systemctl daemon-reload after stopping the service shows LOAD as active .... – CVVR Jan 12 at 0:16
1

It may be that the service file was moved away while the service was running. You may need to run systemctl daemon-reload. Of course, verify the file /opt/app/daps-prod/resource-service/bin/resource-service-prod-prod.service is actually there.

[root@storage system]# systemctl status smb.service
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
...
[root@storage system]# systemctl daemon-reload
[root@storage system]# systemctl status smb.service
● smb.service
   Loaded: not-found (Reason: No such file or directory)
...
[root@storage system]# ln -s /opt/smb.service /usr/lib/systemd/system/smb.service
[root@storage system]# systemctl status smb.service
● smb.service
   Loaded: not-found (Reason: No such file or directory)
...
[root@storage system]# systemctl daemon-reload
[root@storage system]# systemctl status smb.service
● smb.service - Samba SMB Daemon
   Loaded: loaded (/opt/smb.service; enabled; vendor preset: disabled)
  • i am running systemctl daemon-reload after stopping the service. That brings back the service file as LOAD active in systemctl. My question is why would it turn to Not-found (this is seen happening on 4 servers). There are no changes done on these servers while the application is started. Does having /opt as a separate mount got something to do with this kind of a behaviour ? – CVVR Jan 12 at 0:18
  • It should not change on its own - I would suggest creating an audit rule against the directory/file to see if something is making changes to it. – Paweł Adamski Jan 13 at 19:39
1

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.

  • +1 beer from my part. This is maddening for sure. In my case it was a missing mysql.service that caused my hand made service to just error out that it's not there :-/ – CoolGoose Jun 17 at 9:08

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.