“Warning: hostname localhost does not resolve to address ::1: No address associated with hostname” inside an openVZ/Debian container

ipv6mailmanopenvzpostfix

I'm getting the mesage regulary inside mail.log from postfix. In special, but not only, at mails send received mailman.

warning: hostname localhost does not resolve to address ::1: No
address associated with hostname

::1 as well as 127.0.0.1 are defined as localhost inside /etc/hosts — as provided by openVZ.

Actually inside /etc/hosts these is configured (I removed special domains and IP for reasons):

fe00::0         ip6-localnet
ff00::0         ip6-mcastprefix
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

2a01::<some IPv6> host.example.org  host example.org

127.0.0.1 localhost.localdomain localhost
# Auto-generated hostname. Please do not remove this comment.
xxx.xxx.xxx.xxx host.example.org  host example.org
::1             localhost ip6-localhost ip6-loopback

And this seems to work:

$ host localhost
localhost has address 127.0.0.1
localhost has IPv6 address ::1

On this box bley is also running.

Best Answer

It seems adding

multi on

to /etc/host.conf hase solved the issue.

Based on what I've found on the internet, this is allowing to have multiple IP for one host name (in this case localhost) which fit for IPv4 address and IPv6.