June 9, 2015

Error: No space left on device: mod_rewrite: Parent could not create RewriteLock file

Apache  service on a Server stops while restart it shows following messages in error_logs
[Sun Dec 28 08:20:20 2014] [crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock
Configuration Failed
Such errors appears when you are running out of Disk Space or Quota which is assigned (which can be increased to fix the issue) OR when semaphores of the server gets full. Semaphores are often used to restrict the number of threads than can access some (physical or logical) resource.
Using the below command you can semaphores list.
root@server04 [~]# ipcs -s | grep nobody
So, In-order to clear the semaphores list. We have execute the following command.
root@server04 [~]# ipcs -s | grep nobody | awk '{print $2}' | xargs -n 1 ipcrm sem
After clearing the semaphores list, restart the apache server. Now, it will starts without any issues.But, it is an temporary solution it will re-occur when Semaphores get full.
Add following lines in “/etc/sysctl.conf” to get this issue fixed permanently. These values will increase the limits of Semaphores on the Server.
# 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 using the command.
root@server04 [~]# sysctl -p
Now you are in safe zone. :)

0 comments:

Post a Comment