I got the following output when removing a kernel by dpkg --purge
:
Removing linux-headers-3.13.0-112-generic (3.13.0-112.159) ... Removing linux-image-extra-3.13.0-112-generic (3.13.0-112.159) ... run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-112-generic /boot/vmlinuz-3.13.0-112-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-112-generic /boot/vmlinuz-3.13.0-112-generic update-initramfs: Generating /boot/initrd.img-3.13.0-112-generic W: TMPDIR is mounted noexec, will not cache run scripts. gzip: stdout: No space left on device E: mkinitramfs failure cpio 141 gzip 1 update-initramfs: failed for /boot/initrd.img-3.13.0-112-generic with 1. run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 dpkg: error processing package linux-image-extra-3.13.0-112-generic (--purge): subprocess installed post-removal script returned error exit status 1 Removing linux-image-3.13.0-112-generic (3.13.0-112.159) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-112-generic /boot/vmlinuz-3.13.0-112-generic update-initramfs: Deleting /boot/initrd.img-3.13.0-112-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-112-generic /boot/vmlinuz-3.13.0-112-generic Generating grub configuration file ... Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. Found linux image: /boot/vmlinuz-4.4.0-71-generic Found initrd image: /boot/initrd.img-4.4.0-71-generic Found linux image: /boot/vmlinuz-4.4.0-67-generic Found initrd image: /boot/initrd.img-4.4.0-67-generic Found linux image: /boot/vmlinuz-4.4.0-66-generic Found initrd image: /boot/initrd.img-4.4.0-66-generic Found linux image: /boot/vmlinuz-4.4.0-64-generic Found initrd image: /boot/initrd.img-4.4.0-64-generic Found linux image: /boot/vmlinuz-3.13.0-115-generic Found initrd image: /boot/initrd.img-3.13.0-115-generic Found linux image: /boot/vmlinuz-3.13.0-113-generic Found initrd image: /boot/initrd.img-3.13.0-113-generic Found memtest86+ image: /memtest86+.elf Found memtest86+ image: /memtest86+.bin No volume groups found done Purging configuration files for linux-image-3.13.0-112-generic (3.13.0-112.159) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-112-generic /boot/vmlinuz-3.13.0-112-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-112-generic /boot/vmlinuz-3.13.0-112-generic Errors were encountered while processing: linux-image-extra-3.13.0-112-generic
Why does it run out of space even when purging? It is not an inode issue in this case.
Note: There are other questions where error happens during dpkg --configure
or when installing a kernel. It is more understandable that system runs out of disk space then, but in this case I am purging a kernel - a linux-image-extra package to be specific - by dpkg
. There is no dependency problem in this case. For example in this one a solution could be to purge kernel packages directly by dpkg
, but the issue of this question produces an error when doing so.
When purging a linux-image-extra package, post installation scripts are run, since the main linux-image package of that kernel release may be left remaining in system: The respective initrd.img will be altered not to contain the extra's stuff; its size will decrease as a result of this process. However, the old initrd.img file is not removed in "/boot" and the new one is created beside it in "/boot" during this process, so there is a risk of running out of space.
The fix could be to create the new initrg.img file in different partition before replacing the old one by it in
update-initramfs
. So theupdate-initramfs
script should be fixed.A workaround would be to remove the respective versioned /boot/initrd.img file before running
dpkg --purge
for the linux-image-extra package. That could also be done bysudo update-initramfs -d -k 3.13.0-112-generic
in this case, as the kernel I was removing was "3.13.0-112-generic".