I've been getting the following error from cron.daily in my inbox lately:
/etc/cron.daily/apt:
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:
$ sudo apt-get clean
$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
linux-server : Depends: linux-headers-server (= 3.2.0.94.108) but 3.2.0.95.111 is installed
E: Unmet dependencies. Try using -f.
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:
$ df -h /boot
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 228M 225M 0 100% /boot
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. Be right back...
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.