FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 09-29-2008, 02:00 AM
Jerry McBride
 
Default /etc/init.d/apache2 fails, but apache will run

On Sunday 28 September 2008 09:26:06 pm Adam Carter wrote:
> rix adam # /etc/init.d/apache2 start
> * Starting 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 [
> ok ] rix adam #
>
> The socket is not in use and log dir perms are ok, and;
>
> rix adam # apache2 -f /etc/apache2/httpd.conf
> rix adam # pgrep -lf apach
> 17740 apache2 -f /etc/apache2/httpd.conf
> 17741 apache2 -f /etc/apache2/httpd.conf
> 17744 apache2 -f /etc/apache2/httpd.conf
> 17772 apache2 -f /etc/apache2/httpd.conf
> rix adam #
>
> So, how do I troubleshoot this?

I just did a google search on the error "(98)Address already in use:
make_sock: could not bind to address 0.0.0.0:80
> no listening sockets available, shutting down" and it turned up so much that
I just don't even feel like reading it for you...

What I suspect and what's mentioned in the pages that google turned up,
something else is bound to port 80.

Do a "ps -A | grep apache" and see if a stray daemon is running around... i
not then go to /etc/apache2/vhosts.d and make sure both config files
are "pointing" to the same host that apache is running on...

That's where I would start.


--

************************************************** ***************************

From the desk of:
Jerome D. McBride

21:56:02 up 1 day, 2:13, 5 users, load average: 0.14, 0.07, 0.02

************************************************** ***************************
 
Old 09-29-2008, 02:17 AM
Adam Carter
 
Default /etc/init.d/apache2 fails, but apache will run

> On Sunday 28 September 2008 09:26:06 pm Adam Carter wrote:
> > rix adam # /etc/init.d/apache2 start
> > * Starting 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
> [
> > ok ] rix adam #
> >
> > The socket is not in use and log dir perms are ok, and;
> >
> > rix adam # apache2 -f /etc/apache2/httpd.conf
> > rix adam # pgrep -lf apach
> > 17740 apache2 -f /etc/apache2/httpd.conf
> > 17741 apache2 -f /etc/apache2/httpd.conf
> > 17744 apache2 -f /etc/apache2/httpd.conf
> > 17772 apache2 -f /etc/apache2/httpd.conf
> > rix adam #
> >
> > So, how do I troubleshoot this?
>
> I just did a google search
<SNIP> something else is bound to port 80.

As stated above - socket 80 is not in use (according to netstat). If there was, "apache2 -f /etc/apache2/httpd.conf" would also fail, would it not?

> Do a "ps -A | grep apache" and see if a stray daemon is
> running around... I

I did that, there were no apache processes running.

> not then go to /etc/apache2/vhosts.d and make sure both config files
> are "pointing" to the same host that apache is running on...

Again, if the config was broken then I'd expect # apache2 -f /etc/apache2/httpd.conf to also fail.

I'd say the problem is related to how the gentoo stuff starts the daemon, or maybe conf.d/apache2, but nothing below looks unusual to me;

rix apache2 # grep ^[^#] /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D PHP5"
CONFIGFILE=/etc/apache2/httpd.conf
 
Old 09-29-2008, 11:39 AM
Xav'
 
Default /etc/init.d/apache2 fails, but apache will run

Adam Carter a écrit :

On Sunday 28 September 2008 09:26:06 pm Adam Carter wrote:

rix adam # /etc/init.d/apache2 start
* Starting 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

[

ok ] rix adam #

The socket is not in use and log dir perms are ok, and;

rix adam # apache2 -f /etc/apache2/httpd.conf
rix adam # pgrep -lf apach
17740 apache2 -f /etc/apache2/httpd.conf
17741 apache2 -f /etc/apache2/httpd.conf
17744 apache2 -f /etc/apache2/httpd.conf
17772 apache2 -f /etc/apache2/httpd.conf
rix adam #

So, how do I troubleshoot this?

I just did a google search

<SNIP> something else is bound to port 80.

As stated above - socket 80 is not in use (according to netstat). If there was, "apache2 -f /etc/apache2/httpd.conf" would also fail, would it not?


Can you please post the output of grep -r Listen /etc/apache2 ... This
might help IMHO, i think that wehn you start apache manually, you do
not define DEFAULT_VHOST which add a Listen 80 directive, so try to
start apache manually with the same command line arguments as the init
script did it...


HTH.

Xav'


Do a "ps -A | grep apache" and see if a stray daemon is
running around... I


I did that, there were no apache processes running.


not then go to /etc/apache2/vhosts.d and make sure both config files
are "pointing" to the same host that apache is running on...


Again, if the config was broken then I'd expect # apache2 -f /etc/apache2/httpd.conf to also fail.

I'd say the problem is related to how the gentoo stuff starts the daemon, or maybe conf.d/apache2, but nothing below looks unusual to me;

rix apache2 # grep ^[^#] /etc/conf.d/apache2
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D PHP5"
CONFIGFILE=/etc/apache2/httpd.conf
 
Old 09-29-2008, 03:11 PM
Simon
 
Default /etc/init.d/apache2 fails, but apache will run

Have you done an upgrade/update of apache lately?

Whenever apache gets updated here, two files are recreated each time.
If you look in /etc/apache2, it should look like this:

-rw-r--r-- 1 root root 6311 Sep 2 03:23 httpd.conf
-rw-r--r-- 1 root root 12958 Sep 8 16:52 magic
drwxr-xr-x 2 root root 4096 Sep 8 22:50 modules.d
drwxr-xr-x 2 root root 4096 Sep 8 16:53 ssl
drwxr-xr-x 2 root root 4096 Sep 16 07:59 vhosts.d

Reading through httpd.conf, you should find the lines:
----
# Virtual-host support
#
# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we
# include a default vhost (enabled by adding -D DEFAULT_VHOST to
# APACHE2_OPTS in /etc/conf.d/apache2).
Include /etc/apache2/vhosts.d/*.conf
----

And looking through /etc/apache2/vhosts.d/, you should find all your own virtual
servers, I name mine as per the port they use:


-rwxr-xr-x 1 root root 565 Sep 1 07:55 80.conf
-rwxr-xr-x 1 root root 368 Sep 16 07:57 8080.conf
-rw-r--r-- 1 root root 2.8K Sep 8 16:52 default_vhost.include

I don't have the two files that are recreated each time here, but they contain a
configuration similar to the one in my 80.conf. Thus, it load my 80.conf, and
then tries to load its own default_80.conf (or something like that) and
conflicts since the port 80 is already in use (by another vhost).


2 ways to solve this: either use those default file names for your own vhost
configuration so portage will ask you to update /etc files interactively, or
delete those 2 files each and every time you update apache. I have never looked
into that but maybe by removing the option -D DEFAULT_VHOST in you
/etc/conf.d/apache2 might do the trick also.


HTH,
Simon


Adam Carter wrote:

rix adam # /etc/init.d/apache2 start
* Starting 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 [ ok ]
rix adam #

The socket is not in use and log dir perms are ok, and;

rix adam # apache2 -f /etc/apache2/httpd.conf
rix adam # pgrep -lf apach
17740 apache2 -f /etc/apache2/httpd.conf
17741 apache2 -f /etc/apache2/httpd.conf
17744 apache2 -f /etc/apache2/httpd.conf
17772 apache2 -f /etc/apache2/httpd.conf
rix adam #

So, how do I troubleshoot this?
 

Thread Tools




All times are GMT. The time now is 10:55 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org