你提到的 Debian message 不更新,通常指的是下面几种情况之一。先说最常见的原因,再给你排查办法。
motd(登录时显示的 Message Of The Day)例如 SSH 登录后看到的系统信息、欢迎语等。
apt / apt-get 的提示信息比如 “有 N 个更新可用” 这类消息。
如 /var/log/messages(Debian 默认其实用 rsyslog / journald)。
update-motd 机制没启用Debian 默认 不一定启用动态 motd。
检查:
ls -l /etc/motd
ls -l /etc/update-motd.d/
如果是静态 /etc/motd,它永远不会自动更新。
✅ 解决:
rm /etc/motd
systemctl enable motd
systemctl start motd
或确保 PAM 启用:
grep pam_motd /etc/pam.d/sshd
应有类似:
session optional pam_motd.so
unattended-upgrades 或脚本没跑动态 motd 常由以下脚本生成:
/etc/update-motd.d/*
你可以手动测试:
sudo run-parts /etc/update-motd.d/
如果没输出,说明脚本坏了或被禁用。
如果你直接改 /etc/motd,但登录仍看到旧内容:
可能是:
pam_motd 动态生成✅ 解决:
cat /etc/motd
cat /run/motd.dynamic
Debian 实际显示的是:
/run/motd.dynamic
sudo apt update
sudo apt list --upgradable
若仍显示旧消息:
sudo rm /var/lib/apt/lists/* -vf
sudo apt update
/var/log/messages在 Debian 10+:
/var/log/messagessystemd-journald查看:
journalctl -f
/etc/motd 还是动态 motd?/etc/update-motd.d/ 是否存在且可执行?pam_motd 是否在 PAM 中启用?如果你能具体说一下:
cat /etc/debian_version)我可以给你更精确的命令。