The volume “boot” has only 0 bytes disk space remaining

From time to time, when your operating system (Ubuntu, Linux Mint or similar) tries to install new kernel data you may get the following error message:

The volume “boot” has only 0 bytes disk space remaining.

This error means that the /boot partition is full (in most cases there are some old kernels).

To fix this error it needs to delete the old kernels.

Cool Tip: Find the largest files on your Linux system! Read more →

The volume “boot” has only 0 bytes disk space remaining

List the old kernels:

$ dpkg -l linux-{image,headers}-"[0-9]*" |\
  awk '/^ii/{ print $2}' |\
  grep -v -e $(uname -r | cut -f1,2 -d"-") |\
  grep -e '[0-9]'

Delete the old kernels:

$ dpkg -l linux-{image,headers}-"[0-9]*" |\
  awk '/^ii/{ print $2}' |\
  grep -v -e $(uname -r | cut -f1,2 -d"-") |\
  grep -e '[0-9]' |\
  xargs sudo apt-get -y purge