How to Fix the Apache Error: semget No space left on device?

How to Fix the Apache Error: semget No space left on device?

When Apache does not start as intended, the first thing admins should do is check the error logs with cPanel. One of the error logs can be the ‘segmet: No space left on device’ error. This basically informs that the server is out of semaphores. To know the number of semaphores that are currently in use, login to the server as the root user and execute the following:

Code:
ipcs –s
To fix this error, you need to clear all or most of the semaphores. For this, execute the below command:

Code:
for whatever in `ipcs -s | awk ‘{print $2}’`; do ipcrm -s $whatever; done
If you’re a user of old Apache servers, the above code may not work. So you should go with the following code:

Code:
/sbin/service httpd stop
ipcs -s | grep nobody | gawk ‘{ print $2 }’ | xargs -n 1 ipcrm sem
/sbin/service httpd start
It should fix the error.

If you’re experiencing the segmet error again and again, you may decide to increase the semaphore limit on the server. For this purpose, open the configuration file at /etc/sysctl.conf and add the following lines:

# For increasing the semaphore limits & extend Apache’s uptime:

Code:
kernel.msgmni = 512
kernel.sem = 250 128000 32 512
Later, users can load new settings into the kernel by using the following code:

Code:
sysctl -p
So that’s how you fix the ‘semget: No space left on device’ error.
Author
kumkumsharma
Views
109
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top