运行“sudo apt-get autoremove”时出错

运行“sudo apt-get autoremove”时出错

我正在使用 Ubuntu 14.04。当我运行 时sudo apt-get autoremove,它生成了以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-extra-4.4.0-34-generic (4.4.0-34.53~14.04.1) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-34-generic /boot/vmlinuz-4.4.0-34-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-34-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.4.0-34-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-34-generic (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of linux-image-generic-lts-xenial:
 linux-image-generic-lts-xenial depends on linux-image-extra-4.4.0-34-generic; however:
  Package linux-image-extra-4.4.0-34-generic is not configured yet.

dpkg: error processing package linux-image-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-lts-xenial:
 linux-generic-lts-xenial depends on linux-image-generic-lts-xenial (= 4.4.0.34.24); however:
  Package linux-image-generic-lts-xenial is not configured yet.

dpkg: error processing package linux-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-image-generic-lts-xenial:
 linux-signed-image-generic-lts-xenial depends on linux-image-extra-4.4.0-34-generic; however:
  Package linux-image-extra-4.4.0-34-generic is not configured yet.

dpkg: error processing package linux-signeNo apport report written because the error message indicates its a followup error from a previous failure.
                                                                    No apport report written because the error message indicates its a followup error from a previous failure.
              No apport report written because MaxReports is reached already
                                                                            No apport report written because MaxReports is reached already
                                                          d-image-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-generic-lts-xenial:
 linux-signed-generic-lts-xenial depends on linux-signed-image-generic-lts-xenial (= 4.4.0.34.24); however:
  Package linux-signed-image-generic-lts-xenial is not configured yet.

dpkg: error processing package linux-signed-generic-lts-xenial (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-extra-4.4.0-34-generic
 linux-image-generic-lts-xenial
 linux-generic-lts-xenial
 linux-signed-image-generic-lts-xenial
 linux-signed-generic-lts-xenial
E: Sub-process /usr/bin/dpkg returned an error code (1)

此外,还有一条警告说“卷启动仅剩 0 字节磁盘空间”。我尝试了这里.然后我得到了

linux-image-3.19.0-58-generic
linux-image-3.19.0-59-generic
linux-image-3.19.0-61-generic
linux-image-3.19.0-64-generic
linux-image-3.19.0-65-generic
linux-image-3.19.0-66-generic
linux-image-4.4.0-34-generic

我不确定删除所有 linux-image-3.19.0-xx-generic 内核是否安全。我应该保留一些吗?谢谢。

编辑

输出blkid -o list

device     fs_type label    mount point    UUID
-------------------------------------------------------------------------------
/dev/ram0                   (not mounted)  
/dev/ram1                   (not mounted)  
/dev/ram2                   (not mounted)  
/dev/ram3                   (not mounted)  
/dev/ram4                   (not mounted)  
/dev/ram5                   (not mounted)  
/dev/ram6                   (not mounted)  
/dev/ram7                   (not mounted)  
/dev/ram8                   (not mounted)  
/dev/ram9                   (not mounted)  
/dev/ram10                  (not mounted)  
/dev/ram11                  (not mounted)  
/dev/ram12                  (not mounted)  
/dev/ram13                  (not mounted)  
/dev/ram14                  (not mounted)  
/dev/ram15                  (not mounted)  
/dev/sda1                   (not mounted)  
/dev/sdb1                   /boot/efi      
/dev/sdb2                   /boot          
/dev/sdb3                   (not mounted)  
/dev/mapper/ubuntu--vg-root
                            /              
/dev/mapper/ubuntu--vg-swap_1
                            <swap>         

答案1

如果您在使用 4.4.x 内核时遇到问题,或者出于其他原因想要启动旧内核,则只需保留 3.19.x 内核。否则,删除它们是安全的。

答案2

即使您尝试删除一些内核,您也会收到这些错误,因为它仍然需要一小部分存储来/boot清除内核。

我的建议是创建一个 Ubuntu Live USB,从中启动,然后将 1 或 2 个内核映像移动到另一个位置。确保不要删除要启动的那些。我建议保留linux-image-3.19.0-66-generic内核。

腾出一些空间后,启动常规 Ubuntu,并删除您未手动移动的其他内核。这样,您将干净地获得一些空间。然后再次使用 USB 启动并将这些移动的内核文件放入其位置。

现在,再次启动常规 Ubuntu 并删除不必要的内核,只保留一个。您应该不会收到任何警告。

答案3

我的解释如下:报告的第一个错误似乎是“gzip:stdout:设备上没有剩余空间”,然后安装失败(可能与此空间不足错误有关)。随后出现了一系列依赖性问题,因为第一个包的安装失败了。

您有多少个分区?如果您有单独的 /home 和 / 分区,您可能会看到驱动器上有一些可用空间,但仍会收到空间不足的通知,因为可用空间位于不同的分区上。

相关内容