Linux SysAdmin & DevOps

Apache2 - No space left on device Couldn't create accept lock

Apache: No space left on device: Couldn’t create accept lock - an interesting error. I can’t really remember if I did or modified anything to my apache web server configuration but for some reason I got a notification stating that my web server is down.

I tried to restart apache and although /etc/init.d/httpd start was saying that apache has started successfully, nothing happend. Checking apache logs I have discovered the error above.

My first instinct was to check disk space. I had over 25 Gb free space so the free space was not an issue. Everything I tried was totally in vain. I even tried to remove the apache .rpm package and reinstall it from my custom built .rpm. Nothing.

So when you have an issue like this and you don’t know what to do, you just google it. And after a couple of minutes of reading, I found the answer and the solution as well on a nice blog article. (many thanks to the blog owner, he’s a live savior).

Long story short, if you find yourself in a similar situation you have to do the following:

APACHE running on RedHat or CentOS linux distributions:

for i in $(ipcs -s | awk '/nobody/ {print $2}'); do { ipcrm -s $i ; } done;
echo "kernel.msgmni = 1024" >> /etc/sysctl.conf
echo "kernel.sem = 250 256000 32 1024" >> /etc/sysctl.conf
sysctl -p
/etc/init.d/httpd restart

APACHE running on Debian linux distribution:

for i in $(ipcs -s | awk '/www-data/ {print $2}'); do { ipcrm -s $i ; } done;
echo "kernel.msgmni = 1024" >> /etc/sysctl.conf
echo "kernel.sem = 250 256000 32 1024" >> /etc/sysctl.conf
sysctl -p
/etc/init.d/apache2 restart

This should fix your problems and now you have a running apache (httpd) web server!