After cleaning out an unexpected /boot full fault on one of the Ubuntu servers that I maintain, I next encountered an equally frustrating problem whereby apt-get stopped working thanks to a mismatched kernel version issue (introduced because of the upgrade that had failed halfway thanks to the earlier running out of disk space in /boot!).
Essentially, any apt-get operation like say “apt-get upgrade” or “apt-get install -f” would result in the operation breaking with the following string appearing in the error message:
dpkg: dependency problems prevent configuration of linux-server: linux-server depends on linux-image-server (= 220.127.116.11.106); however: Version of linux-image-server on system is 18.104.22.168.114. linux-server depends on linux-headers-server (= 22.214.171.124.106); however: Version of linux-headers-server on system is 126.96.36.199.114. dpkg: error processing linux-server (--configure): dependency problems - leaving unconfigured
I spent a lot of time bashing away at this, trying to remove and install specific kernel versions, etc. (a lot of information on the issue can be found here), but in the end stumbled across this silly little fix that worked brilliantly efficiently:
sudo apt-get remove linux-server && sudo apt-get install linux-server
Yeah. Classics still work. When in doubt, uninstall and then reinstall!