pop-os / pop

A project for managing all Pop!_OS sources
https://system76.com/pop
2.43k stars 84 forks source link

mDNS .local domain resolution broken #3335

Open TheCodeSharman opened 1 month ago

TheCodeSharman commented 1 month ago

Distribution (run cat /etc/os-release):

$ cat /etc/os-release
NAME="Pop!_OS"
VERSION="22.04 LTS"
ID=pop
ID_LIKE="ubuntu debian"
PRETTY_NAME="Pop!_OS 22.04 LTS"
VERSION_ID="22.04"
HOME_URL="https://pop.system76.com"
SUPPORT_URL="https://support.system76.com"
BUG_REPORT_URL="https://github.com/pop-os/pop/issues"
PRIVACY_POLICY_URL="https://system76.com/privacy"
VERSION_CODENAME=jammy
UBUNTU_CODENAME=jammy
LOGO=distributor-logo-pop-os

Related Application and/or Package Version (run apt policy $PACKAGE NAME):

$ apt policy libnss-mdns
libnss-mdns:
  Installed: 0.15.1-1ubuntu1
  Candidate: 0.15.1-1ubuntu1
  Version table:
 *** 0.15.1-1ubuntu1 500
        500 http://apt.pop-os.org/ubuntu jammy/main amd64 Packages
        100 /var/lib/dpkg/status

Issue/Bug Description: On my Pop OS 22.04LTS machines something seems to have regressed in terms of mDNS resolution.

I have a printer that responds to the mDNS hostname "printer.local", this used to let me add the printer as automatically discovered in the system Printers panel.

But currently nothing with a ".local" domain resolves correctly.

For example:

$ ping printer.local
ping: printer.local: Name or service not known

But:

$ avahi-resolve -n printer.local
printer.local   192.168.88.114

Steps to reproduce (if you know):

  1. Ping any mDNS device on the local network via its ".local" domain.
  2. Receive "Name or service not known" error.

Expected behavior: ping printer.local should resolve to the same IP address as avahi-resolve does.

Other Notes: I noted that mdns4 was missing from the nsswitch configuration (mdsn4_minimal exists but the docs say to add mdns4 too) so I tried adding it but this doesn't fix it:

#
# 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:         files systemd
group:          files systemd
shadow:         files
gshadow:        files

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 mymachines myhostname
networks:       files

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

netgroup:       nis
jacobgkau commented 1 month ago

Do you know how long ago this stopped working?

Does moving your new mdns4 entry to before the [NOTFOUND=return] do anything?

Can you provide the output of apt policy resolvconf systemd-resolvconf?

Multicast DNS seems to be disabled in systemd-resolved by default in /etc/systemd/resolved.conf. Not 100% sure where in the stack this issue would be yet (i.e. if this is something systemd-resolved's trying to handle, or if it shouldn't be getting there).

TheCodeSharman commented 1 month ago

Do you know how long ago this stopped working?

Oh this is with a fresh install - I bought a new machine a while back and installed it hen but I hadn't needed the printer for a while, so possibly it hasn't been working on this machine ever? When I say regressed, I mean it used to work on my old laptop with an older Pop OS version installed (probably quite old I don't have the machine easily accessible to check which version).

Does moving your new mdns4 entry to before the [NOTFOUND=return] do anything?

I've just tried moving the mdns4 entry to before [NOTFOUND=return] but this didn't help.

Can you provide the output of apt policy resolvconf systemd-resolvconf?

$ apt policy resolvconf systemd-resolvconf
resolvconf:
  Installed: (none)
  Candidate: 1.84ubuntu1
  Version table:
     1.84ubuntu1 500
        500 http://apt.pop-os.org/ubuntu jammy/universe amd64 Packages
        500 http://apt.pop-os.org/ubuntu jammy/universe i386 Packages
systemd-resolvconf:
  Installed: 249.11-0ubuntu3.11pop0~1704473387~22.04~3ce38bf
  Candidate: 249.11-0ubuntu3.11pop0~1704473387~22.04~3ce38bf
  Version table:
 *** 249.11-0ubuntu3.11pop0~1704473387~22.04~3ce38bf 1001
       1001 http://apt.pop-os.org/release jammy/main amd64 Packages
        100 /var/lib/dpkg/status

Multicast DNS seems to be disabled in systemd-resolved by default in /etc/systemd/resolved.conf. Not 100% sure where in the stack this issue would be yet (i.e. if this is something systemd-resolved's trying to handle, or if it shouldn't be getting there).

Ah, interesting, I'm not familiar with systemd-resolved. I assumed the stack would be libnss-mdns talking to avahi-daemon? Looks like systemd-resolved can do mDNS too? (Or are they both involved somehow?)