Facing the following error on Apache ?
Apache: [emerg] (28)No space left on device: Couldn’t create accept lock [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec) [crit] (28) No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock
You might check if the disk space is full and can easily confirm that is not the reason for this error.
The reason behind the error message is Semaphores. You will have to kill the hung/stuck semaphore processes in order.
To list the PIDs of the active semaphore processes, execute:
# ipcs -s
—— Semaphore Arrays ——– key
semid owner perms nsems
0×00000000 xxxxxxxxxx apache 600 1
0×00000000 xxxxxxxxxx apache 600 1
0×00000000 xxxxxxxxxx apache 600 1
0×00000000 xxxxxxxxxx apache 600 1
To kill those process, use the command :
# ipcrm -s PID
Once those stuck/hung processes are cleared, restart your Apache service.
To kill all the active semaphores, hit the following command :
# ipcs -s | grep apache | awk ‘ { print $2 } ‘ | xargs ipcrm sem
^ if you find ‘nobody’ is the owner of the process when you run # ipcs -s, you need to do :
# ipcs -s | grep nobody | awk ‘ { print $2 } ‘ | xargs ipcrm sem
To kill all the active semaphores, hit the following command :
# ipcs -s | grep apache | awk ‘ { print $2 } ‘ | xargs ipcrm sem
^ if you find ‘nobody’ is the owner of the process when you run # ipcs -s, you need to do :
# ipcs -s | grep nobody | awk ‘ { print $2 } ‘ | xargs ipcrm sem