你是说 Debian 系统里那些“烦人的提示/消息” 吧?不同场景关闭方式不一样,下面按最常见情况给你总结。
sudo systemctl disable motd-news.timer
sudo systemctl stop motd-news.timer
或直接删除 MOTD 文件:
sudo rm -f /etc/motd
sudo rm -f /var/run/motd.dynamic
sudo chmod -x /etc/update-motd.d/*
只保留你想要的,比如:
sudo chmod +x /etc/update-motd.d/00-header
编辑 SSH 配置:
sudo nano /etc/ssh/sshd_config
添加或修改:
PrintMotd no
PrintLastLog no
然后重启 SSH:
sudo systemctl restart ssh
sudo rm -f /var/run/reboot-required
sudo rm -f /var/run/reboot-required.pkgs
永久避免:
sudo apt remove -y needrestart
(常见于服务器)
编辑 apt 配置:
sudo nano /etc/apt/apt.conf.d/99custom
加入:
APT::Get::Show-Upgraded "false";
APT::Get::Show-Versions "false";
编辑 grub:
sudo nano /etc/default/grub
修改:
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
更新 grub:
sudo update-grub
sudo nano /etc/systemd/journald.conf
设置:
Storage=none
或限制大小:
SystemMaxUse=50M
gsettings set org.gnome.desktop.notifications show-banners false
你可以直接把 完整提示内容 或 截图文字 发给我,例如:
WARNING: ...Message from syslogdDebian GNU/Linux comes with ABSOLUTELY NO WARRANTY我可以精准告诉你关哪一个 ✅