在仍运行 Ubuntu 16.04 的旧服务器上,/boot 分区已满,不是旧内核,而是比正在运行的内核更新的内核。
我正在运行 4.4.0-176-generic,列表如下(与 initrd.img* 文件相同):
-rw------- 1 root root 7220256 Dec 1 19:58 vmlinuz-4.4.0-198-generic
-rw------- 1 root root 7217792 Nov 27 14:03 vmlinuz-4.4.0-197-generic
-rw------- 1 root root 7220608 Nov 10 19:34 vmlinuz-4.4.0-194-generic
-rw------- 1 root root 7221056 Oct 14 2020 vmlinuz-4.4.0-193-generic
-rw------- 1 root root 7220448 Aug 31 2020 vmlinuz-4.4.0-190-generic
-rw------- 1 root root 7217792 Aug 14 2020 vmlinuz-4.4.0-189-generic
-rw------- 1 root root 7219360 Jul 22 2020 vmlinuz-4.4.0-187-generic
-rw------- 1 root root 7209656 Mar 16 2020 vmlinuz-4.4.0-177-generic
-rw------- 1 root root 7209560 Feb 28 2020 vmlinuz-4.4.0-176-generic
我怎样才能安全地清理干净?
我目前无法使用 apt-get 安装任何东西,我收到如下错误:
root@dev-server1:/boot# apt-get install postfix
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
linux-image-generic : Depends: linux-image-4.4.0-200-generic but it is not going to be installed or
linux-image-unsigned-4.4.0-200-generic but it is not going to be installed
Recommends: thermald but it is not going to be installed
linux-modules-extra-4.4.0-200-generic : Depends: linux-image-4.4.0-200-generic but it is not going to be installed or
linux-image-unsigned-4.4.0-200-generic but it is not going to be installed
postfix : Depends: ssl-cert but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
...这看起来很奇怪,因为它指的是一个甚至不存在的内核。
谢谢,
乔治
答案1
首先,Ubuntu 16.04 LTS 上个月已经到达了它的生命周期的终点,所以您需要尽快更新到最新的 Ubuntu,否则您将运行过时的软件并使您的系统暴露于各种攻击。
您可以尝试删除旧的内核包,如下所示:
获取内核中所有已安装内核包的列表:
dpkg -l | grep linux-image
清除系统中的每个包:
apt purge linux-image-4.4.0-176-generic
在这里,您可以针对已安装的每个最新内核包(除两个以外)运行命令。
清除旧软件包后,您可以尝试运行apt-get -f install
以完成缺少的依赖项的安装。