The solution to this turned out to be a little different to what I was expecting. After I asked this question my /tmp
directory "corrupted" two more times.
I finally figured out that actually it wasn't corrupt at all. It was just full of an enormous number of files (symlinks actually). So full in fact that ls
would hang for a considerable time (over a minute) whilst it was processing the index before it would start doing anything. My system wouldn't boot because part of the start up process is to clear out /tmp
, and it was getting stuck at this point. I never got the rm
command to return at all even after waiting for a very long period of time. After doing some online research I eventually came across this command:
cd /tmp
sudo find . ! -path . -delete
This seemed to work faster and only took an hour or so!!
That sorted out the /tmp
directory. The reason it was filling up was to do with printing. If I attempted to print something then that triggered the problem (although this wasn't immediately obvious as it took a while for /tmp
to fill up). However looking at the symlinks that were being created, I noticed that they were all pointing at a ppd file for my printer. I deleted and reinstalled my printer using the hp-setup program (it's an HP printer) - but that didn't solve the problem. However deleting and manually setting up the printer without using hp-setup did. Not sure if this is a problem with hp-setup, my printer driver or cups...but it now works.