Cache has broken packages, exiting

by Scott Hebert

I've been getting the following error from cron.daily in my inbox lately:

Cache has broken packages, exiting

That's an annoying email to get everyday. I decided I would apt-get clean and that would probably fix the problem:

This is an older Ubuntu server running 12.04.5 LTS. When I installed it, it created a 256 MB /boot partition. I didn't notice it until later, but that small /boot has been the bane of my existence ever since. In thise case, /boot has run out of space:

Using dpkg --list | grep linux-image I found 15 kernels installed! Oh my. Obviously, I don't really need more than 2 or 3, so I am going to pare that back and ensure I've gotten some space back.

spinning hourglass

Back! OK, for the record, because the install of the newer kernel via apt-get was broken, I was unable to use apt-get remove. It was stuck trying to resolve failed dependencies and wanted me to run apt-get -f install. Obviously, that's going to fail until I clear up space. The trick was to run dpkg --purge for the older kernels to get them out of the way without getting mucked up in the apt database.