9

I freshly installed Ubuntu 16.10 and rsync'd a backup of my previous home directory from kubuntu 16.04 to my new install. Things work well, but I have not been able to resolve local addresses despite much trial and error.

All networking seems to be working flawlessly. Internet browsing, DNS lookup of outside addresses, ssh, etc. are great. Locally, I can access machines via ssh with their addresses, but not their names. It all works fine in nautilus/samba, meaning WINS works. The single problem, it appears, is local network DNS. I have avahi-daemon installed and running, as it came with Ubuntu.

I've included some troubleshooting, using <<>> to shorten redundant or correctly working portions.

$ nmcli g
STATE      CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN    
connected  full          enabled  enabled  enabled  enabled 

$ ping tendril8 << or tendril8.local >>
ping: tendril8: Name or service not known

$ ping gateway
PING gateway (192.168.1.1) 56(84) bytes of data.
64 bytes from gateway (192.168.1.1): icmp_seq=1 ttl=64 time=4.16 ms

$ ping askubuntu.com
PING askubuntu.com (151.101.129.69) 56(84) bytes of data.
64 bytes from 151.101.129.69 (151.101.129.69): icmp_seq=1 ttl=49 time=43.0 ms

$ nslookup askubuntu.com
Server:     127.0.1.1
Address:    127.0.0.1#53
<< followed by several IP addresses >>

$ nslookup tendril8 << or tendril8.local >>
Server:     127.0.1.1
Address:    127.0.0.1#53
** server can't find tendril8: NXDOMAIN

$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1

$ ls -la /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Oct 15 19:30 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

$ cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd:         compat
group:          compat
shadow:         compat
gshadow:        files

hosts:          files resolve [!UNAVAIL=return] mdns4_minimal dns [NOTFOUND=return]
networks:       files

protocols:      db files
services:       db files
ethers:         db files
rpc:            db files

netgroup:       nis

Note: I've spent a great deal of time looking at "older" solutions, prior to Ubuntu switching to systemd.resolved in 16.10. They have not worked for me and I don't believe this to be a duplicate question to similar ones with prior Ubuntu configurations.

mightypile
  • 1,192
  • 1
    This happen also on upgraded systems... I guess that question will receive a lot of visit in the days :) – Michele d'Amico Nov 06 '16 at 17:30
  • I HATE networking issues they are the worst. And this one is biting me hard, but in a slightly different way. The answer has not fixed it for me. See my question for my details. – moodboom Dec 08 '16 at 15:18

3 Answers3

19

If I understand your question properly, you cannot resolve your local hostnames.

On that, I had the same problem with a fresh install of 16.10, and it turns out to be a known issue (https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1624071) related to libnss-resolve in systemd.

The solution in my case was to review your /etc/nsswitch.conf file and note specifically how NSS resolves your hosts:

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

This logic appears to fail hostname resolution before even getting to mDNS.

Editing the hosts line back to a pre-16.10 release fixes this apparent logic error:

hosts: files mdns4_minimal [NOTFOUND=return] dns myhostname

The included bug-report link suggests a future release of of the systemd package may eventually correct this problem.

Rich

richbl
  • 2,303
  • 1
    Fantastic answer with both link and examples! I played around with your suggestion and found that as long as I moved "mdns4_minimal" prior to "[NOTFOUND=return]" and "[!UNAVAIL=return]" it worked. I still need the .local suffix for local addresses. – mightypile Oct 18 '16 at 14:30
  • 1
    There is a more specific bug for libnss-resolve and mdns at https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1641328 – nitrogen Dec 14 '16 at 07:28
7

An alternative solution that automatically edits /etc/nsswitch.conf is removing [edit: and reinstalling] libnss-resolve:

sudo apt purge libnss-resolve
sudo apt install libnss-resolve
nitrogen
  • 226
  • +1. This is a superior solution for those of us who like to keep the system configuration intact for those packages we haven't mucked around with. Should be done by the upgrade/installer tool by now though ...16.10 has been around for a while. – eskhool Mar 10 '17 at 11:45
1

I had this problem with a fresh install of Ubuntu 17.04. I chose to switch from using systemd-resolved to dnsmasq on my laptop (the name server is also using dnsmasq). I followed the steps in How to disable systemd-resolved and resolve DNS with dnsmasq?