Two common errors while starting Apache server on Linux

  • HOME
  • >
  • >
  • Two common errors while starting Apache server on Linux
Last Updated: 

👉 This post was initially written in 2007 and refered to specific software versions. When troubleshooting your system, always consider which version and environment you are using.

Remember that the correct way to start the apache server is to use the apachectl command.

apachectl stop
apachectl start
apachectl graceful

You can also check your configuration files using apachectl configtest.

Address Already in Use

(98)Address already in use: make_sock: could not bind to address
no listening sockets available, shutting down

This is caused by one or more processes running on the 443 (secure socket) port. You can get all the process ID's that are running on this port with the command fuser or a more classical ps auxww with a less readable format.

[me@host ~]$ fuser 443/tcp
443/tcp: 7977 6815 9819 35217
# Now you just have to do a **kill** on those process.
[me@host ~]$ kill -9 7977 6815 9819 35217
# Or in a single line:
[me@host ~]$ kill -9 $(fuser 443/tcp 2>/dev/null)

No space left on device

(28)No space left on device: Couldn't create accept lock
# or
(28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed

When you check your storage, you find out that you have plenty of space still available. So, what is going on? The problem comes from apache that was not shutdown properly and left a lot of semaphore-arrays behind. Semaphore arrays are use for interprocess communication (ipc). So, here comes the ipcs command. ipcs provides information on the ipc facilities for which the calling process has read acccess.

[me@host ~]$ ipcs -s | grep www-data
0x00000000 163840 www-data 600 1  
0x00000000 196609 www-data 600 1  
0x00000000 229378 www-data 600 1

Before restarting your apache you have to remove all this semaphore arrays by using the ipcrm command. ipcrm removes a message queue, semaphore set or shared memory id.

[me@host ~]$ ipcs -s | grep www-data | perl -e "while () { @a=split(/\s+/); print \`ipcrm sem $a[1]\`}"
Related linux posts that you may like
What are the Differences Between Vi and Vim?
Review of the main differences between the Vi/Ex POSIX standard and the Vim implementation.
sudo: no tty present and no askpass program specified
Learn what is askpass and how to solve the 'sudo: no tty present and no askpass program specified' error when using sudo to execute a command.
What is the Bash Null Command?
Learn about the Bash null command, also known as the POSIX shell colon command. This post cover concrete use cases and pitfalls to avoid.