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
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:

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.

marked as duplicate by Elder Geek, David Foerster, fkraiem, Eric Carvalho, Kevin Bowen Apr 1 '17 at 3:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @ElderGeek this happens when purging by dpkg, not by configuring. – jarno Mar 30 '17 at 14:38
  • @ElderGeek : I agree with jarno, and don't think it is a duplicate, at least of the referenced dup. Readers should also know that jarno is very experienced with kernel removal / purging. – Doug Smythies Mar 30 '17 at 14:41
  • Dpkg should be using / for work files and not /boot as per discussion we had in AU General Chat room as I was defining rmkernels project scope. This is an interesting problem presented by @jarno. – WinEunuuchs2Unix Mar 30 '17 at 14:57
  • 1
    @fkraiem I claim my answer is useful for this question. Not that useful for the other questions you refer to. – jarno Mar 31 '17 at 9:51
  • 1
    @jarno Regarding this comment Do you have swap enabled? AFAIK, tmpfs should be able to move pages to swap to free up space. The output of df -h and free might shed some light on the issue as well. – Elder Geek Mar 31 '17 at 13:33

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 the update-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 by sudo update-initramfs -d -k 3.13.0-112-generic in this case, as the kernel I was removing was "3.13.0-112-generic".

  • The last paragraph doesn't really belong here, if you think there is a bug in how kernel removals are handled, file one on Launchpad. – fkraiem Mar 31 '17 at 9:08
  • @fkraiem I added a workaround. – jarno Mar 31 '17 at 9:14
  • 1
    @fkraiem it does not harm telling where the problem lies here. – jarno Mar 31 '17 at 9:20
  • 1
    @fkraiem There's nothing wrong with writing about a workaround to a problem that may occur frequently. – karel Mar 31 '17 at 9:30
  • 1
    @fkraiem Bug report added. – jarno Mar 31 '17 at 15:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.