Error: "gzip: stdout: No space left on device" during Linux kernel upgrade (while there is space)

Error: "gzip: stdout: No space left on device" during Linux kernel upgrade (while there is space)

我目前正在尝试将我的 Linux 内核从 4.4.0-63 升级到 4.10.12。我已经完成了以下步骤(通过使用 http://www.thegeekstuff.com/2013/06/compile-linux-kernel 手册):make -> make modules -> make modules_install

尽管我尝试执行“make install”后出现以下错误:

user@thiscomp:/usr/src/linux-4.10.12$ sudo make install
sh ./arch/x86/boot/install.sh 4.10.12 arch/x86/boot/bzImage \
            System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.12 
/boot/vmlinuz-4.10.12
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.12 
/boot/vmlinuz-4.10.12
update-initramfs: Generating /boot/initrd.img-4.10.12
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-4.10.12 with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
make[1]: *** [install] Error 1
make: *** [install] Error 2

首先,我检查 /boot 是否已满,但似乎没有:

user@thiscomp:/usr/src/linux-4.10.12$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       252G   43G  197G  18% /
...
/dev/sda1       236M   75M  149M  34% /boot

根据我在网上看到的情况,这通常与过去的内核版本更新时间过长有关。不过,据我所知,在 运行 "dpkg -l linux-image*":

之后没有过去的版本
un  linux-image     
ii  linux-image-4.4.0-63-generic  
ii  linux-image-extra-4.4.0-63-generic
ii  linux-image-generic-lts-xenial

我不确定还能从哪里找出问题所在(特别是 /boot 似乎还未满)。有什么想法吗?

编辑 添加评论请求命令:

user@thiscomp:/usr/src/linux-4.10.12$ df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
/dev/dm-0      16777216 469172 16308044    3% /
..
/dev/sda1         62248    307    61941    1% /boot
user@thiscomp:/usr/src/linux-4.10.12$ ls -l /boot
total 69528
-rw-r--r-- 1 root root  1245512 Feb 13 06:43 abi-4.4.0-63-generic
-rw-r--r-- 1 root root   203277 Apr 25 22:42 config-4.10.12
-rw-r--r-- 1 root root   203277 Apr 25 22:32 config-4.10.12.old
-rw-r--r-- 1 root root   190255 Feb 13 06:43 config-4.4.0-63-generic
drwxr-xr-x 5 root root     1024 Apr 25 20:17 grub
-rw-r--r-- 1 root root 35960364 Apr 25 17:46 initrd.img-4.4.0-63-generic
drwx------ 2 root root    12288 Feb 15 16:18 lost+found
-rw-r--r-- 1 root root   176500 Mar 12  2014 memtest86+.bin
-rw-r--r-- 1 root root   178176 Mar 12  2014 memtest86+.elf
-rw-r--r-- 1 root root   178680 Mar 12  2014 memtest86+_multiboot.bin
-rw-r--r-- 1 root root  3662296 Apr 25 22:42 System.map-4.10.12
-rw-r--r-- 1 root root  3662296 Apr 25 22:32 System.map-4.10.12.old
-rw------- 1 root root  3897401 Feb 13 06:43 System.map-4.4.0-63-generic
-rw-r--r-- 1 root root  7169312 Apr 25 22:42 vmlinuz-4.10.12
-rw-r--r-- 1 root root  7169312 Apr 25 22:32 vmlinuz-4.10.12.old
-rw------- 1 root root  6989520 Feb 13 06:43 vmlinuz-4.4.0-63-generic

edit2 安装 tmpfs:

user@thiscomp:/usr/src/linux-4.10.12$ sudo mount -t tmpfs none /boot
user@thiscomp:/usr/src/linux-4.10.12$ sudo make install
sh ./arch/x86/boot/install.sh 4.10.12 arch/x86/boot/bzImage \
            System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.12         
/boot/vmlinuz-4.10.12
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.12                 
/boot/vmlinuz-4.10.12
update-initramfs: Generating /boot/initrd.img-4.10.12
W: Possible missing firmware /lib/firmware/ast_dp501_fw.bin for module ast
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.10.12 /boot/vmlinuz-
4.10.12
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.10.12 
/boot/vmlinuz-4.10.12
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.10.12 
/boot/vmlinuz-4.10.12
comp528@virt05:/usr/src/linux-4.10.12$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0       252G   43G  197G  18% /
...
none             16G  310M   16G   2% /boot

I checked to see if /boot was full, but it seemed like it wasn't:

 /dev/sda1       236M   75M  149M  34% /boot

run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.12 
/boot/vmlinuz-4.10.12
update-initramfs: Generating /boot/initrd.img-4.10.12
gzip: stdout: No space left on device

/boot 分区上的空闲 space 仍然存在问题。 (有gzip写入的临时文件,300MB最多149MB,但是当space全部用完,boot满了,gzip只是删了文件所以你看不到)

您可以尝试将更大的东西临时挂载到 /boot 分区,例如

 mount -t tmpfs none /boot

并重新启动 sudo make install 以找到 initramfs 的实际大小 (300MB)。

或者找到/etc/kernel/postinst.d/initramfs-tools使用什么参数来启动update-initramfs并添加-v选项。您也可以尝试

  • 将您的磁盘重新格式化为更大的 /boot
  • 在配置中禁用一些模块并进行重建
  • 在通过 make INSTALL_MOD_STRIP=1 modules_install 命令安装之前剥离模块 - https://superuser.com/questions/705121
  • 只将需要的模块安装到 initramfs