2

I am trying to install a new kernel on Ubuntu Server and I am unable to complete it due to a "gzip: stdout: no space left on device" error. The full error was produced after running sudo make modules_install install:

  INSTALL /lib/firmware/cpia2/stv0672_vp4.bin
  INSTALL /lib/firmware/yam/1200.bin
  INSTALL /lib/firmware/yam/9600.bin
  DEPMOD  3.16.0
sh ./arch/x86/boot/install.sh 3.16.0 arch/x86/boot/bzImage \
    System.map "/boot"
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.16.0 /boot/vmlinuz-3.16.0
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.16.0 /boot/vmlinuz-3.16.0
update-initramfs: Generating /boot/initrd.img-3.16.0

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

I checked the disk space using df -h and here is the output:

Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/server--vg-root  103G   33G   66G  34% /
none                         4.0K     0  4.0K   0% /sys/fs/cgroup
udev                          63G  4.0K   63G   1% /dev
tmpfs                         13G  1.8M   13G   1% /run
none                         5.0M     0  5.0M   0% /run/lock
none                          63G  148K   63G   1% /run/shm
none                         100M   24K  100M   1% /run/user
/dev/sda1                    236M   62M  162M  28% /boot
/home/stan/.Private          103G   33G   66G  34% /home/stan

I don't understand why this error is being produced given the amount of space. I have successfully used the exact same procedure on both Debian and OpenSUSE.

2 Answers 2

2

"make modules_install install" tries to build initrd image on /boot partition, which has 162 megabytes free, which is simply not enough.

If you want to compile kernel yourself on Ubuntu, you need to prepare at least 1GB free space on /boot partition.

2
  • Thank you for the answer. How can I resize the partition when logged into terminal? I tried to increase the space using resize2fs however it did not allow me to. Sorry, I have been using Linux only a few weeks.
    – Greg
    Jul 30, 2015 at 8:35
  • You probably can't, since right after /boot partition you have / partition. But you can create another /boot partition, eg. on another disk on pen drive. Or you can simply create a temporary file on / partition, format it as temporary /boot partition, and mount it to /boot just for the moment of compiling kernel, copying initrd image to "real" /boot partition right after compiling and installing everything. Jul 30, 2015 at 8:38
1

This happens when there is not much space left on /boot partition. The solution to this is to uninstall old kernels and free up space.

You can get a list of the currently installed kernels

[I] ~ ❯❯❯ dpkg -l | grep linux-image
rc  linux-image-4.19.0-6-amd64                       4.19.67-2+deb10u1                             amd64        Linux 4.19 for 64-bit PCs (signed)
rc  linux-image-5.10.0-2-amd64                       5.10.9-1                                      amd64        Linux 5.10 for 64-bit PCs (signed)
rc  linux-image-5.10.0-5-amd64                       5.10.24-1                                     amd64        Linux 5.10 for 64-bit PCs (signed)
rc  linux-image-5.10.0-6-amd64                       5.10.28-1                                     amd64        Linux 5.10 for 64-bit PCs (signed)
rc  linux-image-5.14.0-1-amd64                       5.14.6-3                                      amd64        Linux 5.14 for 64-bit PCs (signed)
rc  linux-image-5.14.0-2-amd64                       5.14.9-2                                      amd64        Linux 5.14 for 64-bit PCs (signed)
rc  linux-image-5.14.0-3-amd64                       5.14.12-1                                     amd64        Linux 5.14 for 64-bit PCs (signed)
rc  linux-image-5.14.0-4-amd64                       5.14.16-1                                     amd64        Linux 5.14 for 64-bit PCs (signed)
ic  linux-image-5.15.0-2-amd64                       5.15.5-2                                      amd64        Linux 5.15 for 64-bit PCs (signed)
rc  linux-image-5.15.0-3-amd64                       5.15.15-2                                     amd64        Linux 5.15 for 64-bit PCs (signed)
rc  linux-image-5.16.0-3-amd64                       5.16.11-1                                     amd64        Linux 5.16 for 64-bit PCs (signed)
rc  linux-image-5.17.0-1-amd64                       5.17.3-1                                      amd64        Linux 5.17 for 64-bit PCs (signed)
ii  linux-image-5.18.0-4-amd64                       5.18.16-1                                     amd64        Linux 5.18 for 64-bit PCs (signed)
ii  linux-image-5.19.0-2-amd64                       5.19.11-1                                     amd64        Linux 5.19 for 64-bit PCs (signed)
rc  linux-image-5.2.0-3-amd64                        5.2.17-1                                      amd64        Linux 5.2 for 64-bit PCs (signed)
rc  linux-image-5.3.0-2-amd64                        5.3.9-3                                       amd64        Linux 5.3 for 64-bit PCs (signed)
rc  linux-image-5.3.0-3-amd64                        5.3.15-1                                      amd64        Linux 5.3 for 64-bit PCs (signed)
rc  linux-image-5.4.0-1-amd64                        5.4.6-1                                       amd64        Linux 5.4 for 64-bit PCs (signed)
rc  linux-image-5.4.0-2-amd64                        5.4.8-1                                       amd64        Linux 5.4 for 64-bit PCs (signed)
rc  linux-image-5.4.0-3-amd64                        5.4.13-1                                      amd64        Linux 5.4 for 64-bit PCs (signed)
rc  linux-image-5.4.0-4-amd64                        5.4.19-1                                      amd64        Linux 5.4 for 64-bit PCs (signed)
rc  linux-image-5.5.0-2-amd64                        5.5.17-1                                      amd64        Linux 5.5 for 64-bit PCs (signed)
rc  linux-image-5.6.0-1-amd64                        5.6.7-1                                       amd64        Linux 5.6 for 64-bit PCs (signed)
rc  linux-image-5.6.0-2-amd64                        5.6.14-2                                      amd64        Linux 5.6 for 64-bit PCs (signed)
rc  linux-image-5.8.0-1-amd64                        5.8.7-1                                       amd64        Linux 5.8 for 64-bit PCs (signed)
rc  linux-image-5.8.0-2-amd64                        5.8.10-1                                      amd64        Linux 5.8 for 64-bit PCs (signed)
rc  linux-image-5.8.0-3-amd64                        5.8.14-1                                      amd64        Linux 5.8 for 64-bit PCs (signed)
rc  linux-image-5.9.0-1-amd64                        5.9.1-1                                       amd64        Linux 5.9 for 64-bit PCs (signed)
rc  linux-image-5.9.0-2-amd64                        5.9.6-1                                       amd64        Linux 5.9 for 64-bit PCs (signed)
rc  linux-image-5.9.0-4-amd64                        5.9.11-1                                      amd64        Linux 5.9 for 64-bit PCs (signed)
ii  linux-image-amd64                                5.19.11-1                                     amd64        Linux for 64-bit PCs (meta-package)

then get the version of the current kernel version with

[I] ~ ❯❯❯ uname -r
5.19.0-2-amd64 

Now you need to install the old kernels by simply purging there package names with sudo apt purge <package-name> . If there are a lot of packages to uninstall you can use some bash magic with.

sudo apt purge linux-image-5.{2,3,4,5,6,8,9,18}*

be careful that the pattern should not match the current version of the kernel you are running.

After removing old kernels you would be able to free up plenty of space on /boot.

once there is enough space free, you can now proceed installing newer kernels

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .