Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache: No listening sockets available, shutting down
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Sat Dec 04, 2010 5:13 pm    Post subject: Apache: No listening sockets available, shutting down Reply with quote

Hi!

My Apache is refusing to start with the error message in this thread's subject line:

Code:
~ # apache2
no listening sockets available, shutting down
Unable to open logs


But I can't figure out what is wrong. There is no other process blocking port 80:

Code:
~ # netstat -anA inet

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:64738           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:8005          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:10022           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8009            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:587             0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:783           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:143             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:52885         127.0.0.1:783           TIME_WAIT
tcp        0      0 127.0.0.1:3306          127.0.0.1:58043         ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:58050         ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:58051         ESTABLISHED
tcp        0      0 127.0.0.1:58043         127.0.0.1:3306          ESTABLISHED
tcp        0      0 10.8.0.1:8080           10.8.0.6:35415          FIN_WAIT2
tcp        0    232 10.8.0.1:10022          10.8.0.6:52870          ESTABLISHED
tcp        0      0 127.0.0.1:58050         127.0.0.1:3306          ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:58045         ESTABLISHED
tcp        0      0 127.0.0.1:58049         127.0.0.1:3306          ESTABLISHED
tcp        0      0 127.0.0.1:3306          127.0.0.1:58049         ESTABLISHED
tcp        0      0 10.8.0.1:56114          10.8.0.6:19090          ESTABLISHED
tcp        0      0 127.0.0.1:58045         127.0.0.1:3306          ESTABLISHED
tcp        0      0 127.0.0.1:58051         127.0.0.1:3306          ESTABLISHED
tcp        0      0 10.8.0.1:8080           10.8.0.6:35414          TIME_WAIT


I verified via nmap from an outside server, port 80 is indeed closed.

I then moved all files in /etc/apache2/vhosts.d to another directory (so there are no "Listen" directives at all for Apache). This seems to have no effect on the problem

Finally, I re-emerged (--oneshot) Apache, no luck either.

Can anyone imagine what might be going wrong? I'd also be grateful for any debugging tips you could give me ("apache --help" just outputs the error message, is there anything like "apache --debug" or "apache --verbose" ?)
Back to top
View user's profile Send private message
Manko10
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2010
Posts: 105

PostPosted: Sat Dec 04, 2010 5:24 pm    Post subject: Reply with quote

Make sure that Apache is started as root and you have exactly one
Code:
Listen 80
directive in your configs.
_________________
Refining Linux Advent calendar series 2010: “24 Short Linux Hints
Back to top
View user's profile Send private message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Sat Dec 04, 2010 5:28 pm    Post subject: Reply with quote

Manko10 wrote:
Make sure that no other service is occupying port 80, Apache is started as root and you have exactly one
Code:
Listen 80
directive in your configs.


You didn't read my post at all, did you? :wink:

Because I was expecting this, I took all effort to show that port 80 is not blocked. And to remove any and all "Listen" directives (in fact, all VirtualHost configs) from my Apache.
Back to top
View user's profile Send private message
Manko10
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2010
Posts: 105

PostPosted: Sat Dec 04, 2010 5:38 pm    Post subject: Reply with quote

I just read the part with the blocking service not carefully enough, but I've already edited that out, you were only to fast. ;)
But you should still check your Listen directives. You need exactly one, not two and not zero. Perhaps you had two before and now you have none.
_________________
Refining Linux Advent calendar series 2010: “24 Short Linux Hints


Last edited by Manko10 on Sat Dec 04, 2010 5:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Sat Dec 04, 2010 5:38 pm    Post subject: Reply with quote

Maybe I should add that my Apache was working fine for about a year now and that I didn't change its configuration recently. The error just popped up after I rebooted my webserver.

There's nothing written to /var/logs/apache2/* either, which is why I resorted to running apache directly from the shell. Here's what apache2 -X -e Debug procures:

Code:
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module alias_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module auth_basic_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module authn_anon_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module authn_file_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module authz_default_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module authz_groupfile_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module authz_host_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module authz_user_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module autoindex_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module deflate_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module dir_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module env_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module filter_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module headers_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module log_config_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module mime_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module mime_magic_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module negotiation_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module rewrite_module
[Sat Dec 04 18:37:39 2010] [debug] mod_so.c(246): loaded module speling_module
no listening sockets available, shutting down
Unable to open logs
Back to top
View user's profile Send private message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Sat Dec 04, 2010 5:43 pm    Post subject: Reply with quote

Manko10 wrote:
I just read the part with the blocking service not carefully enough, but I've already edited that out, you were only to fast. ;)
But you should still check your Listen directives. You need exactly one, not two and not zero. Perhaps you had two before and now you have none.


Alright alright :D

I only have the default vhost configurations left in my /etc/apache2/vhosts.d:
  • 00_default_ssl_vhost.conf (not enabled)
  • 00_default_vhost.conf


There's only one Listen 80 directive in there.

Just for fun, I tried adding a second one, but this didn't change the output. Hrm...
Back to top
View user's profile Send private message
Manko10
Tux's lil' helper
Tux's lil' helper


Joined: 20 Aug 2010
Posts: 105

PostPosted: Sat Dec 04, 2010 5:52 pm    Post subject: Reply with quote

What about your /etc/apache2/httpd.conf? Is there any Listen directive? Is this directive outside of Vhost config tags?
_________________
Refining Linux Advent calendar series 2010: “24 Short Linux Hints
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15989

PostPosted: Sat Dec 04, 2010 6:01 pm    Post subject: Reply with quote

Since you can run Apache from a shell, try running it under strace to see exactly what errors it encounters before it stops.
Back to top
View user's profile Send private message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Sat Dec 04, 2010 6:10 pm    Post subject: Reply with quote

Manko10 wrote:
What about your /etc/apache2/httpd.conf? Is there any Listen directive? Is this directive outside of Vhost config tags?


I haven't touched my httpd.conf, so it should still be identical to the one in the Apache ebuild. Just did a quick grep, no "Listen" in there.
The only Listen directive I have (in 00_default_vhost.conf) is outside of the vhost tags.

In my shell tests, I did forget to specify the defined (-D DEFAULT_VHOST -D PHP5 etc.), so I wasn't testing with the same environment as the init script. I'll have to pick all the defines from my /etc/conf.d/apache2 and retry the shell test with those, will report back :)
Back to top
View user's profile Send private message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Sat Dec 04, 2010 6:16 pm    Post subject: Reply with quote

That didn't give me the error message I was hoping for:

Code:
apache2 -D DEFAULT_VHOST -D INFO -D SSL -D LANGUAGE -D SUEXEC -D PHP5 -D PYTHON -D DAV -D DAV_FS -D AUTH_DIGEST -D SVN -D PROXY

(no output at all, but Apache terminates)

In /var/log/apache2/error_log:
Code:
[Sat Dec 04 19:14:53 2010] [info] Init: Initialized OpenSSL library


I'll try if I can get more info with strace as Hu recommended.
Back to top
View user's profile Send private message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Sat Dec 04, 2010 6:40 pm    Post subject: Reply with quote

Just to be thorough, I investigated my SSL certificates (as Apache terminated right after initializing OpenSSL according to error_log).

It looks like my server "lost" the partition the SSL certificates where stored on, thus Apache couldn't read them. I would have hoped for a clearer error message (like "Couldn't read SSL certificate file from /restricted/directory/domain.com.crt") but, oh well, at least I found the problem now.

The certificates were on a softraid-1 partition no less. This is going to be a very interesting evening :) - but that's another issue.

Thanks for the help so far! It's great to have so many friendly people on this forum 8)
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15989

PostPosted: Sat Dec 04, 2010 8:48 pm    Post subject: Reply with quote

Cygon wrote:
I would have hoped for a clearer error message (like "Couldn't read SSL certificate file from /restricted/directory/domain.com.crt") but, oh well, at least I found the problem now.
Once you have the immediate problem fixed, please consider filing an enhancement request with the Apache project to improve the error message.
Back to top
View user's profile Send private message
madchaz
l33t
l33t


Joined: 01 Jul 2003
Posts: 993
Location: Quebec, Canada

PostPosted: Mon Dec 06, 2010 9:41 pm    Post subject: Reply with quote

Looks like everyone missed the last line of error.
Code:
Unable to open logs

you have read/write permisions with the user apache runs on to those files? Is the FS full by any chance?
_________________
Someone asked me once if I suffered from mental illness. I told him I enjoyed every second of it.
www.madchaz.com A small candle of a website. As my lab specs on it.
Back to top
View user's profile Send private message
Cygon
Tux's lil' helper
Tux's lil' helper


Joined: 05 Feb 2006
Posts: 89
Location: Germany

PostPosted: Thu Dec 09, 2010 7:16 pm    Post subject: Reply with quote

No problem there :)

One might guess that it's because my log files were also on the disappeared RAID partition, but that's not the case either. It's just a strange a follow-up error, the log files are writable and there's space for at least another 100 years of uptime. After I restored my certificates to a new location and updated the links, Apache came up fine and logging is working as it should.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum