# [SOLVED] could not bind to address [::]:443

## Joseph_sys

After today's upgrade I'm getting an error with apache:

```
Starting apache2 ...

(98)Address already in use: make_sock: could not bind to address [::]:443

no listening sockets available, shutting down
```

```
# netstat -natp | grep LISTEN

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      6483/mysqld

tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      10200/smbd

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      6844/cupsd

tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      6565/postmaster

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      6970/master

tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      10200/smbd

tcp        0      0 :::80                   :::*                    LISTEN      9003/apache2

tcp        0      0 :::443                  :::*                    LISTEN      9003/apache2
```

In addition when I try to start sshd I get:

/etc/init.d/sshd start

/etc/init.d/sshd: line 17:  7470 Segmentation fault      ${SSHD_BINARY} -t ${myopts}

This only happened on my AMD64 box, both x86 boxes upgraded just fine.Last edited by Joseph_sys on Sun Sep 24, 2006 5:38 am; edited 1 time in total

----------

## phorn

But in your listing of "netstat" it shows apache2 as running.  That would explain why it can't bind port 443.

Try killing apache2 (the PID 9003 one) first...

Otherwise, it seems like apache is already running.  Can you connect to the local server on HTTP or HTTPS?

The sshd error is in fact strange.  You may want to run it in debug mode (figure out what myopts and SSHD_BINARY are, and run it manually on the command line with a debug option).

It may be that the OpenSSL library is bad, or that you should re-emerge openssh...

You might want to try a revdep-rebuild on ssh, to make sure it is using the correct libraries.

----------

## Joseph_sys

 *phorn wrote:*   

> But in your listing of "netstat" it shows apache2 as running.  That would explain why it can't bind port 443.
> 
> Try killing apache2 (the PID 9003 one) first...
> 
> Otherwise, it seems like apache is already running.  Can you connect to the local server on HTTP or HTTPS?
> ...

 

I tried killing apache PID, did not help, when I start it, it listen to: :::80  and :::443 

nor can I connect to localhost.

I've re-emerge openssh already and did revdep-rebuild

Noting helps :-/

----------

## Joseph_sys

Though doing:  netstat -natp I get:

```
Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      6483/mysqld

tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      10200/smbd

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      6844/cupsd

tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      6565/postmaster

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      6970/master

tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      10200/smbd

tcp        0      0 10.0.0.104:48268        64.233.167.99:80        ESTABLISHED 7348/firefox-bin

tcp        0      0 :::80                   :::*                    LISTEN      10470/apache2

tcp        0      0 :::443                  :::*                    LISTEN      10470/apache2

tcp      396      0 ::ffff:127.0.0.1:80     ::ffff:127.0.0.1:58804  CLOSE_WAIT  -

tcp      442      0 ::ffff:10.0.0.104:80    ::ffff:10.0.0.104:38080 CLOSE_WAIT  -
```

The last two lines are interesting, and it could be causing this problem.

How to shut it down, there is no PID associated with it?

update:

After killing process ID 10470 the last two lines dissapeard but after restarting apache still get :::80  :::443 

What else should I try?

----------

## phorn

So what's the actual error?

Does it hang: you connect to it on a web browser, and it then it sits there saying connecting... or waiting...?

Or does it give a 500 error when loading?

Or does it spit out an error message when you start it?

What happens if you run that netstat -natp when apache is not running?

It may be a module causing it.  I have had a problem with mod_rewrite or mod_alias causing a hang on start, and commenting out that LoadModule line in httpd.conf made it start normally.

If it's just the "address in use" error, what happens if you reboot the machine?

----------

## Joseph_sys

 *phorn wrote:*   

> So what's the actual error?
> 
> Does it hang: you connect to it on a web browser, and it then it sits there saying connecting... or waiting...?
> 
> Or does it give a 500 error when loading?
> ...

 

When I try to start it: /etc/init.d/apache2 start

 * Starting apache2 ...

(98)Address already in use: make_sock: could not bind to address [::]:443

no listening sockets available, shutting down

Unable to open logs

When I kill that starnge process ID :::80  and run netstat 

```
netstat -natp

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      6483/mysqld

tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      7037/smbd

tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      6845/cupsd

tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      6566/postmaster

tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      6971/master

tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      7037/smbd
```

Base on the address it looks to me as if apache was trying to bind to IPv6 instead of IPv4 but I don't know why?

tcp        0      0 :::80                   :::*                    LISTEN      10470/apache2

tcp        0      0 :::443                  :::*                    LISTEN      10470/apache2 

It should be:

tcp        0      0 0.0.0:80                   :::*                    LISTEN      10470/apache2

tcp        0      0 0.0.0:443                  :::*                    LISTEN      10470/apache

Restarting the machine doesn't help.

mod_rewrite or mod_alias don't cause any problem commenting them out doesn't help it still try to bind to IPv6

#Joseph

----------

## Joseph_sys

If I change in http.conf

Listen 80

to

Listen 0.0.0.0:80

It binds to IPv4 and apache is working OK but WHY???

with Listen 80 it is tryig to bind to IPv6

----------

## Joseph_sys

SOLVED, it took me all day. So if somebody has the same problem here is are the solutions (options).

The problem was caused by the fact that I had a IPv6 protocol enabled in the Kernel so after today's upgrade to apache-2.0.58-r2.  It decided that IPv6 should take precedence over IPv4 and apache binded to :::80 instead of 0.0.0.0:80

The only question I have why all of a sudden and which package cause it?

a.)

Quick way around it is to modify correctly you /etc/hosts file: 

...

# IPV6 versions of localhost and co

::1 ip6-localhost ip6-loopback syscon3.your_domain_name syscon3

...

restart apache.

Though, make sure your connection gets through your firewall to IPv6

b.)

Another solution is to tell your apache to listen to IPv4 that is in your httpd.conf

change from:

Listen 80

to

Listen 0.0.0.0:80

c.)

Disable IPv6 in your kernel

If I missed anything please add.

----------

