Resolve local hostname with nss-myhostname

      No Comments on Resolve local hostname with nss-myhostname

Many applications rely on a fully qualified domain name and won’t work properly or even fail to start without one. For example, even if your hostname is correctly set up, apache won’t start with the default configuration on Fedora 19 if your DNS server cannot resolve the hostname:

AH00557: httpd: apr_sockaddr_info_get() failed for HostName
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message

But fortunately there’s a plugin to the GNU Name Service Switch (NSS) of glibc called nss-myhostname that ensures, that the local hostname is always resolvable.

Since Fedora 19, nss-myhostname is no longer a separate package but part of the systemd package. To enable the plugin, open /etc/nsswitch.conf with you favourite editor and add myhostname to the line starting with hosts:

[...]
hosts:     files dns myhostname
[...]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.