Apache can’t start because of a make_sock bind to address error on port 80

apache-2.2

I have noticed a new thing going on with my server that I can't quite figure out what is making it happen. I'm hoping someone out there has experience with this problem and can help me find a solution to get it to stop.

I did a reboot on my ubuntu server tonight that I have running at slicehost.com. Everything runs great until I go to start apache. I get the following error.

* Starting web server apache2 (98)Address already in use: make_sock:
could not bind to address 0.0.0.0:80
no listening sockets available,
shutting down Unable to open logs
…fail!

A little further research using netstat -ltnp | grep ':80' will show the following:

tcp 0 0 0.0.0.0:80
0.0.0.0:* LISTEN 3948/apache2

I can then kill 3948 and apache starts up like normal. The PID 3948 keeps changing to a different number.

This is new and the only thing I have done since I had a successful boot without this happening was uninstalling a manual install of phpmyadmin and then re-install it using the aptitude install commands. Phpmyadmin now runs fine on the server but I don't understand what this error means or how I can go about getting it resolved.

Anyone that might offer some insight would be greatly appreciated!

UPDATE:
After running ls -la /etc/init.d/ I get the following output. @prix it doesn't look like httpd is in this list.

total 308
drwxr-xr-x  2 root root  4096 2010-06-08 16:38 .
drwxr-xr-x 73 root root  4096 2010-08-18 14:56 ..
-rwxr-xr-x  1 root root  6464 2008-09-19 08:42 apache2
-rwxr-xr-x  1 root root  2231 2008-10-14 08:02 bootlogd
-rwxr-xr-x  1 root root  1916 2008-10-14 08:02 bootmisc.sh
-rwxr-xr-x  1 root root  3508 2008-10-14 08:02 checkfs.sh
-rwxr-xr-x  1 root root 10507 2008-10-14 08:02 checkroot.sh
-rwxr-xr-x  1 root root  7948 2008-09-25 04:12 console-screen.kbd.sh
-rwxr-xr-x  1 root root  1670 2008-06-11 16:02 console-setup
-rwxr-xr-x  1 root root  2653 2008-09-09 14:52 cron
-rwxr-xr-x  1 root root  7195 2008-09-29 05:15 glibc.sh
-rwxr-xr-x  1 root root  1329 2008-10-14 08:02 halt
-rwxr-xr-x  1 root root  1287 2008-10-14 08:02 hostname.sh
-rwxr-xr-x  1 root root  4528 2008-09-25 08:07 hwclockfirst.sh
-rwxr-xr-x  1 root root  4521 2008-09-25 08:07 hwclock.sh
-rwxr-xr-x  1 root root  1404 2008-06-11 16:02 keyboard-setup
-rwxr-xr-x  1 root root  1484 2008-10-14 08:02 killprocs
-rwxr-xr-x  1 root root  1818 2008-08-29 19:41 klogd
-rwxr-xr-x  1 root root   748 2008-06-21 17:30 loopback
-rwxr-xr-x  1 root root  1399 2008-10-14 10:51 module-init-tools
-rwxr-xr-x  1 root root   620 2008-10-14 08:02 mountall-bootclean.sh
-rwxr-xr-x  1 root root  1956 2008-10-14 08:02 mountall.sh
-rwxr-xr-x  1 root root  1351 2008-10-14 08:02 mountdevsubfs.sh
-rwxr-xr-x  1 root root  2296 2008-10-14 08:02 mountkernfs.sh
-rwxr-xr-x  1 root root   618 2008-10-14 08:02 mountnfs-bootclean.sh
-rwxr-xr-x  1 root root  2330 2008-10-14 08:02 mountnfs.sh
-rwxr-xr-x  1 root root  1321 2008-10-14 08:02 mountoverflowtmp
-rwxr-xr-x  1 root root  3668 2008-10-14 08:02 mtab.sh
-rwxr-xr-x  1 root root  5755 2008-09-19 07:02 mysql
-rwxr-xr-x  1 root root  2515 2008-09-19 07:02 mysql-ndb
-rwxr-xr-x  1 root root  1905 2008-09-19 07:02 mysql-ndb-mgm
-rwxr-xr-x  1 root root  2663 2008-06-23 09:21 networking
-rwxr-xr-x  1 root root  1271 2008-10-27 06:17 procps
-rwxr-xr-x  1 root root  9600 2008-10-14 08:02 rc
-rwxr-xr-x  1 root root   788 2008-10-14 08:02 rc.local
-rwxr-xr-x  1 root root   117 2008-10-14 08:02 rcS
-rw-r--r--  1 root root  1510 2008-10-14 08:02 README
-rwxr-xr-x  1 root root   639 2008-10-14 08:02 reboot
-rwxr-xr-x  1 root root   941 2008-10-14 08:02 rmnologin
-rwxr-xr-x  1 root root  5200 2008-07-28 08:42 rsync
-rwxr-xr-x  1 root root 33378 2008-05-20 02:27 sendmail
-rwxr-xr-x  1 root root  2283 2008-10-14 08:02 sendsigs
-rwxr-xr-x  1 root root   590 2008-10-14 08:02 single
-rw-r--r--  1 root root  4167 2008-10-14 08:02 skeleton
-rwxr-xr-x  1 root root  3710 2008-10-13 13:52 ssh
-rwxr-xr-x  1 root root   525 2008-10-14 08:02 stop-bootlogd
-rwxr-xr-x  1 root root  1096 2008-10-14 08:02 stop-bootlogd-single
-rwxr-xr-x  1 root root  3483 2008-08-29 19:41 sysklogd
-rwxr-xr-x  1 root root  2488 2008-10-24 05:38 udev
-rwxr-xr-x  1 root root   706 2008-10-24 05:38 udev-finish
-rwxr-xr-x  1 root root  3627 2008-10-14 08:02 umountfs
-rwxr-xr-x  1 root root  2140 2008-10-14 08:02 umountnfs.sh
-rwxr-xr-x  1 root root  1456 2008-10-14 08:02 umountroot
-rwxr-xr-x  1 root root  1815 2008-10-14 08:02 urandom
-rwxrwxr-x  1 root root  1314 2010-03-04 19:22 webmin
-rwxr-xr-x  1 root root  1777 2008-10-23 08:40 x11-common
-rwxr-xr-x  1 root root  2154 2008-07-28 07:27 xinetd

