当前位置: 首页>>技术教程>>正文


升级内核时“gzip:stdout:设备上没有剩余空间”

,

问题描述

尝试运行下面显示的命令时,我看到以下错误。我读到某处我的/boot分区磁盘空间不足。如何增加/boot分区的大小以便安装更多软件?我有一个500GB的硬盘,所以有足够的空间可以玩。

sudo apt-get install libdvdread4

gzip: stdout: No space left on device                                                                                                                                                                              
   E: mkinitramfs failure cpio 141 gzip 1                                                                                                                                                                             
   update-initramfs: failed for /boot/initrd.img-3.2.0-33-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.2.0-33-generic.postinst line 1010.                                                                                                    
   dpkg: error processing linux-image-3.2.0-33-generic (--configure):                                                                                                                                                 
    subprocess installed post-installation script returned error exit status 2                                                                                                                                        
   dpkg: dependency problems prevent configuration of linux-image-server:                                                                                                                                             
   linux-image-server depends on linux-image-3.2.0-33-generic; however:                                                                                                                                              
     Package linux-image-3.2.0-33-generic is not configured yet.
   dpkg: error processing linux-image-server (--configure):
    dependency problems - leaving unconfigured
   dpkg: dependency problems prevent configuration of linux-server:
    linux-server depends on linux-image-server (= 3.2.0.33.36); however:
     Package linux-image-server is not configured yet.
   dpkg: error processing linux-server (--configure):
    dependency problems - leaving unconfigured
   No 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.
 Errors were encountered while processing:
 linux-image-3.2.0-33-generic
 linux-image-server
 linux-server
N: Ignoring file 'michael-gruz-canon-precise.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
N: Ignoring file 'michael-gruz-canon-precise.list.1' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension

下面列出的是du的输出

Filesystem              1K-blocks      Used Available Use% Mounted on
/dev/mapper/ubuntu-root 712660664 104095912 572363692  16% /
udev                      3964792         4   3964788   1% /dev
tmpfs                     1591012      1064   1589948   1% /run
none                         5120         0      5120   0% /run/lock
none                      3977528       684   3976844   1% /run/shm
/dev/sda1                  233191    219821       929 100% /boot

最佳解决方法

您有一个单独的/boot分区,大小只有大约227MB。这个分区已满。

Ubuntu给你一个单独的/boot分区的原因似乎是你在驱动器的其余部分使用LVM和/或”full”磁盘加密。

/boot目录包含所有内核映像,因此可能导致此问题的原因是您安装了太多以前的内核。 Ubuntu发布内核更新,即使对于长期稳定版本,也会频繁地破坏软件包名称中的版本号,因此,如果您使系统保持最新状态,那么随着时间的推移,/boot目录将会增长。

您应该能够列出已安装的内核

aptitude search ~ilinux-image

(请注意,这可能会返回非内核的包)。

通常不需要安装两个以上的内核 – 当前正在使用的内核和前一个内核(作为后备)。所以你可以逐个删除旧版本,如下所示:

sudo apt-get autoremove linux-image-3.2.0-23-generic

确保将”3.2.0-23-generic”替换为要删除的实际内核版本!另外,请勿删除linux-image-generic等软件包。您必须非常小心,不要删除当前正在运行的内核,否则您将无法启动(Ubuntu可能会或可能不会警告您这样做)。

您可以找到当前运行的内核:

uname -r

Here’s an illustrated guide to doing what I’ve just explained. This article uses slightly different tools but basically the same approach.

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/6198.html,未经允许,请勿转载。