首页/系统/信创系统运维速查/服务启动失败的标准排查流程
服务与运维65 条

服务启动失败的标准排查流程

从状态码到根因的五步:status 看错误行、journalctl 看详细日志、手动跑 ExecStart 复现、核对权限/端口/配置、修复后 reset-failed 重启验证。

信创系统运维速查系统更新于 2026-10-12

排查命令

排查命令
systemctl status myapp --no-pager -l
journalctl -u myapp -b --no-pager | tail -80
systemctl cat myapp                 # 看合并后的最终单元配置
systemctl show myapp -p User -p ExecStart -p WorkingDirectory -p Environment
su -s /bin/bash appuser -c '/opt/myapp/bin/myapp -c /etc/myapp/app.conf'   # 手动复现
ss -lntp | grep 8080                # 端口占用核对
  • 权限:程序/目录/证书属主不对(Permission denied)
  • 端口:被占用或绑定受限端口失败(Address already in use / Permission denied)
  • 配置:语法错误或路径不存在(No such file or directory)
  • 资源:句柄/内存上限触顶或 SELinux 拒绝(journal、audit 日志里确认)
status 只给摘要;真正原因几乎都在 journalctl -u 单元 的最后几十行里,先看再动手。

易错点

  • 有 drop-in 覆盖时改主单元文件不生效:用 systemctl cat 看合并后的最终配置
  • 启动成功但随后退出:重点看退出码与 Restart 策略,结合日志时间线找根因

数据来源与参考

  • man 1 systemctl
  • openEuler 文档:systemd 服务排障
​‌‌​​‌​​​‌‌​‌‌‌‌​‌‌​​​‌‌​‌‌‌​​‌‌​​‌​‌‌‌​​‌‌‌​​​‌​‌‌​‌​​‌​‌‌‌​​​‌​‌‌​‌​​‌​‌‌​​​‌‌​‌‌‌​‌​​​‌‌​‌‌‌‌​​‌​‌‌‌​​‌‌​​​‌‌​‌‌​‌‌‌‌​‌‌​‌‌​‌