Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
failed to start `/usr/sbin/apache2' [solved]
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
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 489

PostPosted: Wed Feb 20, 2013 9:41 pm    Post subject: failed to start `/usr/sbin/apache2' [solved] Reply with quote

Hi,
rc.log shows the following error:
Code:
 * Starting D-BUS system messagebus ... [ ok ]
 * Starting syslog-ng ... [ ok ]
 * Starting ConsoleKit daemon ... [ ok ]
 * Setting console font [lat9w-16] ... [ ok ]
 * Bringing up interface wlp0s2f2u5
 *   Starting wpa_supplicant on wlp0s2f2u5 ... [ ok ]
 *   Starting wpa_cli on wlp0s2f2u5 ... [ ok ]
 *   Backgrounding ... ...
 * WARNING: net.wlp0s2f2u5 has started, but is inactive
 * WARNING: netmount is scheduled to start when net.wlp0s2f2u5 has started
 * Setting up kdm ... [ ok ]
 * Starting mysql ... [ ok ]
 * Starting apache2 ...
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
 * start-stop-daemon: failed to start `/usr/sbin/apache2' [ ok ]

netstat shows nothing interesting
Code:
netstat -tulpn| grep :80

Does someone know what's wrong?


Last edited by samo on Fri Feb 22, 2013 9:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
christofdeluca
n00b
n00b


Joined: 19 Mar 2005
Posts: 34

PostPosted: Thu Feb 21, 2013 6:35 am    Post subject: Reply with quote

Please post config file
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 489

PostPosted: Thu Feb 21, 2013 7:30 pm    Post subject: Reply with quote

The config file looks as follows:
Code:
# cat /etc/conf.d/apache2
# /etc/conf.d/apache2: config file for /etc/init.d/apache2

# When you install a module it is easy to activate or deactivate the modules
# and other features of apache using the APACHE2_OPTS line. Every module should
# install a configuration in /etc/apache2/modules.d. In that file will have an
# <IfDefine NNN> directive where NNN is the option to enable that module.
#
# Here are the options available in the default configuration:
#
#  AUTH_DIGEST  Enables mod_auth_digest
#  AUTHNZ_LDAP  Enables authentication through mod_ldap (available if USE=ldap)
#  CACHE        Enables mod_cache
#  DAV          Enables mod_dav
#  ERRORDOCS    Enables default error documents for many languages.
#  INFO         Enables mod_info, a useful module for debugging
#  LANGUAGE     Enables content-negotiation based on language and charset.
#  LDAP         Enables mod_ldap (available if USE=ldap)
#  MANUAL       Enables /manual/ to be the apache manual (available if USE=docs)
#  MEM_CACHE    Enables default configuration mod_mem_cache
#  PROXY        Enables mod_proxy
#  SSL          Enables SSL (available if USE=ssl)
#  STATUS       Enabled mod_status, a useful module for statistics
#  SUEXEC       Enables running CGI scripts (in USERDIR) through suexec.
#  USERDIR      Enables /~username mapping to /home/username/public_html
#
#
# The following two options provide the default virtual host for the HTTP and
# HTTPS protocol. YOU NEED TO ENABLE AT LEAST ONE OF THEM, otherwise apache
# will not listen for incomming connections on the approriate port.
#
#  DEFAULT_VHOST      Enables name-based virtual hosts, with the default
#                     virtual host being in /var/www/localhost/htdocs
#  SSL_DEFAULT_VHOST  Enables default vhost for SSL (you should enable this
#                     when you enable SSL)
#                                                                                                                   
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D PHP5"                                         
                                                                                                                   
# Extended options for advanced uses of Apache ONLY                                                                 
# You don't need to edit these unless you are doing crazy Apache stuff                                             
# As not having them set correctly, or feeding in an incorrect configuration                                       
# via them will result in Apache failing to start                                                                   
# YOU HAVE BEEN WARNED.                                                                                             
                                                                                                                   
# PID file                                                                                                         
#PIDFILE=/var/run/apache2.pid                                                                                       
                                                                                                                   
# timeout for startup/shutdown checks                                                                               
#TIMEOUT=10                                                                                                         
                                                                                                                   
# ServerRoot setting                                                                                               
#SERVERROOT=/usr/lib/apache2                                                                                       
                                                                                                                   
# Configuration file location                                                                                       
# - If this does NOT start with a '/', then it is treated relative to                                               
# $SERVERROOT by Apache                                                                                             
#CONFIGFILE=/etc/apache2/httpd.conf                                                                                 
                                                                                                                   
# Location to log startup errors to                                                                                 
# They are normally dumped to your terminal.                                                                       
#STARTUPERRORLOG="/var/log/apache2/startuperror.log"                                                               

# A command that outputs a formatted text version of the HTML at the URL
# of the command line. Designed for lynx, however other programs may work.
#LYNX="lynx -dump"

# The URL to your server's mod_status status page.
# Required for status and fullstatus
#STATUSURL="http://localhost/server-status"

# Method to use when reloading the server
# Valid options are 'restart' and 'graceful'
# See http://httpd.apache.org/docs/2.2/stopping.html for information on
# what they do and how they differ.
#RELOAD_TYPE="graceful"
Back to top
View user's profile Send private message
JROCK2004
Guru
Guru


Joined: 02 Mar 2004
Posts: 450
Location: PA

PostPosted: Thu Feb 21, 2013 8:26 pm    Post subject: Reply with quote

If you are trying to start apache, this is how I do it and sure if this would work for you

Code:

/etc/init.d/apache2 start
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 489

PostPosted: Thu Feb 21, 2013 8:56 pm    Post subject: Reply with quote

I get the following results:
Code:
# /etc/init.d/apache2 start
 * WARNING: apache2 has already been started

Code:
# /etc/init.d/apache2 restart
 * apache2 not running (no pid file)
 * Starting apache2 ...
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
 * start-stop-daemon: failed to start `/usr/sbin/apache2'
