文章目录
发现问题
ubuntu 系统一天内死机了 5 次, 物理表现为电源与风扇仍在运行, 但屏幕黑屏, 键鼠无响应, ssh 无法连上, 只能强制关机后重启
系统信息如下
sh
Linux 5.8.0-59-generic #66~20.04.1-Ubuntu SMP Thu Jun 17 11:14:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
NVIDIA-SMI 570.172.08
排查问题
使用 last reboot
命令确定各次死机后重启的时间, 间接获取大概的死机时间
sh
reboot system boot 5.8.0-59-generic Fri Aug 1 17:19 still running
reboot system boot 5.8.0-59-generic Fri Aug 1 15:55 still running
reboot system boot 5.8.0-59-generic Fri Aug 1 14:23 still running
reboot system boot 5.8.0-59-generic Fri Aug 1 13:44 still running
reboot system boot 5.8.0-59-generic Fri Aug 1 11:43 still running
查看系统日志文件 /var/log/syslog
/var/log/syslog.1
中死机时间前后的日志, 观察到规律, 每次死机前最后一段日志都是 nvidia-suspend.service
相关如下:

已知 systemd-suspend.service
(可用 sudo systemctl suspend
命令手动触发) 会导致系统挂起, 表现为电源与风扇均在运转, 但键鼠无反应, 可通过按一下电源按钮唤醒
现在相信 "死机" 现象为 nvidia-suspend.service
触发的系统挂起现象, 搜索 linux nvidia suspend
, 发现多个网页反馈 nvidia-suspend.service
引起的系统无响应问题, 至此问题基本确定
解决问题
sh
# 禁用 nvidia suspend 相关服务
# 注意每次装新的 nvidia driver 后需重新禁用
sudo systemctl disable nvidia-suspend
sudo systemctl disable nvidia-hibernate
sudo systemctl disable nvidia-suspend-then-hibernate
reboot
查看相关服务是否已被禁用: systemctl list-unit-files | grep nvidia
, 输出结果如下, 可见已成功禁用
sh
nvidia-hibernate.service disabled enabled
nvidia-powerd.service disabled enabled
nvidia-resume.service enabled enabled
nvidia-suspend-then-hibernate.service disabled enabled
nvidia-suspend.service disabled enabled
后续持续观察是否还会出现系统无响应现象
参考链接
Tip for anyone having trouble with suspend/resume with NVIDIA: disable the NVIDIA systemd power management services, then reboot.
https://www.reddit.com/r/pop_os/comments/1hp90yy/tip_for_anyone_having_trouble_with_suspendresume/