Best Answer

Well after creating a dev server as an exact copy to try out new things I think I have figured it out. I'll put my process below and hopefully it will help others in the future.

First thing I did was change my ports to a different number so I could see what was still running on port:80.

sudo nano /etc/apache2/ports.conf

I had oringally:

Listen 80
Listen 443

so I changed them to:

Listen 88
Listen 443

This let me do go and see what all was running now on my ports using sudo netstat -lpAinet

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:448                   *:*                     LISTEN      4183/apache2    
tcp        0      0 localhost:mysql         *:*                     LISTEN      3741/mysqld     
tcp        0      0 localhost:submission    *:*                     LISTEN      3973/sendmail: MTA:
tcp        0      0 *:www                   *:*                     LISTEN      4025/apache2    
tcp        0      0 *:ssh                   *:*                     LISTEN      3651/sshd       
tcp        0      0 *:kerberos              *:*                     LISTEN      4183/apache2    
tcp        0      0 localhost:smtp          *:*                     LISTEN      3973/sendmail: MTA:
tcp        0      0 *:https                 *:*                     LISTEN      4025/apache2

If you notice PID 4025 is running on *:www and on *:https. This is the apache instance that is messing the whole thing up. So doing a kill -9 {PID} will kill that process for good. (honestly don't know what the kill -9 does but it worked for me. Someone might want to correct that if it's not fully correct.

My next output was great. One instance of apache running now. sudo netstat -lpAinet

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:448                   *:*                     LISTEN      4183/apache2    
tcp        0      0 localhost:mysql         *:*                     LISTEN      3741/mysqld     
tcp        0      0 localhost:submission    *:*                     LISTEN      3973/sendmail: MTA:
tcp        0      0 *:webmin                *:*                     LISTEN      4233/perl       
tcp        0      0 *:ssh                   *:*                     LISTEN      3651/sshd       
tcp        0      0 *:kerberos              *:*                     LISTEN      4183/apache2    
tcp        0      0 localhost:smtp          *:*                     LISTEN      3973/sendmail: MTA:
udp        0      0 *:10000                 *:*                                 4233/perl

Now that I have found the problem I changed my ports.conf sudo nano /etc/apache2/ports.conf back to the original settings.

I simple apache stop sudo /etc/init.d/apache2 stop and start sudo /etc/init.d/apache2 start and things are working great. The real test for me was to reboot the server and see if it worked like it was suppossed to. Worked like a charm.

From a post I read about this with RedHat: http://www.linuxquestions.org/questions/linux-software-2/98-address-already-in-use-make_sock-could-not-bind-to-address-0-0-0-0-443-a-110753/#post1153056

The problem was because:

this problem is comes only if u started the weberver and than made some modification or tried to load the jsp or asp support than u will find http locked when u tried to restart it.

So hopefully this will help out the ton of other people that I googled having the same issue but no real solutions. It worked for my case anyway. Btw - This might be also because I'm using a Cloud Server. Not sure.