This seems to happen a lot to me, so, I decided to write instructions on freeing up space so I could avoid looking for Google solutions each time.
The error is pretty simple and straight forward, I get an error and I can’t install or do “some things” and that means I’m out of space. It’s very frustrating considering I think every update should get rid of say maybe the fourth previous update, albeit I haven’t been able to get it to work as it should. Since it isn’t that big of a deal to “fix it” when it happens, I’ve so far avoided the fix.
First thing, sudo apt-get -f install doesn’t work because there’s no space.
So, what does work is running:
ls -la /boot (this displays the list of kernels). I compare that with the current operating kernel.
Followed by (changing XXX and any other number as appropriate. And there may be several kernels to remove. Anything other than initrd.img and vmlinuz can be ignored as they’re not large enough to be worth the time):
sudo -i cd /boot rm initrd.img-4.4.0-XXX-generic rm vmlinuz-4.4.0-XXX-generic Next (don't try to add anything new yet, first the fix):
apt-get install -f
After apt-get is working again, removing all the old files is done with:
sudo apt-get autoremove