Ubuntu Software Updater Complains That Boot Partition is Full

While running the Ubuntu Software Updater, it threw the message:
“The upgrade needs a total of XX.X MB free space on disk ‘/boot’. Please free at least an additional YY.Y MB of disk space on ‘/boot’. Empty your trash and remove temporary packages of former installations using ‘sudo apt-get clean’.”

This is probably because you have a bunch of residual kernels that need to get cleaned out; the steps suggested in the message won’t actually fix this problem.

List all installed kernels.

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

Show the currently running kernel.

uname -a

Is the currently running kernel the most recent (largest numbered) kernel that is installed? Great! (otherwise, consider investigating why that is not the case)
Reboot the computer. Is it still working as expected? Great! (otherwise, fix that first; you may soon find you want one of those older, *working* kernels…)

Show all kernels and headers that can be removed, excluding the current running kernel.

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

Remove all kernels, excluding the current running kernel.

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


Leave a Reply