Apache – No space left on device

Apache had crashed and when trying to restart it with service restart apache or /etc/init.d/apache restart the following error would result in the error_log file:

 (28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed

There weren’t any apache processes lingering around and the disk had plenty of space and inodes left. The following URL helped fix the problem, or, a reboot would have worked too:

URL:

This URL suggested the following commands to debug and fix:

ipcs -s | grep apache
ipcs -s | grep apache | perl -e ‘while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}’

Which worked for me.  Also suggested the following for Ubuntu 8.04:

ipcs -s | grep www-data | sudo perl -alne ‘qx(ipcrm -s $F[1])’