[arch-general] Cannot no longer resolve local hostname with the new nsswitch.conf

Chi-Hsuan Yen yan12125 at gmail.com
Tue Nov 8 14:14:59 UTC 2016


On Tue, Nov 8, 2016 at 10:02 PM, Damjan Georgievski via arch-general <
arch-general at archlinux.org> wrote:

> On 8 November 2016 at 13:37, Chi-Hsuan Yen via arch-general
> <arch-general at archlinux.org> wrote:
> > Hi Arch enthuasiasts,
> >
> > With testing/filesystem 2016.11-2, I can no longer use my local hostname
> to
> > acess services on the local machine. For example:
> >
> > $ hostname
> > PC12574
> >
> > $ ping PC12574
> > ping: PC12574: Name or service not known
> >
> > Seems changes in nsswitch.conf [1] does the effect. If I change the
> hosts:
> > line in nsswitch.conf back to the old configuration "files resolve
> > mymachines myhostname", or remove the [!UNAVAIL=return] part from this
> > line, ping works fine:
>
> do you have systemd-resolved running?
> what does `getent -s resolve hosts <you hostname>` return?
>
> --
> damjan
>

Here it is:

$ getent -s resolve hosts $(hostname)

[2] $ systemctl status systemd-resolved.service
● systemd-resolved.service - Network Name Resolution
   Loaded: loaded (/usr/lib/systemd/system/systemd-resolved.service;
disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:systemd-resolved.service(8)
           http://www.freedesktop.org/wiki/Software/systemd/resolved

http://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers

http://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients

The getent command prints nothing and exits with 2. And from strace, it
asks Google DNS, which is set in my /etc/resolv.conf:

$ strace -f getent -s resolve hosts "$(hostname)" |& grep recvfrom
recvfrom(6, "^\236\201\203\0\1\0\0\0\1\0\0\17PC12574\0\0\34\0"..., 1024, 0,
{sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")},
[28->16]) = 108
recvfrom(6, "\314d\201\203\0\1\0\0\0\1\0\0\17PC12574\0\0\1\0"..., 1024, 0,
{sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.8.8")},
[28->16]) = 108

Is it normal?

Best,

Yen Chi Hsuan


More information about the arch-general mailing list