After running several updates today I received the ominous message that my /boot partition was 100% full. The first time I ran into this problem on Linux Mint, so now what?

I tend to switch between distributions and installations on a regular basis, so this was a new situation for me. I chose to run Linux Mint on my main box to offer me stability through my OSCP journey and I have stuck with it on my professional box ever since. All my work I do at home is done on this box, so it better be stable.

So, a quick DuckDuckGo search shows that there are many ways to manage old kernels. The first one is to simply go and remove old files in /boot. This is somewhat of a dirty and error-prone solution.

The next is to use dpkg to find old kernels and then apt purge them:

dpkg --list | grep linux-image
dpkg --list | grep linux-headers
apt-get purge linux-image-x...
apt-get purge linux-headers-x...

Again, this is a manual job that can go wrong if you accidentally remove the current kernel.

The easiest and safest way I found to do this was using a package called byobu, which seems to have nothing to do with kernel management when you read the description:

text window manager, shell multiplexer, integrated DevOps environment

But when you look at the installed files there is a nice little gem hidden away in it:

~ $ dpkg -L byobu | grep purge

The man page explains:

This program will remove old kernel and header packages from the system, freeing disk space. It will never remove the currently running kernel. By default, it will keep at least the latest 2 kernels.

And that is exactly what I want to have. A tool that cleans it up in a safe manner. After running it about 300MB was reclaimed and the fear of having a broken system has gone away.