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

Chi-Hsuan Yen yan12125 at gmail.com
Tue Nov 8 13:23:29 UTC 2016


On Tue, Nov 8, 2016 at 9:11 PM, Jan Alexander Steffens via arch-general <
arch-general at archlinux.org> wrote:

> On Tue, Nov 8, 2016 at 1:37 PM 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:
> >
> > $ ping PC12574
> > PING PC12574(PC12574 (fe80::ae22:bff:fe77:e20b%enp3s0)) 56 data bytes
> > 64 bytes from PC12574 (fe80::ae22:bff:fe77:e20b%enp3s0): icmp_seq=1
> ttl=64
> > time=0.025 ms
> > 64 bytes from PC12574 (fe80::ae22:bff:fe77:e20b%enp3s0): icmp_seq=2
> ttl=64
> > time=0.078 ms
> >
> > Is it a bug? Or such a usage is just a non-standard coincidence?
> >
> > Thanks for any help.
> >
> > Yen Chi Hsuan
> >
> > [1]
> >
> > https://git.archlinux.org/svntogit/packages.git/commit/
> trunk?h=packages/filesystem&id=f1cd9f7fb4cdf7617a1b875e14be212733f9c67a
>
>
> This is an effect of putting "myhostname" at the end of the list. If you
> don't want your network to be able to override lookup for your hostname
> move "myhostname" to after "files".
>
>
Thanks for the solution! Maybe it should be the default? I see
https://bugs.archlinux.org/task/51709 changed nsswitch.conf to the current
settings.


> It seems this only happens when you're part of a domain. AFAICT resolve/dns
> won't ask upstream for unqualified names.
>

How to check whether I'm in a domain or not? Here's my /etc/resolv.conf:

$ cat /etc/resolv.conf
# Generated by resolvconf
nameserver 8.8.8.8

And another seemingly related command:

$ hostname --domain
(none)

Best,

Yen Chi Hsuan


More information about the arch-general mailing list