无法删除旧内核 - 启动分区已满

无法删除旧内核 - 启动分区已满

我的启动分区已满,我无法删除旧内核。我的其余分区有足够的可用空间。这可能是我无法安装更新或其他软件包的原因吗?请查看我迄今为止尝试过的所有操作:

DF-H

Filesystem                    Size  Used Avail Use% Mounted on
/dev/sda1                     472M  464M     0 100% /boot
...

确定内核版本:

uname -r

4.8.0-37-generic

确定发行版本号:

lsb_release-sr

16.10

列出已安装的内核:

dpkg --list | grep linux-image

ii  linux-image-4.8.0-22-generic  4.8.0-22.24  amd64   Linux kernel image for version 4.8.0 on 64 bit x86 SMP
ii  linux-image-extra-4.8.0-22-generic  4.8.0-22.24  amd64  Linux kernel extra modules for version 4.8.0 on 64 bit x86 SMP

笔记:列出的项目远不止上述内容。

尝试删除列出的内核:

apt-get purge linux-image-4.8.0-22-通用

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-extra-4.8.0-22-generic : Depends: linux-image-4.8.0-22-generic but it is not going to be installed
linux-image-extra-4.8.0-41-generic : Depends: linux-image-4.8.0-41-generic but it is not going to be installed
linux-image-extra-4.8.0-45-generic : Depends: linux-image-4.8.0-45-generic but it is not going to be installed
linux-image-extra-4.8.0-46-generic : Depends: linux-image-4.8.0-46-generic but it is not going to be installed
linux-image-extra-4.8.0-49-generic : Depends: linux-image-4.8.0-49-generic but it is not going to be installed
linux-image-generic : Depends: linux-image-4.8.0-49-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

自动删除

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-extra-4.8.0-41-generic : Depends: linux-image-4.8.0-41-generic but it is not installed
linux-image-extra-4.8.0-45-generic : Depends: linux-image-4.8.0-45-generic but it is not installed
linux-image-extra-4.8.0-46-generic : Depends: linux-image-4.8.0-46-generic but it is not installed
linux-image-extra-4.8.0-49-generic : Depends: linux-image-4.8.0-49-generic but it is not installed
linux-image-generic : Depends: linux-image-4.8.0-49-generic but it is not installed
E: Unmet dependencies. Try using -f.

注意:我曾多次尝试以下操作,但都遇到类似的依赖性错误:

apt-get -f 安装

更新

由于我使用磁盘加密,我遇到了这个错误:https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1357093对于经验丰富的 Linux 用户来说,这可能只是一件小事,但对于像我这样的新手来说却并非如此。

答案1

您应该像这样删除标题和图像:

apt-get purge linux-headers-x.x.x-xx  linux-image-x.x.x-xx 

例如你的情况:

apt-get purge linux-headers-4.8.0-22  linux-image-4.8.0-22 

如果 apt 仍然无法删除软件包,你可以使用

dpkg --purge --force-all linux-image-4.8.0-22-generic linux-headers-4.8.0-22 linux-headers-4.8.0-22-generic 

在那之后:

apt-get -f install

答案2

是的,您的问题是由引导分区已满引起的。此站点上有很多答案可以解决此问题,或者手动删除内核以腾出空间,从而破坏包管理器。

您真的需要单独的启动分区吗?如果您的磁盘大于固件在启动时可以寻址的大小,并且您想强制将内核放在磁盘的开头以便加载,或者如果您的根目录已加密,或者您正在运行 raid,那么您确实需要单独的启动分区。

如果您决定确实不需要单独的 /boot,并且您的根目录有足够的空间,请尝试将所有内容从 /boot 分区移到根目录 /boot。卸载 /boot,并将其重新挂载在 /mnt 下。然后从 /mnt/xxx 复制到 /boot。注释掉挂载 /boot 的 /etc/fstab 行。然后尝试您找到的修复方法,现在您有可用的空间了。

相关内容