无法删除 Ubuntu 16.04 上的旧内核版本

无法删除 Ubuntu 16.04 上的旧内核版本

我面临的挑战是清理已 100% 满的启动驱动器。

我列出了以前的版本:

dpkg-l Linux 映像*

并将获得 12 个版本的列表,

rc  linux-image-4.4.0-45-generic    4.4.0-45.66          amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rc  linux-image-4.4.0-47-generic    4.4.0-47.68          amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP

这是尾巴:

[...]

ii  linux-image-4.4.0-78-generic    4.4.0-78.99          amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-79-generic    4.4.0-79.100         amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-81-generic    4.4.0-81.104         amd64                Linux kernel image for version 4.4.0 on 64 bit x86 SMP
in  linux-image-4.4.0-83-generic    <none>               amd64                (no description available)
iU  linux-image-virtual             4.4.0.83.89          amd64                This package will always depend on the latest minimal generic kerne

好的,我想删除旧版本并保留最新版本。我目前处于:

uname -r

4.4.0-78-generic

所以我想删除旧版本:

apt-get 自动删除 -f

The following NEW packages will be installed:
  linux-image-4.4.0-83-generic
0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.
10 not fully installed or removed.
[...]
Unpacking linux-image-4.4.0-83-generic (4.4.0-83.106) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-83-generic_4.4.0-83.106_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-83-generic' to '/boot/vmlinuz-4.4.0-83-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-83-generic /boot/vmlinuz-4.4.0-83-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-83-generic /boot/vmlinuz-4.4.0-83-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-83-generic_4.4.0-83.106_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

所以这没有奏效——由于某种原因它说:0 删除。

我手动尝试

apt-get 删除 linux-image-(标签)

并获得这些选项

linux-image-4.4.0-62-generic  linux-image-4.4.0-70-generic  linux-image-4.4.0-75-generic
linux-image-4.4.0-64-generic  linux-image-4.4.0-71-generic  linux-image-4.4.0-78-generic
linux-image-4.4.0-66-generic  linux-image-4.4.0-72-generic  linux-image-virtual

所以它们都不会全部出现在那里。

我尝试删除其中一个

apt-get 删除 linux-image-4.4.0-62-generic

结果:

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

??? 我想删除它们,但这里建议使用 install 代替?但我无法这样做,因为启动驱动器已满 100%...

答案1

您需要释放/boot分区下的一些磁盘空间。您可以删除与要卸载的特定 Linux 内核映像相关的文件。您只需确保不要删除系统启动时要引导的默认 Linux 映像(通常应保留最新版本)。

然后,您可以尝试apt-get remove linux-image-version 修复apt-get -f install损坏的依赖关系。

相关内容