Recently we attempted to restart apache on a client’s server and we received the following error:
critical_create(): semget() failed: No space left on device
Although the error hinted at a disk space issue it actually had nothing to do with the available disk space. To resolve this you have two options:
1.) You could reboot the server which will clear the apache semaphores
2.) Or you can run the following:
killall -9 httpd
for i in $(ipcs|grep httpd|awk '{print $2}');do ipcrm -s $i;done
This will get a list of the semid’s and shmid’s and pass them to the ipcrm command. By using the ipcrm command on each id you will mark System V interprocess communication API kernel entities for removal. In short it will free up the memory being used by the kernel for these processes so you have enough memory to restart the service. Once you run this command simply restart apache!
/etc/init.d/httpd restart