sudo apt-get upgrade-失败

sudo apt-get upgrade-失败

这对我来说还是第一次。我在升级 Ubuntu 12.04 时遇到了麻烦。我该如何解决这个问题?

sudo apt-get 升级:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up linux-image-3.8.0-42-generic (3.8.0-42.62~precise1) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-3.8.0-42-generic
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.8.0-42-generic /boot/vmlinuz-3.8.0-42-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.8.0-42-generic /boot/vmlinuz-3.8.0-42-generic
update-initramfs: Generating /boot/initrd.img-3.8.0-42-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-3.8.0-42-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.8.0-42-generic.postinst line 1010.
dpkg: error processing linux-image-3.8.0-42-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of linux-image-generic-lts-raring:
 linux-image-generic-lts-raring depends on linux-image-3.8.0-42-generic; however:
  Package linux-image-3.8.0-42-generic is not configured yet.
dpkg: error processing linux-image-generic-lts-raring (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of linux-generic-lts-raring:
 linux-generic-lts-raring depends on linux-image-generic-lts-raring; however:
  Package linux-image-generic-lts-raring is not configured yet.
dpkg: error processing linux-generic-lts-raring (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-3.8.0-42-generic
 linux-image-generic-lts-raring
 linux-generic-lts-raring
E: Sub-process /usr/bin/dpkg returned an error code (1)

我的硬盘上还有超过 2TB 的剩余空间。我不明白:

  • gzip:stdout:设备上没有剩余空间
  • 已达到 MaxReports 值

答案1

好吧,毕竟这对我来说不是第一次。我翻到了上次发生这种情况时做的一些旧笔记。以下是我修复它的方法。

启动分区的使用百分比是多少?

df -H | grep boot
/dev/sda2    240M  224M  3.5M  99% /boot

当前安装了哪些内核映像:

sudo dpkg --list | grep linux-image
ii  linux-image-3.8.0-29-generic         3.8.0-29.42~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
ii  linux-image-3.8.0-34-generic         3.8.0-34.49~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
ii  linux-image-3.8.0-35-generic         3.8.0-35.52~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
ii  linux-image-3.8.0-36-generic         3.8.0-36.52~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
ii  linux-image-3.8.0-37-generic         3.8.0-37.53~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
ii  linux-image-3.8.0-38-generic         3.8.0-38.56~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
ii  linux-image-3.8.0-39-generic         3.8.0-39.58~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
ii  linux-image-3.8.0-41-generic         3.8.0-41.60~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
iF  linux-image-3.8.0-42-generic         3.8.0-42.62~precise1                    Linux kernel image for version 3.8.0 on 64 bit x86 SMP
iU  linux-image-generic-lts-raring       3.8.0.42.42                             Generic Linux kernel image

实际正在使用哪个内核映像:

uname -a
Linux backup 3.8.0-41-generic #60~precise1-Ubuntu SMP Fri May 16 00:18:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linu

删除每个不再使用的旧内核:

sudo apt-get purge linux-image-3.8.0-29-generic linux-image-3.8.0-34-generic linux-image-3.8.0-35-generic linux-image-3.8.0-35-generic linux-image-3.8.0-35-generic linux-image-3.8.0-36-generic linux-image-3.8.0-37-generic linux-image-3.8.0-38-generic linux-image-3.8.0-39-generic

此后我可以升级:

sudo apt-get upgrade

相关内容