Friday, July 19, 2019

How To Fix Apache Error “(28)No space left on device”

How To Fix Apache Error “(28)No space left on device”
AH00023: Couldn't create the rewrite-map mutex
AH00016: Configuration Failed

On some occasions apache server will just fail, and become crashed, failing to restart with an error message like:
# systemctl restart httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
 # tail -f /var/log/httpd/error_log
You see this result :-
(28)No space left on device: AH00023: Couldn't create the rewrite-map mutex
AH00016: Configuration Failed
Or like that.

 If you see an error similar to the bellow, it could indicate that your server has run out of semaphores. To see how many semaphores are being used, type this command:-
# ipcs -s
 You see the result
------ Semaphore Arrays --------
key        semid      owner      perms      nsems   
0x00000000 131072     apache     600        1       
0x00000000 163841     apache     600        1       
0x00000000 65538      apache     600        1       
0x00000000 98307      apache     600        1       

0x00000000 196612     apache     600        1   

 Or check the total Locks
# ipcs -s | wc -l

132
Then type this command To fix it and get Apache server started again, we must clean the semaphores. Run the following command to flush them:

# for i in `ipcs -s | awk '/httpd/ {print $2}'`; do (ipcrm -s $i); done
OR
# for whatever in `ipcs -s | awk '{print $2}'`; do ipcrm -s $whatever; done

If that command not work on older server then you may stop the Apache service first.

# /etc/init.d/httpd stop OR # systemctl stop httpd 
# ipcs -s | grep nobody | gawk '{ print $2 }' | xargs -n 1 ipcrm sem 
# /etc/init.d/httpd start OR # systemctl start httpd
You may make the little changes in  /etc/sysctl.conf to increase the semaphore limits on your server.
You can do that by adding the following to the /etc/sysctl.conf
kernel.msgmni = 512
kernel.sem = 250 128000 32 512
 After, type the following command to update new setting for kernel

# sysctl -p


0 comments: