# failed to start `/usr/sbin/apache2' [solved]

## samo

Hi,

rc.log shows the following error:

```
 * 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

```
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

----------

## christofdeluca

Please post config file

----------

## samo

The config file looks as follows:

```
# 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"
```

----------

## JROCK2004

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

```

/etc/init.d/apache2 start

```

----------

## samo

I get the following results:

```
# /etc/init.d/apache2 start 

 * WARNING: apache2 has already been started
```

```
# /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'
```

----------

## Telamon

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)

----------

## samo

When running netstat -lnp |grep :80 as root it returns nothing (see above).

The result of the other commands looks as follows:

```
# 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'
```

----------

## christofdeluca

Check all the config files and make sure you don't have multiple "Listen 80" lines.

----------

## samo

Thanks, the hint was very helpful

```
# 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.

----------

## christofdeluca

No problem. I pulled my hair out at that too. Can't bind more than one host to port 80!

----------

