Tab completion errors: bash: cannot create temp file for here-document: No space left on device

Your root file system is full and hence your temp dir (/tmp, and /var/tmp for that matter) are also full. A lot of scripts and programs require some space for working files, even lock files. When /tmp is unwriteable bad things happen.

You need to work out how you've filled the filesystem up. Typically places this will happen is in /var/log (check that you're cycling the log files). Or /tmp may be full. There's many, many other ways that a disk can fill up, however.

du -hs /tmp /var/log

You may wish to re-partition to give /tmp it's own partition (that's the old school way of doing it, but if you have plenty of disk it's fine), or map it into memory (which will make it very fast but start to cause swapping issues if you overdo the temporary files).


If anyone gets here with this error when their disk isn't full, be sure to check not just df but also df -i. There are a fixed number of inodes on a filesystem, and every file needs one. If you have just tons of small files, it's very easy for your filesystem to fill up with these small files while there's still plenty of space left on the drive when you run df.


You may also have lost write access to the /tmp/ directory.

It should look like that:

ls -l / |grep tmp
drwxrwxrwt   7 root root  4096 Nov  7 17:17 tmp

You can fix the permissions like that:

chmod a+rwxt /tmp