Debian 上的进程“突然消失”通常不是单一原因,而是被杀死、异常退出、资源不足或系统策略触发的结果。下面按最常见 → 较少见的顺序给你一个排查清单,并附上具体命令。
现象
Out of memory排查
dmesg | grep -i oom
journalctl -k | grep -i oom
典型日志
Out of memory: Kill process 1234 (xxx) score 800 or sacrifice child
✅ 结论:内存不足,内核强制杀进程
现象
排查
journalctl -u 你的服务名
dmesg | grep -i segfault
典型日志
segfault at 0 ip ... sp ... error 4 in libxxx.so
现象
排查
systemctl status 服务名
journalctl -u 服务名 --since "10 min ago"
常见原因:
Restart=noTimeoutStartSec / TimeoutStopSec排查
journalctl | grep -E "kill|SIGKILL|SIGTERM"
或查看历史:
history | grep kill
现象
排查
ulimit -a
cat /proc/进程号/limits
查看系统限制:
sysctl fs.file-nr
现象
排查
journalctl -k | grep -i oom
cat /sys/fs/cgroup/memory/memory.oom_control
排查
ps -ef | grep 进程名
建议
strace 看最后系统调用strace -f -o trace.log ./程序
排查
dmesg | grep -i apparmor
journalctl | grep -i audit
进程消失
↓
dmesg / journalctl
↓
有 OOM? → 内存问题
无 OOM?
↓
systemd 日志 → 服务退出
↓
无 systemd?
↓
strace / core dump
# 1. 看是不是 OOM
dmesg | tail -n 50
# 2. 看系统日志
journalctl --since "1 hour ago" | grep -E "kill|exit|segfault|oom"
# 3. 看服务
systemctl status 服务名
你可以直接贴出:
dmesg | tail -n 30我可以帮你精确定位是哪一种原因,而不是泛泛而谈。