Back to top
View user's profile Send private message
Telamon
Tux's lil' helper
Tux's lil' helper


Joined: 29 Dec 2003
Posts: 129

PostPosted: Thu Feb 21, 2013 9:14 pm    Post subject: Check netstat Reply with quote

Try running "netstat -lnp |grep :80" as root. It will show you what the program is that is currently bound to port 80. It might be that you have a copy of apache running that Gentoo's init system doesn't know about. To fix that, stop apache (apache2ctl stop), reset the init settings (/etc/init.d/apache2 zap) and try restarting it (/etc/init.d/apache2 start)
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 489

PostPosted: Thu Feb 21, 2013 9:29 pm    Post subject: Reply with quote

When running netstat -lnp |grep :80 as root it returns nothing (see above).
The result of the other commands looks as follows:
Code:
# apache2ctl stop
 * WARNING: apache2 is already stopped
# /etc/init.d/apache2 zap
 * Manually resetting apache2 to stopped state
# /etc/init.d/apache2 start
 * Starting apache2 ...
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
 * start-stop-daemon: failed to start `/usr/sbin/apache2'
Back to top
View user's profile Send private message
christofdeluca
n00b
n00b


Joined: 19 Mar 2005
Posts: 34

PostPosted: Fri Feb 22, 2013 12:31 pm    Post subject: Reply with quote

Check all the config files and make sure you don't have multiple "Listen 80" lines.
Back to top
View user's profile Send private message
samo
Guru
Guru


Joined: 13 Mar 2004
Posts: 489

PostPosted: Fri Feb 22, 2013 9:07 pm    Post subject: Reply with quote

Thanks, the hint was very helpful
Code:
# grep -r "Listen 80" /etc
apache2/vhosts.d/10_myweb_vhost.conf:Listen 80
apache2/vhosts.d/00_default_vhost.conf:Listen 80

After removing the second line in 10_myweb_vhost.conf apache could be started correctly.
Back to top
View user's profile Send private message
christofdeluca
n00b
n00b


Joined: 19 Mar 2005
Posts: 34

PostPosted: Sat Feb 23, 2013 2:46 pm    Post subject: Reply with quote

No problem. I pulled my hair out at that too. Can't bind more than one host to port 80!
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