我刚刚在 Ubuntu 服务器上安装了一些更新。其中一些是内核和 Linux Headers,所以我怀疑需要重新启动,但我想确定一下。因此,来自该网站的推荐,我安装了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"
如何知道安装更新后是否需要重新启动?
答案1
因为这不是真正checkrestart
做的事。
它本质上所做的是检查是否有任何进程保持文件句柄对旧的/覆盖的库等开放,并且内核将不属于该列表的一部分,因为它不是进程保留句柄的文件。
/var/run/reboot-required
如果确实需要重新启动,更新过程应该会创建一个名为的文件(请参阅https://askubuntu.com/questions/164/how-can-i-tell-from-the-command-line-whether-the-machine-requires-a-reboot)