简体   繁体   English

安装Linux内核会生成“ gzip:stdout:设备上没有剩余空间”错误

[英]Installing Linux kernel generates “gzip: stdout: No space left on device” error

My current Ubuntu is 16.04.1 LTS , and I use it to build the newest linux 4.7 kernel. 我当前的Ubuntu是16.04.1 LTS ,我用它来构建最新的linux 4.7内核。 All the build process is smooth, except when installing, it prompts the following error: 所有的构建过程都很顺利,除了安装时,它会提示以下错误:

# 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

I dobut there is no space on my host, so I use " df -h " command to check: 我但是主机上没有空间,因此我使用“ 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

It seems only /dev directory is full, but I don't know whether it is the root cause. 似乎只有/dev目录已满,但我不知道这是否是根本原因。 Could anyone give some clues on this issue? 任何人都可以在这个问题上提供一些线索吗?

As yo can see in your df's execution there's only a few megs left in your /boot partition. 如您所见,在df的执行过程中, / boot分区中只剩下几个兆。

The first thing you can do is check if there are older kernels that you're not using anymore: 您可以做的第一件事是检查是否有不再使用的旧内核:

# 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)

As you can see in my example, i have the current kernel and the previous one installed. 如您在我的示例中看到的,我安装了当前内核和上一个内核。 This is my usual behaviour but in ubuntu, in certain configurations, maybe you have more than two kernels installed. 这是我通常的行为,但是在ubuntu中,在某些配置下,也许您安装了两个以上的内核。

You can safely remove any other kernel installed beside those two as you have tested the current kernel and the one before that. 您可以安全地删除在这两个内核之外安装的任何其他内核,因为您已经测试了当前内核和之前的内核。

If this is not the case you can try to expand your /boot partition, this is complicated in most cases, i see that you have lvm configured in your / partition. 如果不是这种情况,您可以尝试扩展/ boot分区,这在大多数情况下都很复杂,我看到您在/分区中配置了lvm You can try to boot up your machine with a knoppix and resize your partitions to give some extra space to your /boot partition. 您可以尝试使用knoppix引导计算机并调整分区大小,以便为/ boot分区提供一些额外的空间。 But you have to avoid add this space with lvm because i think that your installation don't have lvm supported in the boot proccess. 但是您必须避免使用lvm添加此空间,因为我认为您的安装在启动过程中不支持lvm。

The best option should be try to resize the whole lvm partition and give that extra space to /boot . 最好的选择应该是尝试调整整个lvm分区的大小,并为/ boot提供额外的空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM