Ubuntu – initramfs problem when out of disk space

11.04initramfsupgrade

I just upgraded from 10.10 to 11.04. During the upgrade process, it said there was a problem setting up initramfs-tools and I needed to do sudo dpkg –configure -a

So once I got 11.04 started for the first time, I did that. This is the output.

Setting up initramfs-tools (0.98.8ubuntu3) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-2.6.38-8-generic

gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-2.6.38-8-generic
dpkg: error processing initramfs-tools (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 initramfs-tools

After searching around, it seemed like this was a problem of insufficient space in my /boot partition. It is only 100 MB and this has never been a problem before, but despite deleting all but the latest kernel I still get the same message.

Best Answer

100MB is sufficient for 2 kernels and a init ramdisk. You can view your current installed kernels by executing:

dpkg -l 'linux-image-*' | grep '^ii'

Example output:

ii  linux-image-2.6.35-28-generic        2.6.35-28.50                               Linux kernel image for version 2.6.35 on x86/x86_64
ii  linux-image-2.6.38-8-generic         2.6.38-8.42                                Linux kernel image for version 2.6.38 on x86/x86_64
ii  linux-image-generic                  2.6.38.8.22                                Generic Linux kernel image

After confirming that the latest kernel works, you can remove the previous ones. In this case, there is only one redundant kernel:

sudo apt-get purge linux-image-2.6.35-28-generic

If this process does not complete because of previous installation triggers, try adding -f (--fix-broken) before purge.