1

I recently installed my EPSON L3150 printer's drivers and about the same time I started having weird (and random) DNS name resolution errors in some applications (ssh, nextcloud-client), that I can only fix by restarting the NetworkManager service:

systemctl restart NetworkManager

For example:

$ ssh example.mydomain
ssh: Could not resolve hostname example.mydomain: Name or service not known

Another example is getent, which returns nothing and exits with code 2:

$ getent hosts example.mydomain

$ echo $?
2

But nslookup works fine:

$ nslookup example.mydomain
...
Name:   example.mydomain
Address: 192.168.0.10

I narrowed it down to my nsswitch.conf file, which I blame my printer installer for changing it. I found a nsswitch.conf.bak lying besides a nsswitch.conf, created at the same time that I installed the printer drivers using dnf install epson/*.rpm.

The file had this change in the hosts line:

-hosts:      files dns myhostname
+hosts:      files myhostname mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns

So the question is, why does the "new" configuration fail so randomly? How can I prevent it? I don't think just restoring the original file would be a solution since the new file seems to be auto-generated, it says so right at the top:

Generated by authselect on Sat Feb 12 18:53:06 2022

Uninstalling the driver would also not be a solution.

EDIT:

The culprit seems to be systemd-resolved. My network config is managed by NetworkManager and I setup two DNSs:

$ nmcli con show my-lan
...
ipv4.dns 192.168.0.1 8.8.8.8

It seems that whenever my computer wakes up from sleep, NetworkManager falls back to the second DNS:

$ systemd-resolve --status
...
Link 2 (enp39s0)
    Current Scopes: DNS LLMNR/IPv4 LLMNR/IPv6
         Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 8.8.8.8
       DNS Servers: 192.168.0.1 8.8.8.8
        DNS Domain: mydomain

Thus causing systemd-resolve example.mydomain to fail (because 8.8.8.8 can't resolve my domain):

query: resolve call failed: 'example.mydomain' not found

I guess it's a bug in NetworkManager?

arielnmz
  • 519
  • 1
  • 6
  • 23

1 Answers1

0

mdns4_minimal [NOTFOUND=return] is needed for multicast DNS for the Epson printer.

resolve [!UNAVAIL=return] enables name resolution through systemd-resolved (see https://www.freedesktop.org/software/systemd/man/nss-resolve.html).

If the command systemctl status systemd-resolved gives back Unit systemd-resolved.service could not be found. you may safely remove resolve [!UNAVAIL=return] from the hosts line. After that, resolving should be back to normal.

Edward
  • 2,364
  • 3
  • 16
  • 26
  • `systemd-resolved` seems to be active and running, so maybe the issue is resolved itself? I will try to debug it – arielnmz Feb 15 '22 at 18:11
  • Okay after digging for while the culprit seems to be `systemd-resolved`. The explanation is a bit long so I will put in in an update to the OP – arielnmz Feb 17 '22 at 20:34