Failed to send mail : Failed to lookup IP address for localhost

Suddenly my customers are unable to send email with the following error Failed to send mail : Failed to lookup IP address for localhost

Also in Virtualmin I am presented with the following error Warning! A problem was detected with your Virtualmin license : An error occurred checking the licence : Invalid host or serial number When I click on Re-Check License Status I get the following
Now re-checking your Virtualmin license .. .. a problem was detected : An error occurred checking the licence : Invalid host or serial number

I am able to browse to software.virtualmin.com. I have edited the hostname since purchasing the license to reflect the reverse dns if that is relevant to this.

Status: 
Active

Comments

Howdy -- sorry that you're having problems sending email! What is the output of these commands:

cat /etc/hosts
cat /etc/nsswitch.conf

And, while the Virtualmin license error shouldn't be related, what is the output of this command:

virtualmin licence-info

Hi, thanks for the fast response.

# cat /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost

# The following lines are desirable for IPv6 capable hosts
#(added automatically by netbase upgrade)

::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
178.33.227.173 demeter.neopraxis.co.uk demeter ns3.webpurity.net mail.webpurity.net ns338867.ip-178-33-227.eu
2001:41d0:8:24ad:: demeter.neopraxis.co.uk demeter

# cat /etc/nsswitch.conf

#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Valid entries include:
#
# nisplus Use NIS+ (NIS version 3)
# nis Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the local database (.db) files
# compat Use NIS on compat mode
# hesiod Use Hesiod for user lookups
# [NOTFOUND=return] Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files sss
shadow:     files sss
group:      files sss
#initgroups: files

#hosts:     db files nisplus nis dns
hosts: files dns myhostname

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files    

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files sss

netgroup:   files sss

publickey:  nisplus

automount:  files
aliases:    files nisplus

# virtualmin licence-info

Serial number: GPL
License key: GPL
Expiry date:
Virtual servers: 9
Maximum servers: 10
Servers left: 1

Hmm, that all looks good. What is the output of this command:

host localhost

Also, where is it that you're seeing that error? That is, is that in your email logs on the server?

# host localhost

Host localhost not found: 3(NXDOMAIN)

Oh, upon second look, I think I may see the issue.

In your /etc/nsswitch.conf file, I see this line:

hosts: files dns myhostname

Try changing that to just read as follows:

hosts: files dns

After doing that, run this command again:

host localhost

What does that produce now?

ok,

# cat /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Valid entries include:
#
# nisplus Use NIS+ (NIS version 3)
# nis Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the local database (.db) files
# compat Use NIS on compat mode
# hesiod Use Hesiod for user lookups
# [NOTFOUND=return] Stop searching if not found so far
#

# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd:    db files nisplus nis
#shadow:    db files nisplus nis
#group:     db files nisplus nis

passwd:     files sss
shadow:     files sss
group:      files sss
#initgroups: files

#hosts:     db files nisplus nis dns
hosts: files dns

# Example - obey only what nisplus tells us...
#services:   nisplus [NOTFOUND=return] files
#networks:   nisplus [NOTFOUND=return] files
#protocols:  nisplus [NOTFOUND=return] files
#rpc:        nisplus [NOTFOUND=return] files
#ethers:     nisplus [NOTFOUND=return] files
#netmasks:   nisplus [NOTFOUND=return] files    

bootparams: nisplus [NOTFOUND=return] files

ethers:     files
netmasks:   files
networks:   files
protocols:  files
rpc:        files
services:   files sss

netgroup:   files sss

publickey:  nisplus

automount:  files
aliases:    files nisplus
# host localhost
Host localhost not found: 3(NXDOMAIN)

Do you know of any recent changes to that nsswitch.conf file?

I see a few unusual entries in it.

We corrected the issue with the "hosts" entry, but I'm curious if the other odd entries are causing a problem.

Before we get too far though -- can you verify that you're able to log into your server? That is, are SSH logins working?

I'm not aware of any direct or indirect changes to the nsswitch.conf.

And yes I can log on to the web control panel and via SSH.

I've rebooted and now email is working. Thanks. However, I am still getting this error.

# host localhost
Host localhost not found: 3(NXDOMAIN)

I have sorted the license issue by running the license script again given on the site in Virtualmin.com > Account > Software Licenses > Download And Install Command.

I've sorted the above NXDOMAIN error now too. I just had to add 127.0.0.1 as the first DNS server listed in Webmin > Networking > Network Configuration > Hostname and DNS Client, and then apply the configuration.

Thanks for all your help.

Ah that's good to hear!

That really shouldn't have mattered, since the nsswitch file had "files" listed first, and your /etc/hosts file had the correct localhost entry. But perhaps an invalid entry was cached in a running daemon.

Either which way, I'm glad you figured it out! Please feel free to let us know if you have additional questions.