Apache won't restart. mktemp failed

August 24, 2015 6.9k views
Apache

My google skills are failing me here. There's definitely space on my server, about 51% actually. I'm getting this error when I try to restart apache:

mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: No space left on device
/etc/init.d/apache2: 91: /etc/init.d/apache2: cannot create : Directory nonexistent

  • The apache2 configtest failed.
6 Answers

You might want to check /proc/mounts to see if your filesystem is mounted as read-only ("ro") rather than read-write ("rw"). That can happen, for example, if there's filesystem corruption.

Also, if you've mounted a separate partition as /tmp, you'd want to specifically make sure that partition is not full.

  • That was the clue I needed! Ran mount -o remount,rw / and everything is back up. Thanks so much!

    EDIT: Actually that wasn't it. i'll keep looking, but it's a clue!

Great! You're very welcome.

i have problem with apache2 not runing when i start apace2 that error show

mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: No such file or directory
/etc/init.d/apache2: 91: /etc/init.d/apache2: cannot create : Directory nonexistent

Please help me how can i fix this problem my all websites gose down ... please help

Hey
I am having the exact same issue, none of the services, apache2, mysql, ssh is running
Does anyone have any solution for this
Thanks

You'll need to free up your inode usage
Run:

$ sudo df -i 

to see your inode usage
then you can run

$ for i in /*; do echo $i; find $i |wc -l; done

run this for each directory with very large number of files.

For example if you get:

/var
1002793

You can then run:

$ for i in /*; do echo $i; find $i |wc -l; done

Once you get to the directory containing the huge number of small files you can delete all those files if they are not so important or move them to another system or device.
Simple type:

$ rm -rf /directory_containing_annoying_small_files/

That's it.
Check again by running

$ df -i
Have another answer? Share your knowledge.