【问题标题】:Installing Linux kernel generates "gzip: stdout: No space left on device" error安装 Linux 内核会生成“gzip: stdout: No space left on device”错误
【发布时间】:2016-11-28 08:53:53
【问题描述】:

我当前的 Ubuntu 是 16.04.1 LTS,我用它来构建最新的 linux 4.7 内核。整个构建过程都很顺利,除了安装的时候提示如下错误:

# make modules_install install
......
  DEPMOD  4.7.0
sh ./arch/x86/boot/install.sh 4.7.0 arch/x86/boot/bzImage \
        System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.7.0 /boot/vmlinuz-4.7.0
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.7.0 /boot/vmlinuz-4.7.0
update-initramfs: Generating /boot/initrd.img-4.7.0
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.7.0 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
arch/x86/boot/Makefile:191: recipe for target 'install' failed
make[2]: *** [install] Error 1
arch/x86/Makefile:261: recipe for target 'install' failed
make[1]: *** [install] Error 2
Makefile:523: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2

我的主机上没有空间,所以我使用“df -h”命令检查:

# df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         1.9G     0  1.9G   0% /dev
tmpfs                        390M   11M  379M   3% /run
/dev/mapper/ubuntu--vg-root  454G   25G  407G   6% /
tmpfs                        2.0G     0  2.0G   0% /dev/shm
tmpfs                        5.0M     0  5.0M   0% /run/lock
tmpfs                        2.0G     0  2.0G   0% /sys/fs/cgroup
/dev/sda2                    473M  179M  270M  40% /boot
/dev/sda1                    511M  3.5M  508M   1% /boot/efi
tmpfs                        100K     0  100K   0% /run/lxcfs/controllers
tmpfs                        390M     0  390M   0% /run/user/0

好像只有/dev目录满了,不知道是不是根本原因。谁能提供一些关于这个问题的线索?

【问题讨论】:

    标签: linux ubuntu build linux-kernel


    【解决方案1】:

    正如您在 df 的 执行中看到的那样,您的 /boot 分区中只剩下几兆。

    您可以做的第一件事是检查是否有您不再使用的旧内核:

    # uname -r
    4.6.0-1-amd64
    # dpkg -l linux-image*
    Deseado=desconocido(U)/Instalar/eliminaR/Purgar/retener(H)
    | Estado=No/Inst/ficheros-Conf/desempaqUetado/medio-conF/medio-inst(H)/espera-disparo(W)/pendienTe-disparo
    |/ Err?=(ninguno)/requiere-Reinst (Estado,Err: mayúsc.=malo)
    ||/ Nombre                                    Versión                   Arquitectura              Descripción
    +++-=========================================-=========================-=========================-=======================================================================================
    un  linux-image                               <ninguna>                 <ninguna>                 (no hay ninguna descripción disponible)
    ii  linux-image-4.5.0-2-amd64                 4.5.5-1                   amd64                     Linux 4.5 for 64-bit PCs
    ii  linux-image-4.6.0-1-amd64                 4.6.4-1                   amd64                     Linux 4.6 for 64-bit PCs
    ii  linux-image-amd64                         4.6+74                    amd64                     Linux for 64-bit PCs (meta-package)
    

    正如您在我的示例中看到的,我安装了当前内核和前一个内核。这是我通常的行为,但在 ubuntu 中,在某些配置中,您可能安装了两个以上的内核。

    您可以安全地删除除这两个之外安装的任何其他内核,因为您已经测试了当前内核和之前的内核。

    如果不是这种情况,您可以尝试扩展您的 /boot 分区,这在大多数情况下很复杂,我看到您在 lvm 中配置了 / 分区。您可以尝试使用 knoppix 启动计算机并调整分区大小,以便为 /boot 分区提供一些额外空间。但是你必须避免用 lvm 添加这个空间,因为我认为你的安装在启动过程中不支持 lvm。

    最好的选择应该是尝试调整整个 lvm 分区的大小并将额外的空间分配给 /boot

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-10-05
      • 1970-01-01
      • 2019-01-30
      • 2020-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-02
      相关资源
      最近更新 更多