Wednesday, October 19, 2016

Ubuntu. Cannot upgrade because of full /boot partition. Freeing some space

If you try to upgrade linux distribution (for example from 14.04 to 16.04) sometimes upgrade fail because of no free space at /boot partition. This happens because there are old kernel installed that are no longer needed. To remove old kernel you shoul issue command like this:

sudo apt-get purge linux-image-x.x.x-xx-generic

where "x" are numbers. so you remove all kernels except one that is used. ( check it with uname -r command). Usually in /boot partition there are many of kernels, so removing them one by one is time consuming operation. To make it more convenient use that crazy long command and wait :)

sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

 It remove all unused kernels from your /boot partition.

No comments:

Post a Comment