简短回答:
sudo -e /etc/needrestart/needrestart.conf
注意:-e 使用默认系统编辑器。如果您想使用其他编辑器,只需运行 sudo update-alternatives --config editor
取消注释并更改以下设置:
$nrconf{kernelhints} = 0;
$nrconf{ucodehints} = 0;
安装软件包时,您将不再收到这些警告。
更多细节:
这与树莓派上发生的同样的“问题”相似背景,但根本原因有所不同。
实际上没有什么可担心的。这是Ubuntu在安装软件包后进行的(最近)新检查,以确定是否需要采取其他操作。
处理此问题(并引起这些警告)的软件包是needrestart
。从apt show needstart
中得知:
Description: check which daemons need to be restarted after library upgrades
needrestart checks which daemons need to be restarted after library upgrades.
It is inspired by checkrestart from the debian-goodies package.
Features:
- supports (but does not require) systemd
- binary blacklisting (i.e. display managers)
- tries to detect required restarts of interpreter based daemons
(supports Java, Perl, Python, Ruby)
- tries to detect required restarts of containers (docker, LXC)
- tries to detect pending kernel upgrades
- tries to detect pending microcode upgrades for Intel CPUs
- could be used as nagios check_command
- fully integrated into apt/dpkg using hooks
无论是内核还是微码,在WSL2下都无法正确报告,因为我们在WSL2虚拟机中运行的是Ubuntu容器(我们无法访问)。然而,根据上述信息,根据您运行的其他守护程序或容器的情况,可能会有一些场景可以派上用场。
您可以继续使用上述配置文件更改后的其余功能,而无需进行内核/微码检查。它们是否有用将取决于您的WSL2使用情况。
或者,如果您发现额外的输出没有用处,您可以完全删除该功能(按照树莓派问题中的指导):
sudo apt-get purge needrestart
个人而言,我还不确定这个软件包是否真的有必要作为默认的22.04根文件系统的一部分存在于WSL2中。但时间会证明一切。我相信,随着人们开始在WSL中安装22.04,很多人都会有这个问题。
WSL1用户
然而,如果你使用的是WSL1,在我进行调查的这个阶段,我的建议是完全删除这个软件包。needrestart用于检查过时软件包的过程似乎在WSL1的系统调用翻译“伪内核”下无法正常工作,你将会经常收到needrestart关于运行过时的二进制文件和库(包括sh、apt和init等)的错误提示。