# apache: unable to find IPv4 address of "Gentoo"

## jhon987

hi,

I'm having troubles resolving this issue (taken from /var/log/apache2/error_log): 

```
[alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "Gentoo"

Configuration Failed
```

I realize it has something to do with my /etc/hosts yet I'm not sure what is the exact course of action I should take, this my hosts file:

```
# cat /etc/hosts

# /etc/hosts: Local Host Database

#

# This file describes a number of aliases-to-address mappings for the for 

# local hosts that share this file.

#

# In the presence of the domain name service or NIS, this file may not be 

# consulted at all; see /etc/host.conf for the resolution order.

#

# IPv4 and IPv6 localhost aliases

127.0.0.1       Gentoo

::1             localhost

0.0.0.0         localhost

# Imaginary network.

#10.0.0.2               myname

#10.0.0.3               myfriend

#

# According to RFC 1918, you can use the following IP networks for private 

# nets which will never be connected to the Internet:

#

#       10.0.0.0        -   10.255.255.255

#       172.16.0.0      -   172.31.255.255

#       192.168.0.0     -   192.168.255.255

#

# In case you want to be able to connect directly to the Internet (i.e. not 

# behind a NAT, ADSL router, etc...), you need real official assigned 

# numbers.  Do not try to invent your own network numbers but instead get one 

# from your network provider (if any) or from your regional registry (ARIN, 

# APNIC, LACNIC, RIPE NCC, or AfriNIC.)

#
```

when I run rc-service apache2 start in terminal this is what I see:

```
apache2            | * Starting apache2 ...

apache2            |apache2: apr_sockaddr_info_get() failed for Gentoo

apache2            |apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

apache2            | * start-stop-daemon: failed to start `/usr/sbin/apache2'   [ !! ]

apache2            | * ERROR: apache2 failed to start
```

can someone please help?

----------

## Jaglover

```
0.0.0.0         localhost
```

 ? Try

```
127.0.0.1       localhost Gentoo
```

----------

## SwordArMor

I don’t have any entry about Gentoo in my /etc/hosts and my apache works. What do you have with `grep -r Gentoo /etc/apache2/` ?

----------

## jhon987

 *Jaglover wrote:*   

> 
> 
> ```
> 0.0.0.0         localhost
> ```
> ...

 

as you can see, I already have: 

0.0.0.0         localhost 

defined in there.

I've also tried:

127.0.0.1       localhost Gentoo

but still get same results

----------

## jhon987

 *SwordArMor wrote:*   

> I don’t have any entry about Gentoo in my /etc/hosts and my apache works. What do you have with `grep -r Gentoo /etc/apache2/` ?

 

```
# grep -r Gentoo /etc/apache2/

/etc/apache2/httpd.conf:# for Gentoo Linux.

/etc/apache2/httpd.conf:# Gentoo has made using virtual-hosts easy. In /etc/apache2/vhosts.d/ we
```

----------

## SwordArMor

And what is the content of /etc/apache2/modules.d/mod_unique_id.conf?

----------

## jhon987

 *SwordArMor wrote:*   

> And what is the content of /etc/apache2/modules.d/mod_unique_id.conf?

 

hmmm, strangely enough, I don't have such file, do you have one? (in that location)

I only have:

```
# locate mod_unique

/usr/lib64/apache2/modules/mod_unique_id.so
```

----------

## SwordArMor

I don’t have this file but it would have been the logical location for the configuration of that module. I’m trying to understand why your apache wants to bind the “Gentoo” IPv4 address.

However, I checked on my side and I also only have this .so:

```
alarig@bulbizarre ~ $ equery files =www-servers/apache-2.2.29 | grep mod_unique 

/usr/lib64/apache2/modules/mod_unique_id.so

```

But, by reading the doc¹ I can see that this module have to resolve the hostname of the local box. What is the hostname of your box and is it resolvable with the hosts file?

[1] https://httpd.apache.org/docs/2.2/mod/mod_unique_id.html

----------

## jhon987

 *SwordArMor wrote:*   

> I don’t have this file but it would have been the logical location for the configuration of that module. I’m trying to understand why your apache wants to bind the “Gentoo” IPv4 address.
> 
> However, I checked on my side and I also only have this .so:
> 
> ```
> ...

 

yeah, so, I'm not sure. I briefly read that too but perhaps I didn't get it right... 

anyways, my /etc/hostname is this:

```
# cat /etc/hostname

Gentoo
```

as you can see it matches the "127.0.0.1       Gentoo" configuration I have in /etc/hosts (same name), however this might be were I'm wrong since I tried changing any of these parameters, just to see if the log file would be different, and it didn't - meaning: ? - well, I'm not sure what it means...

shouldn't changing the hostname in  /etc/hostname yield  an error which ends with another name than "Gentoo", like so:

```
(EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of "<SOME-PARAMETER>"

Configuration Failed
```

----------

## SwordArMor

Yes, it’s a good way to know if it’s the hostname that generate this error.

----------

## jhon987

 *SwordArMor wrote:*   

> Yes, it’s a good way to know if it’s the hostname that generate this error.

 

OK so as I said, changing the hostname has no effect on the error output, from where does apache draws the hostname I wonder?

----------

## jhon987

Just wanted to say that I still haven't found a way how to solve this. I reverted to the only workaround I could conceive - remove apache2_modules_unique_id use-flag...

----------

## jhon987

Finally, SOLVED!

Just couldn't helped it and had to figure out the culprit, the problem was /etc/host.conf  wasn't configured correctly.

How did I figured it?

So, I tried pinging localhost and everything went fine, then tried pinging "gentoo" which is defined in my /etc/hosts as 127.0.0.1 and it couldn't resolve, tried pinging 127.0.0.1 directly and it worked.

I realized my /etc/hosts wasn't even used all along - that happened because I recently played with multilib and no-multilib profiles (testing each one) and the last time I moved to no-multilib I didn't emerged glibc but used quickpkg to build it from gentoo stage 3.

This move, in turn, lead to that /etc/host.conf simply wasn't configured (who would have thought that host.conf is actually dependent of glibc, I still can't see the relation between the two), anyways, once glibc's emerge was finished, I dispatched the configuration  and suddenly, everything is back to normal.

The funny thing is, the configuration is so minimal, it only uses 2 options:

order hosts, bind

and

multi on

could've written it manually and be done with it yesterday...

----------

