我刚刚在我的 Ubuntu 服务器上安装了一些更新。其中一些是内核和 Linux 标头,所以我怀疑需要重新启动,但我想确定。所以,根据这个网站的推荐,我安装了checkrestart
.
$ checkrestart
ERROR: This program must be run as root in order to obtain information
about all open file descriptors in the system.
$ sudo !!
sudo checkrestart
Found 0 processes using old versions of upgraded files
唔。不需要重启?这似乎很奇怪。
$ exit
logout
Connection to example.net closed.
$ ssh [email protected] && alert
[email protected]'s password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-92-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
0 packages can be updated.
0 updates are security updates.
*** System restart required ***
哦。所以需要重启吗?你为什么不这么说?
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
如何知道安装更新后是否需要重新启动?
因为这不是什么
checkrestart
。它本质上是检查是否有任何进程保持文件句柄对旧/覆盖的库等开放,并且内核将不属于该列表,因为它不是进程保留句柄的文件。
/var/run/reboot-required
如果确实需要重新启动,更新过程应该创建一个名为的文件(请参阅https://askubuntu.com/questions/164/how-can-i-tell-from-the-command-line-whether-the-machine-需要重启)