大网数据广告活动
服务器运维问答

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

· 52CE 我爱测

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 howeve…

问题原文

原帖链接 · CVVR · CC BY-SA 4.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

社区高分解答

原帖链接 · user31883 · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2019-01-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。