If you run into a situation where there is ‘no space left on device’ when you run apt-get upgrade, then it suggests you do apt-get -f install. That won’t always fix it because well, there is no space left on the device!
If you’re lucky enough to be able to clean up some stuff so there is enough room, go ahead and do that. sudo apt-get -f install will fix things, after which you can proceed as intended.
On the other hand, if you feel stuck, try the following:
sudo apt-get install
Hopefully, this will show you some packages that have been obsoleted by the package you (or apt-get, actually) are trying to install just now. It can’t remove the packages because apt-get wants to install the new one first, for which there’s no space. Let’s say apt-get install shows the following output:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
linux-headers-3.0.0-12 linux-headers-3.0.0-13 linux-headers-3.0.0-12-generic-pae linux-headers-3.0.0-13-generic-pae
Use ‘apt-get autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Now you can go by the list one by one, as follows:
sudo dpkg —remove linux-headers-3.0.0-12
sudo dpkg —remove linux-headers-3.0.0-13
sudo dpkg —remove linux-headers-3.0.0-12-generic-pae
sudo dpkg —remove linux-headers-3.0.0-13-generic-pae
Note the package names above correspond to the ones mentioned by apt-get in the previous step. Yours will almost certainly be different.
You could also do them in one swoop as follows (I haven’t tried this:)
sudo dpkg —remove linux-headers-3.0.0-12 linux-headers-3.0.0-13 linux-headers-3.0.0-12-generic-pae linux-headers-3.0.0-13-generic-pae
Now, you can run sudo apt-get -f install and things will have been fixed, if enough space was cleared.
Hope this helps.