自从Ubuntu服务器发布了崩溃漏洞补丁后,我就一直在升级Ubuntu服务器的内核。我注意到,几乎在所有服务器上,在重新启动之后,我必须运行两次apt autoremove才能清除系统上所有的旧内核。
如果我第一次运行它,它首先删除内核的两个旧版本:
% sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-4.4.0-103 linux-headers-4.4.0-103-generic linux-headers-4.4.0-104 linux-headers-4.4.0-104-generic linux-image-4.4.0-103-generic linux-image-4.4.0-104-generic
linux-image-extra-4.4.0-103-generic linux-image-extra-4.4.0-104-generic
0 upgraded, 0 newly installed, 8 to remove and 2 not upgraded.
After this operation, 596 MB disk space will be freed.但是,在它完成并再次运行apt autoremove之后,它删除了一个更旧的版本:
% sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-headers-4.4.0-96 linux-headers-4.4.0-96-generic linux-image-4.4.0-96-generic linux-image-extra-4.4.0-96-generic
0 upgraded, 0 newly installed, 4 to remove and 2 not upgraded.
After this operation, 298 MB disk space will be freed.我想知道,为何不能一蹴而就呢?
发布于 2018-01-12 10:04:43
内核的维护脚本,特别是/etc/kernel/postinst.d/apt-auto-removal,构建了一个要保存的内核列表,并将其存储在/etc/apt/apt.conf.d/01autoremove-kernels中作为适当的配置。此过程保持当前运行的内核、正在配置的内核和两个最新安装的内核。
大概是在您第一次清理之前运行脚本的最后一次,-96最终得到了保护,因为它属于这些类别之一。经过你的第一次清理,它不再做了,并成为一个候选人的删除。如果您想找出原因,01autoremove-kernels文件包含调试信息;在第一次清理之前和之后再查看它,应该会揭示各种内核版本受到保护的原因。
内核自动删除是有意保守的,错误在谨慎方面。您可以使用unattended-upgrades自动(最终)处理这一问题;有关详细信息,请参阅Ubuntu维基。
https://unix.stackexchange.com/questions/416540
复制相似问题