Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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
share|improve this question
    
what is the output of ps -auxf|grep httpd after the server is rebooted ? if you have a few lines with httpd on the output means apache is up and running. Instead of killing the process you could perform sudo sudo /etc/init.d/apache2 restart ! Further in a install of phpmyadmin would not cause your apache to fail but a wrong edit of the httpd.conf file could, have you changed anything with the file ? –  Prix Aug 18 '10 at 5:15
    
When I run that I get the following: root 4050 0.0 0.0 7456 876 pts/0 S+ 00:31 0:00 _ grep httpd I do try to restart apache but the error above is what I get. Killing the process is the only way I have found to get apache running. As for httpd.conf I have left it alone for quite sometime, but I'll go through it to see if something is wrong it, that is at least obvious. I appreciate the suggestions –  Chad Aug 18 '10 at 5:33
    
Something interesting as well: if I do "apache2ctl restart" then I get a different error. httpd not running, trying to start (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 –  Chad Aug 18 '10 at 5:42
    
+1 I can confirm this problem exists on CentOS 5.5 too. There are processes running for httpd but service httpd status reports apache is not running, additionally log files are not being written too and attempts to restart httpd using service httpd restart fail. The only fix is to killall -9 httpd and start apache again correctly. This problem is caused by apache not being able to connect to port 80 but I have not been able to determine why. –  Richard Holloway Aug 18 '10 at 7:36
    
@chad cat /etc/apache2/ports.conf what is the output ? @Richard Holloway since centos is very different from ubuntu i would recommend you making your own question i will take a look and try to assist you with what i can. I've used centos a lot but never had such problem if it were a different OS i would'nt say but being centos i would guess that it seems you have 2 separeted installation of apache on it. –  Prix Aug 18 '10 at 8:42

2 Answers 2

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.

share|improve this answer
    
then you have to change the jps/asp support to a secondary port on the config of it files... and maintain apache with 80 and 443 and use mod_proxy to redirect anything for the jsp/asp using it –  Prix Aug 19 '10 at 2:43

If you make a configuration changes and then restart apache using

service httpd restart

Then you will experience this problem and you will have to kill all httpd processes and the start apache again.

killall -9 httpd
service httpd start

To stop this from occurring, when you make a configuration changes do not use

service httpd restart

use

service httpd reload

I have tested this and this has fixed the problem for me on the two servers that were affected.

share|improve this answer
    
Following the update to the question, use /etc/init.d/apache reload in place of service httpd reload and similarly for other service commands. –  Richard Holloway Oct 6 '10 at 22:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.