Often users notice that the Apache service fails in the Linux server with the error “semget: No space left on device”.
As a part of our Server Management Services, we help our customers with requests related to Apache regularly.
Let us today discuss the possible reasons and fixes for this error.
What is “semget: No space left on device” error
Recently, we received a support request where Apache fails and is not starting again. Our Support Engineers immediately checked the “/usr/local/apache/error_log“. They then found the error as given below:
This error generally indicates that the server has run out of semaphores and apache cannot be started.
To see how many semaphores are being used, access the server via SSH as root and run the following command:
# ipcs -s
How to fix “semget: No space left on device” error
For the Apache to get started again, we must clear the semaphores. Run this for-loop to flush them:
for whatever in `ipcs -s | awk '{print $2}'`; do ipcrm -s $whatever; done
On older servers, this command may not work. In these cases, we may need to do the following:
# /sbin/service httpd stop
# ipcs -s | grep nobody | gawk '{ print $2 }' | xargs -n 1 ipcrm sem
# /sbin/service httpd start
If this is a recurrent problem for us, we have to increase the semaphore limits on the server. We can do that by adding the following to the /etc/sysctl.conf file:
# Increases the semaphore limits & extend Apache's uptime.
kernel.msgmni = 512
kernel.sem = 250 128000 32 512
Then load the new settings into the kernel:
# sysctl -p
[Need any further assistance to fix Apache errors? – We’re available 24*7]
Conclusion
In short, the semget error can trigger when the server has run out of semaphores. Today, we saw how our Support Engineers fix this error.
0 Comments