gzip: stdout: No space left on device E: mkinitramfs failure cpio 141 gzip 1
Solution 1:
I see you have some old kernels there, seemingly from a previous version of Ubuntu. I think that autoremove
fails to act on kernels with a different major version number - at least I have seen cases before like that.
You also have a very small /boot
partition. In the long term, or even now if it's an option, I would recommend you reinstall and not create a separate boot partition, or if you do make sure it is bigger. My experience is that the installer does not create one by default; on an UEFI system a small EFI system partition is created mounted on /boot/efi
which doesn't interfere with the space in /boot
where kernels are stored.
In the short term, you can make space by deleting the kernels yourself. You can remove all traces of the kernel by hand using the version string if APT cannot.
First check which kernel is running with the command
uname -r
it will output the version string, for example 4.4.0-34-generic
Do not delete that kernel
Choose one of the other versions you see in ls /boot
; start with the oldest one 3.19.0-56-generic
and find all the files that belong to it:
locate -b -e 3.19.0-56-generic
Now you can delete them using xargs
locate -b -e 3.19.0-56-generic | xargs -p sudo rm -r
You will see a list of files that will be deleted and you will be asked to confirm. If the list looks OK, type y and the files will be deleted.
Check that the files were removed:
sudo updatedb && locate -b -e 3.19.0-56-generic
Repeat this with the next oldest kernel. It is very much advisable to always keep a spare kernel, but I don't think those old kernels will be much use to you anyway, and your current kernel is presumably stable, so you can either continue until you only have only the currently running kernel version (indicated by uname -r
) or only two kernel versions in /boot
, then run
sudo update-grub
sudo apt update
sudo apt upgrade
And, fingers crossed, update-initramfs
should be able to run OK. To maintain the situation, every time you get a new kernel, run
sudo apt autoremove