sudo apt list --upgradeable 是否显示内核更新?

sudo apt list --upgradeable 是否显示内核更新?

我想知道

sudo apt list --upgradeable 

列表中是否显示内核更新?

答案1

是的。运行后sudo apt-get update,如果有内核更新,则apt list --upgradeable应该会显示一些软件包,如linux-headers-4.4.0-somethinglinux-image-4.4.0-something

答案2

仅更新内核元包通常显示在 的输出中apt list --upgradeable

几乎所有内核更新都以新软件包的形式提供,而不是现有软件包的新版本,因此您可以保留旧内核一段时间,以防更新出现问题,而您需要使用旧内核启动系统。这些软件包的名称中带有版本号,例如linux-image-4.15.0-60-generic

为了让您能够收到此类软件包更新,内核元软件包的唯一用途是声明实际提供内核的软件包作为依赖项。当新的内核软件包发布时,元软件包本身会更新以依赖于它。

这些元包在 的输出中显示为可升级apt list --upgradeable,这是正确的,因为您已经安装了它们,并且有新版本可用。新包是不是在此处列出,因为您还没有。pbojczuk 观察到,这些包裹将不会已升级,他们将会已安装

这些软件包可能会出现在 的输出中apt list --upgradeable,但这种情况很少见。如果发布更新来修复不会改变内核本身的问题,则可能会发生这种情况。例如,如果提供内核文件的软件包的安装或删除脚本中存在错误,则该错误的修复可能会作为该软件包的更新提供,不是作为一个单独的内核包,其名称中带有版本号。


您可以通过运行来查看实际执行的操作apt -s upgrade

运行后sudo apt update检索有关从哪里可以获得哪些软件包以及哪些版本的信息,运行apt list --upgradeable会列出元软件包,但不列出实际提供新内核和相关文件的软件包:

ek@Kip:~$ apt list --upgradeable
Listing... Done
linux-generic/bionic-proposed 4.15.0.60.62 i386 [upgradable from: 4.15.0.59.61]
linux-headers-generic/bionic-proposed 4.15.0.60.62 i386 [upgradable from: 4.15.0.59.61]
linux-image-generic/bionic-proposed 4.15.0.60.62 i386 [upgradable from: 4.15.0.59.61]
linux-libc-dev/bionic-proposed 4.15.0-60.67 i386 [upgradable from: 4.15.0-59.66]

如果您想要查看运行后安装的所有内容sudo apt upgrade但又不想真正运行它,您可以apt运行模拟,使用以下命令apt -s upgrade

ek@Kip:~$ apt -s upgrade
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  linux-headers-4.15.0-60 linux-headers-4.15.0-60-generic linux-image-4.15.0-60-generic
  linux-modules-4.15.0-60-generic linux-modules-extra-4.15.0-60-generic
The following packages will be upgraded:
  linux-generic linux-headers-generic linux-image-generic linux-libc-dev
4 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Inst linux-modules-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Inst linux-image-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Inst linux-modules-extra-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Inst linux-generic [4.15.0.59.61] (4.15.0.60.62 Ubuntu:18.04/bionic-proposed [i386]) []
Inst linux-image-generic [4.15.0.59.61] (4.15.0.60.62 Ubuntu:18.04/bionic-proposed [i386]) []
Inst linux-headers-4.15.0-60 (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [all]) []
Inst linux-headers-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386]) []
Inst linux-headers-generic [4.15.0.59.61] (4.15.0.60.62 Ubuntu:18.04/bionic-proposed [i386])
Inst linux-libc-dev [4.15.0-59.66] (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-modules-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-image-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-modules-extra-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-generic (4.15.0.60.62 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-image-generic (4.15.0.60.62 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-headers-4.15.0-60 (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [all])
Conf linux-headers-4.15.0-60-generic (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-headers-generic (4.15.0.60.62 Ubuntu:18.04/bionic-proposed [i386])
Conf linux-libc-dev (4.15.0-60.67 Ubuntu:18.04/bionic-proposed [i386])

这不是唯一的方法,但是如果你想在执行升级之前了解升级将产生什么影响,我建议你采用这种方法。输出通常非常容易理解,因为它可能会揭示你即将进行的升级的其他意外影响。

我展示的输出来自-proposed启用了存储库并从中安装了新内核的计算机。(请注意,这在生产机器上通常不是一个好主意,因为这些内核尚未在 Ubuntu 上进行全面测试。)但是您会看到类似的输出,其中完全稳定的内核包在-security或中提供-updates

答案3

实际上我没有通过 看到内核包apt list --upgradable。比较一下:

apt list --upgradable | wc -l
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
141

反对:

apt --recon upgrade | grep ^Inst | wc -l
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
145

/var/log/apt/history当我检查日志并计算和行的值Install:时,后者的值与升级结果相符Upgrade:。内核包放在Install:行中。

相关内容