找出失败的服务
只读systemctl --failed --no-pager跑完应看到: 空列表表示当前没有标记为失败的 systemd 单元。
基础检查 3 / 3
03 / FIELD NOTES
列出失败的 systemd 服务、监听端口和本次启动的错误日志。
先看实际状态,再决定要不要重启。端口冲突和明确的错误日志,通常比盲目重装更能说明问题。
安装软件后验证状态,或网站与面板打不开时。
适用于 systemd 系统。Alpine(OpenRC)请用 rc-status,并查看 /var/log 下的日志。
systemctl --failed --no-pager跑完应看到: 空列表表示当前没有标记为失败的 systemd 单元。
sudo ss -lntp跑完应看到: 查看哪个进程占用端口,以及它监听本机还是所有网卡。root 账号可省略 sudo。
sudo journalctl -p err -b -n 30 --no-pager跑完应看到: 先读错误再操作。日志可能包含隐私信息,分享前请检查。
只读。不重启服务,也不修改防火墙。
{
"slug": "service-health",
"risk": "safe",
"tags": [
"systemd",
"ports",
"logs",
"linux"
],
"updated": "2026-10-30",
"pathIndex": 3,
"why": "先看实际状态,再决定要不要重启。端口冲突和明确的错误日志,通常比盲目重装更能说明问题。",
"steps": [
{
"command": "systemctl --failed --no-pager",
"risk": "safe"
},
{
"command": "sudo ss -lntp",
"risk": "safe"
},
{
"command": "sudo journalctl -p err -b -n 30 --no-pager",
"risk": "safe"
}
]
}