由于启动盘已满,无法更新

由于启动盘已满,无法更新

抱歉,我知道这是一个常见的问题,但我已经尝试了很多方法,由于启动盘的使用率已达到 100%,我的系统仍然无法更新。

我不知道该怎么做。

uname -r= 3.16.0-62-通用

$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         4.9G   12K  4.9G   1% /dev
tmpfs                        988M  1.4M  987M   1% /run
/dev/mapper/ubuntu--vg-root  107G   62G   40G  62% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
none                         5.0M     0  5.0M   0% /run/lock
none                         4.9G   78M  4.8G   2% /run/shm
none                         100M   32K  100M   1% /run/user
/dev/sda2                    237M  225M     0 100% /boot
/dev/sda1                    511M  3.4M  508M   1% /boot/efi

如果我尝试sudo apt-get autoremove,我会看到:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 83 not to upgrade.
7 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-3.16.0-62-generic (3.16.0-62.83~14.04.1) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
Not updating initrd symbolic links since we are being     updated/reinstalled 
(3.16.0-62.82~14.04.1 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled 
(3.16.0-62.82~14.04.1 was configured last, according to dpkg)
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.16.0-    62-generic /boot/vmlinuz-3.16.0-62-generic
run-parts: executing /etc/kernel/postinst.d/dkms 3.16.0-62-generic /boot/vmlinuz-3.16.0-62-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.16.0-62-generic /boot/vmlinuz-3.16.0-62-generic
update-initramfs: Generating /boot/initrd.img-3.16.0-62-generic
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.16.0-62-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-3.16.0-62-generic.postinst line 1025.
dpkg: error processing package linux-image-3.16.0-62-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-3.16.0-62-generic:
 linux-image-extra-3.16.0-62-generic depends on linux-image-3.16.0-62-generic; however:
  Package linux-image-3.16.0-62-generic is not configured yet.

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

dpkg: error processing package linux-image-generic-lts-utopic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-lts-utopic:
 linux-generic-lts-utopic depends on linux-image-generic-
No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                                   No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                                                         No apport report written because MaxReports has already been reached
                                   No apport report written because MaxReports has already been reached
 No apport report written because MaxReports has already been reached
                                                                     No apport report written because MaxReports has already been reached
                               lts-utopic (= 3.16.0.62.53); however:
  Package linux-image-generic-lts-utopic is not configured yet.

dpkg: error processing package linux-generic-lts-utopic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-signed-image-3.16.0-62-generic:
     linux-signed-image-3.16.0-62-generic depends on linux-image-3.16.0-62-generic (= 3.16.0-62.83~14.04.1); however:
  Package linux-image-3.16.0-62-generic is not configured yet.
 linux-signed-image-3.16.0-62-generic depends on linux-image-extra-3.16.0-62-generic (= 3.16.0-62.83~14.04.1); however:
  Package linux-image-extra-3.16.0-62-generic is not configured yet.

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

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

dpkg: error processing package linux-signed-generic-lts-utopic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-3.16.0-62-generic
 linux-image-extra-3.16.0-62-generic
 linux-image-generic-lts-utopic
 linux-generic-lts-utopic
 linux-signed-image-3.16.0-62-generic
 linux-signed-image-generic-lts-utopic
 linux-signed-generic-lts-utopic
    N: Ignoring file 'trillian.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'trillian.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Sub-process /usr/bin/dpkg returned an error code (1)`

答案1

这可能是因为您的系统上安装了太多内核。

因此,您必须通过 删除旧的内核映像dpkg

  1. 检测不再需要的内核:

    dpkg -l 'linux-[ihs]*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\([-0-9]*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

  2. 检查是否检测到正确的内核版本后,您可以删除它们:

    dpkg -l 'linux-[ihs]*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\([-0-9]*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo dpkg -P

  3. 之后您应该检查是否存在损坏或不完整的包:

    dpkg -l linux-[ihs]* | sed '1,6d'| grep -vE '^ii|^un|^rc'

  4. 如果标准输出是不是空你应该安装损坏/不完整的软件包:

    sudo apt-get -f install

(这些命令来自德语维基Ubuntu用户。我以前也用过它们,它们对我来说效果很好。)

相关内容