Why won't Apache start? mktemp failed to create file via template
I'm running Apache2 on Ubuntu 14.04, and when I try to start Apache with sudo service apache2 start
, I'm met with the following error:
mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: No space left on device
I've checked my available disk space with df -h
and have plenty of free space. How can I get Apache running again?
1 Reply
This is an issue with Apache that can occur when a small number of directories end up getting too large. We're on the hunt for the largest directories so we can clean them up. The following command will help find the largest directories:
sudo du -Sh / | sort -rh | head -n 20
It's also useful to search for directories with the highest file count. This command will work for that search:
sudo du -a / | sort -n -r | head -n 20
Delete whatever you can with the rm
command. Triple check the files/directories aren't important before using this command because file deletion using rm
is permanent.
Once you've cleared up space and deleted unnecessary files (session/temp files are a generally safe to delete and are usually the culprits), run sudo service apache2 start
to bring Apache2 back up.