FS#51709 - [filesystem] use the systemd-suggested nsswitch.conf

Attached to Project: Arch Linux
Opened by Dave Reisner (falconindy) - Saturday, 05 November 2016, 15:48 GMT
Last edited by Sébastien Luttringer (seblu) - Sunday, 26 March 2017, 22:24 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Sébastien Luttringer (seblu)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

systemd's nss-* manpages suggest an /etc/nsswitch.conf which takes advantage of the various modules distributed by systemd. We should distribute this as the default, as our current file is a bit tired. As a notable difference beyond just the system modules, the 'compat' module is a bit more flexible than simply 'files' which we use in a few places -- differences are documented in nsswitch.conf(5).
This task depends upon

Closed by  Sébastien Luttringer (seblu)
Sunday, 26 March 2017, 22:24 GMT
Reason for closing:  Implemented
Comment by Sébastien Luttringer (seblu) - Saturday, 05 November 2016, 18:42 GMT
2016.11-1 is in testing.
Comment by Serhat Cevikel (serhatcevikel) - Monday, 12 December 2016, 22:25 GMT
After the latest change to the /etc/nsswitch.conf as suggested by the manpage of systemd(https://www.freedesktop.org/software/systemd/man/nss-myhostname.html), hostname -i returns "hostname: gethostbyname: Unknown host"
Restoring the "hosts: files mymachines resolve [!UNAVAIL=return] dns myhostn" line back to previous "hosts: files dns myhostname" solves the problem though this is not the version suggested by systemd.
Comment by Alex Tucker (ajtucker) - Tuesday, 13 December 2016, 16:36 GMT
I just got stung by this too. An upgrade left the machine unable to resolve addresses without my local domain name. I.e. ping somemachine doesn't work while ping somemachine.some.domain works. I've reverted the hosts line back to the same as in the previous comment, "hosts: files dns myhostname". I tried adding my domain to /etc/systemd/resolved.conf, but this didn't help.

Looking into this a little way I'm still confused. Specifically, the [!UNAVAIL=return] action should mean that if the resolve plugin has a status other than UNAVAIL, then it should return its result directly. The default action for when the status is UNAVAIL is to continue to the next plugin. That means that the resolve plugin must have status either success, notfound or tryagain. I guess for whatever reason it's notfound and this result gets returned directly, short circuiting any further plugins.
Comment by Serhat Cevikel (serhatcevikel) - Tuesday, 13 December 2016, 16:51 GMT
I filed a bug for this issue as task 52133 (https://bugs.archlinux.org/task/52133)
Comment by Serhat Cevikel (serhatcevikel) - Tuesday, 13 December 2016, 17:10 GMT
systemd package maintainer Dave Reisner pointed out that the problem only occurs when the system-resolved daemon does not work. I checked and it is correct. In order for the new /etc/nsswitch.conf to work "systemctl enable systemd-resolved" is needed. According to the "top" output this adds a resident size of around 4m. Alternatively, one can go on with the previous line without systemd-resolved.
Comment by Alex Tucker (ajtucker) - Wednesday, 14 December 2016, 14:41 GMT
Hmm, enabling/starting the systemd-resolved service didn't fix it for me. I had already ensured that it was running and had also tried adding my domain to /etc/systemd/resolved.conf and restarting it.

I'm trying to find ways to debug this. I've got a couple of Raspberry Pis and a BananaPi running Arch using systemd-networkd and systemd-resolved to configure a normal (192.168.. local network) home wired network. This change to nsswitch.conf appears to break name resolution for me. The only configuration I have is a file in /etc/systemd/network/ to set up the ethernet adaptor using DHCP.

I'll try some more testing to see if I can pin this down.

One thing to note is that I'm running dnsmasq on my network to do both DHCP and DNS for the connected machines.
Comment by Sergej Pupykin (sergej) - Wednesday, 14 December 2016, 17:48 GMT
I just add  FS#52143  closed as duplicate here as notice that systemd-suggested nsswitch.conf also breaks user lookups in postfix.
Comment by Sébastien Luttringer (seblu) - Friday, 13 January 2017, 00:02 GMT
As of today:

1) My laptop has systemd-resolved disabled and resolve dns. Not to mention that «hostname -i» works.
2) Postfix on my servers (which have systemd-resolved enabled) are still delivering mails to user, so I imagine lookups are working.

Is there still a need to keep that open?
Comment by Dave Reisner (falconindy) - Friday, 13 January 2017, 00:22 GMT
`hostname -i` fails for me, but this is due to https://github.com/systemd/systemd/issues/3826 i believe.
Comment by Gaetan Bisson (vesath) - Thursday, 19 January 2017, 08:31 GMT
The [!UNAVAIL=return] bit breaks gnupg's libdns code; see  FS#52354 . And I really cannot understand what sense it makes to *not* try DNS queries if libnss_resolve.so fails. Is there a very good reason for this?

Edit: It felt good to complain, but it appears the bug might actually be with gnupg. Ignore the above. :)

Loading...