Here's a new one. Apache wouldn't restart on a server complaining thus:
"No space left on device: mod_rewrite: could not create rewrite_log_lock"
After some digging around with strace, I saw it was failing to create a semaphore. Evidently, Apache can leave semaphores around after its death, and can cause this mystery problem.
So how do you fix it?
Like this:
for IPC in $(ipcs -s | grep apache | awk '{print$2}'); do ipcrm -s $IPC; done