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

我有一个挑战,清理100%的启动驱动器已满。

我列出以前的版本:

dpkg -l linux-image *

并将获得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 autoremove -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 remove 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). 

??? 我想删除这些,它在这里build议的是使用安装,而不是? 我不能这样做,因为启动驱动器是100%完全…

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

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