[Solved] Apache error: No space left on device: mod_rewrite: Parent could not create RewriteLock

Hello Folks,

Have you ever came across with the following error while trying to restart Apache.

[Fri Dec 19 12:11:40 2014] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock Configuration Failed

This was the error log obtained in /usr/local/apache/logs/error_log. Actually there was enough disk space in the server and df -i also seems to be good. Apache won’t get started. Recently I came across with a similar situation. Here is the solution that worked for me. I believe this will be helpful to you also. In my case it was not diskquota, actually it was semaphores.

What is Semaphores?

Sempahores are Interprocesses communication structures which means these are used to communicate between parent and child processes. If Apache can’t write things down, then it can’t communicate properly with the processes it starts.

The following command is used to get semaphore list

ipcs -s | grep nobody

Now you will get a long list of semaphores.

How to delete it?

ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem

After clearing the semaphore list, try to restart Apache. Apache will start without any problem. This is only a temporary fix. This will re-occur when the Semaphores get full.

To fix this permanently, you can increase the limit of Semaphore in the server.

Add the following lines in the file /etc/sysctl.conf

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

Then run sysctl -p to pick up the new changes.

Done!!!

Other Posts:

1. Unable to establish a PHP session – PHPMyAdmin error
2. How to enable Varnish in cPanel server
3. Easy way to install Memcached and memcache in a cPanel server

Heba Habeeb

Working as a Linux Server Admin, Infopark, Cochin, Kerala.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *