ABHIONLINUX
Site useful for linux administration and web hosting

2010/04/10

Semaphore issue - Unable to start apache.

Semaphores are used for communicating between the active processes of a certain application. In the case of Apache, they're used to communicate between the parent and child processes. If Apache can't write these things down, then it can't communicate properly with all of the processes it starts.
I'd assume if you're reading this article, Apache has stopped running. Run this command as root
# ipcs -s


If you see a list of semaphores, Apache has not cleaned up after itself, and some semaphores are stuck. Clear them out with this command:
# for i in `ipcs -s | awk '/httpd/ {print $2}'`; do (ipcrm -s $i); done
Now, in almost all cases, Apache should start properly.  If it doesn't, 
you may just be completely out of available semaphores.  You may want to
 increase your available semaphores, and you'll need to tickle your 
kernel to do so.  Add this to /etc/sysctl.conf:
kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024
And then run sysctl -p to pick up the new changes.

1 comment:

  1. for i in `ipcs -s | grep nobody | awk '{print $2}'`; do ipcrm -s $i; done

    ipcs | awk '/^0x000000/ && /nobody/ {print $2}' | xargs -n1 ipcrm -s

    ReplyDelete