Hello Folks, Have you ever came across with the following error while trying to restart Apache. IT’S SEMAPHORES!!
[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.
Read more about Semaphores
Semaphores are IPCs. IPC means Inter Process Communication Systems. These are used to allow different processes to communicate with each other.
In computer science, a semaphore is a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system such as a multi programming operating system. Read more…….
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
Thanks its work. Now apache can run normally
Ady, on behalf of @heba you’re most welcome 🙂