Fix `.local` names and service discovery failing, and why opening 5353/udp is not the fix
The proposal is right that disable-publishing=yes is the narrower control, and it does not break the host record's purpose, but its text omits what the setting costs, so this is a rewrite rather than an accept. Confirmed from /usr/share/man/man5/avahi-daemon.conf.5.gz on this workstation and from the upstream man/avahi-daemon.conf.5.xml.in: the exact text is "If set to "yes", no record will be published by Avahi, not even address records for the local host. Avahi will be started in a querying-only mode. Use this is a security measure. This option defaults to "no"", typo included, so the setting is presented as a security measure. Confirmed on this workstation, omarchy 4.0.2-1: avahi 1:0.9rc5-1 with pacman -Qkk reporting 0 altered files, /etc/avahi/avahi-daemon.conf owned by avahi with #disable-publishing=no under [publish], avahi-daemon.service enabled and active, /etc/avahi/services/ empty, and the resolved drop-in owned by omarchy-settings, so the stack framing needs no change. Resolution surviving is read from code, not exercised: avahi-core/entry.c refuses every record registration with AVAHI_ERR_NOT_PERMITTED when disable_publishing is set and nothing in the lookup path checks the flag, which matches the man page's querying-only mode, so getent hosts through nss-mdns and avahi-browse keep working. Printer discovery surviving follows from the Arch CUPS wiki: discovery of DNS-SD printers is browsing done by cups.service with avahi-daemon.service running, and browsing is querying. What the proposal did not say and the replacement does: the same refusal stops this machine advertising anything, so other hosts lose <hostname>.local for it and a printer shared from its CUPS is no longer announced, and the setting is global rather than per-network, so the record's 'on untrusted networks' framing does not carry over. The corrected_danger is the existing field reproduced byte for byte with one paragraph appended. Not exercised: the setting was not applied and no daemon was restarted on this workstation.
Do not hand-edit /etc/nsswitch.conf on Omarchy 4 and expect the edit to last. The file belongs to the Arch filesystem package, so Omarchy cannot ship it through pacman without a conflict, and omarchy-settings instead runs cp -f /usr/share/omarchy/etc-overrides/nsswitch.conf /etc/nsswitch.conf from both its post_install and its post_upgrade scriptlet. Upstream's own comment on those lines states that users who customize the file will have their changes reset to Omarchy defaults on every upgrade. There is no .pacnew, no backup and nothing for pacdiff to offer, so the edit disappears silently at the next omarchy update that bumps omarchy-settings. You almost never need to touch it, because the shipped line already carries mdns_minimal.
Getting the hosts: line wrong breaks all name resolution system-wide, pacman included. Copy the file aside first with sudo cp /etc/nsswitch.conf /etc/nsswitch.conf.bak and test with getent hosts archlinux.org before you log out or reboot.
Disabling avahi-daemon.service on Omarchy 4 is not a neutral cleanup. CUPS supports DNS-SD only through Avahi and never through systemd-resolved, so it removes network printer discovery on a distro that enables cups.service by default, and it strands the mdns_minimal entry that Omarchy's own hosts: line depends on. The mirror-image error is running Avahi and systemd-resolved as mDNS responders at the same time, which causes the hostname-conflict renaming loop. Run exactly one responder.
Using the full mdns module instead of mdns_minimal makes reverse lookups in mtr and traceroute time out rather than falling back to other DNS services.
The firewall edit worth warning about is the opposite one. Commenting out -A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN as a hardening step silently removes .local resolution, service discovery and network printing, and the breakage surfaces nowhere near the file that caused it. Copy the file aside before touching it, and remember it is a pacman backup file that can arrive as a .pacnew on a ufw upgrade. In the other direction, opening 5353 hides less than it appears to: Avahi already answers multicast queries from the whole local link with no user rule at all, so your hostname and advertised services are visible on café and hotel Wi-Fi whether or not you add anything. If that matters, stop avahi-daemon.service on untrusted networks rather than trusting a closed port to hide you.
A narrower control than stopping the daemon exists. Set disable-publishing=yes under [publish] in /etc/avahi/avahi-daemon.conf, where the stock file from the avahi package already carries the line commented out, then run sudo systemctl restart avahi-daemon.service. avahi-daemon.conf(5) says of it: "If set to "yes", no record will be published by Avahi, not even address records for the local host. Avahi will be started in a querying-only mode. Use this is a security measure." Querying is the half this record depends on, so getent hosts nas.local, avahi-browse and CUPS finding a network printer keep working. What stops is everything this machine advertises: other machines can no longer reach it as <hostname>.local, and a printer shared from this machine's CUPS is no longer announced, because Avahi refuses every record registration in that mode. It is a global setting rather than a per-network one, so the host is undiscoverable at home as well as on hotel Wi-Fi until you set it back to no and restart the daemon.
Symptom
ping nas.local or ping raspberrypi.local fails with Name or service not known, getent hosts nas.local returns nothing, and a network printer or Home Assistant box that other devices reach by .local name is unreachable. The device answers fine by IP address. A related symptom in the same area is the machine's own hostname gaining a number (myhost-2.local, then myhost-3.local), which means two mDNS responders are fighting over it. One thing that looks like this symptom but is not: on Omarchy 4, resolvectl query nas.local returning No appropriate name servers or networks for name found is the expected reply even when .local resolution is working perfectly, because Omarchy disables systemd-resolved's mDNS and lets Avahi own it.
Cause
Two different mDNS stacks can serve .local names, and which one is in play decides everything. The record this replaces assumed systemd-resolved, which is wrong for Omarchy.
**Omarchy 4 gives mDNS to Avahi and preconfigures all of it.** avahi and nss-mdns ship in /usr/share/omarchy/install/omarchy-base.packages, /usr/share/omarchy/install/config/enable-services.sh runs systemctl enable avahi-daemon.service, and Omarchy replaces /etc/nsswitch.conf with its own copy whose hosts: line already carries mdns_minimal [NOTFOUND=return] ahead of resolve. Omarchy also ships /etc/systemd/resolved.conf.d/10-disable-multicast.conf setting MulticastDNS=no and LLMNR=no, so systemd-resolved is deliberately neither an mDNS resolver nor a responder. The visible consequence is that on a healthy Omarchy 4 box getent hosts nas.local succeeds while resolvectl query nas.local fails, and that is correct rather than broken. When .local genuinely fails on Omarchy the cause is normally avahi-daemon being down or its socket stuck, a firewall gap on unicast port 5353, or systemd-resolved answering the SOA query for the local domain, which makes nss-mdns stand down.
**On plain Arch and the other derivatives nothing is preconfigured, and two separate switches are off.** systemd-resolved's global MulticastDNS= does default to yes, but mDNS activates for a connection only when the network manager enables it per connection as well, and NetworkManager's connection.mdns default of -1 leaves it off. Independently of that, glibc will not consult Avahi at all until nss-mdns is installed and named in the hosts: line.
The hostname-gaining-a-number symptom is the opposite fault, two responders on one interface, with Avahi and systemd-resolved both answering mDNS and fighting over the name. That is reachable on plain Arch and not on a stock Omarchy 4 install, where resolved's responder is already off. Avahi additionally has a long-standing hostname race of its own that can produce the same renaming even with a single responder.
**The firewall is almost never the cause, and opening 5353/udp changes nothing on a stock install.** ufw's own /etc/ufw/before.rules accepts inbound multicast mDNS before any user rule is consulted, on Arch and on Omarchy alike:
# if MULTICAST, RETURN
-A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN
...
# allow MULTICAST mDNS for service discovery (be sure the MULTICAST line above
# is uncommented)
-A ufw-before-input -p udp -d 224.0.0.251 --dport 5353 -j ACCEPT
/etc/ufw/before6.rules carries the ff02::fb equivalent. Both lines have shipped since ufw 0.30.1 in March 2011, so no version anyone is running drops multicast mDNS. Avahi never sets the unicast-response bit in the questions it asks, so every answer it wants arrives at the multicast group and that rule accepts it. Measured on a stock Omarchy 4 machine whose only open ports are LocalSend's 53317 and two Docker DNS rules: avahi-browse lists the LAN, lpstat -e finds the network printer and getent hosts nas.local resolves.
Two firewall shapes do break it, and both are narrower than the usual advice:
- **The
ufw-not-localMULTICAST RETURN line commented out.**ufw-before-inputjumps toufw-not-localbefore it reaches the mDNS accept, so a multicast packet dropped there never gets the chance to match. ufw's own comment above the accept warns about exactly this. - **Unicast mDNS replies.** The accept matches destination 224.0.0.251 only, and a unicast reply does not match the conntrack entry created by a query sent to the multicast group, so it falls through to the default deny. Avahi does not ask for unicast replies, but a one-shot resolver in a script or an application library does, and a legacy unicast reply arrives at an ephemeral port that no
--dport 5353rule can cover.
Fix
First find out which mDNS stack is actually in play. All of these are read-only:
grep '^hosts:' /etc/nsswitch.conf
systemctl is-active avahi-daemon.service
resolvectl mdns
systemd-analyze cat-config systemd/resolved.conf | grep -iE 'MulticastDNS|LLMNR'
**On Omarchy 4, Avahi already owns mDNS and it is already wired up.** A stock install carries avahi and nss-mdns from /usr/share/omarchy/install/omarchy-base.packages, has avahi-daemon.service enabled by /usr/share/omarchy/install/config/enable-services.sh, ships a hosts: line that already reads:
hosts: mymachines mdns_minimal [NOTFOUND=return] resolve files myhostname dns
and ships /etc/systemd/resolved.conf.d/10-disable-multicast.conf:
[Resolve]
LLMNR=no
MulticastDNS=no
So there is nothing to install and nothing to edit. Test with getent hosts, never with resolvectl:
getent hosts nas.local
avahi-browse --all --ignore-local --resolve --terminate
If getent hosts returns an address you are done. resolvectl query nas.local failing with No appropriate name servers or networks for name found is the expected reply on Omarchy 4 and is not a fault.
If getent hosts fails, work through it in this order:
systemctl status avahi-daemon.service
sudo systemctl restart avahi-daemon.service avahi-daemon.socket
getent hosts nas.local
A stuck /run/avahi-daemon/socket stops NSS forwarding lookups to mDNS, and restarting both units clears it. If service discovery is the part that fails rather than name lookup, work through the firewall section below before changing anything.
**Checking the SOA precondition needs a tool Omarchy does not ship.** nss-mdns stands down for .local if the DNS server in /etc/resolv.conf answers SOA for the local domain, and on Omarchy that server is systemd-resolved's stub at 127.0.0.53. The host command comes from bind, which is not installed:
sudo pacman -S --needed bind
host -t SOA local
NXDOMAIN is the answer you want. Plain pacman -S is safe here, because Omarchy's ALPM guard aborts only when both -S and -u are present.
**Switching Omarchy to systemd-resolved instead of Avahi costs you printing.** CUPS supports DNS-SD only through Avahi, so stopping avahi-daemon.service removes network printer discovery, and Omarchy enables cups.service alongside it. It also strands the shipped mdns_minimal entry in the hosts: line, which talks to Avahi over D-Bus. If you still want resolved to own mDNS, all three steps are required:
sudo tee /etc/systemd/resolved.conf.d/50-mdns.conf >/dev/null <<'EOF'
[Resolve]
MulticastDNS=yes
EOF
sudo systemctl restart systemd-resolved.service
nmcli connection modify "<connection-name>" connection.mdns yes
nmcli connection up "<connection-name>"
sudo systemctl disable --now avahi-daemon.service avahi-daemon.socket
resolvectl query nas.local
The 50- prefix matters. Omarchy's own drop-in is 10-disable-multicast.conf, systemd applies drop-ins in filename order and the last one wins, so a file sorting before that one is silently overridden. Do not edit 10-disable-multicast.conf itself. It belongs to omarchy-settings, so an edit there becomes a .pacnew to reconcile on the next upgrade.
**On plain Arch, EndeavourOS, CachyOS or Manjaro nothing is preconfigured.** Two things are separately off. systemd-resolved's MulticastDNS= defaults to yes, but mDNS activates for a connection only when the network manager enables it too, and NetworkManager's connection.mdns default of -1 leaves it off. Separately, glibc will not consult Avahi until nss-mdns is installed and named in the hosts: line. Pick one stack.
Avahi, which is what you want if you print:
sudo pacman -S --needed avahi nss-mdns
sudo systemctl enable --now avahi-daemon.service
# /etc/nsswitch.conf, mdns_minimal must come BEFORE resolve and dns
hosts: mymachines mdns_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns
sudo mkdir -p /etc/systemd/resolved.conf.d
sudo tee /etc/systemd/resolved.conf.d/50-mdns.conf >/dev/null <<'EOF'
[Resolve]
MulticastDNS=resolve
EOF
sudo systemctl restart systemd-resolved.service
MulticastDNS=resolve lets systemd-resolved cache mDNS answers without responding, so Avahi stays the only responder.
Or systemd-resolved, if you do not need service discovery:
sudo tee /etc/systemd/resolved.conf.d/50-mdns.conf >/dev/null <<'EOF'
[Resolve]
MulticastDNS=yes
EOF
sudo systemctl restart systemd-resolved.service
nmcli connection modify "<connection-name>" connection.mdns yes
nmcli connection up "<connection-name>"
sudo systemctl disable --now avahi-daemon.service avahi-daemon.socket
**If the hostname keeps gaining a number** (myhost-2.local, then myhost-3.local), two responders are claiming it. Check which are live and turn one off:
resolvectl mdns
systemctl is-active avahi-daemon.service
Set MulticastDNS=resolve or MulticastDNS=no for resolved, or disable avahi-daemon, but never leave both responding. This cannot happen on a stock Omarchy 4 install, because resolved's responder is already off. Upstream also tracks a hostname race inside Avahi that survives having only one responder, and the workaround there is to limit Avahi to a single interface in /etc/avahi/avahi-daemon.conf:
[server]
allow-interfaces=eno1
**If service discovery is what fails, check the firewall before you change it, because the rule you are about to add is almost certainly already there.** These three lines ship with ufw itself and all three must be present and uncommented:
grep -n 'dst-type MULTICAST' /etc/ufw/before.rules
grep -n '224.0.0.251' /etc/ufw/before.rules
grep -n 'ff02::fb' /etc/ufw/before6.rules
On a stock Omarchy 4 or Arch install that prints:
57:-A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN
68:-A ufw-before-input -p udp -d 224.0.0.251 --dport 5353 -j ACCEPT
136:-A ufw6-before-input -p udp -d ff02::fb --dport 5353 -j ACCEPT
If one of them is commented out, that is the fault. /etc/ufw/before.rules is a pacman backup file, so copy it aside, uncomment the line by hand and reload:
sudo cp /etc/ufw/before.rules /etc/ufw/before.rules.bak
sudoedit /etc/ufw/before.rules
sudo ufw reload
If all three are present, stop. Opening 5353/udp will not help and the fault is in the resolver stack, which is the rest of this record. The one case that does want a rule is unicast mDNS, which Avahi never asks for and some application libraries do:
sudo ufw allow 5353/udp comment 'mDNS unicast replies'
Scope it to your own network if you use café or hotel Wi-Fi:
sudo ufw allow in proto udp from 192.168.0.0/16 to any port 5353 comment 'mDNS unicast, LAN only'
A phone that never appears in KDE Connect looks like this symptom and is not: KDE Connect does not use mDNS and needs its own ports. See kde-connect-ports-blocked-by-ufw.
Verify
getent hosts nas.local returns an address. That is the test that matters, because it is the path applications use and the only one that exercises the hosts: line in /etc/nsswitch.conf. Then avahi-browse --all --ignore-local --resolve --terminate lists services from other machines, and ping nas.local works. Do not verify with resolvectl query or with host. The host command bypasses NSS entirely and so bypasses nss-mdns, and resolvectl reports only systemd-resolved, so on a correctly working Omarchy 4 box it fails with No appropriate name servers or networks for name found while getent hosts succeeds. resolvectl query <own-hostname>.local is worse than useless as a check, because resolved synthesizes an answer for the local hostname and tags it Data from: synthetic, which passes even with mDNS switched off completely. Use resolvectl query nas.local as the check only if you deliberately switched to the systemd-resolved stack. Before you conclude the firewall was the problem, confirm it ever was: grep -n '224.0.0.251' /etc/ufw/before.rules printing an uncommented ACCEPT line means multicast mDNS was already allowed and any 5353 rule you added made no difference.
Sources
- https://wiki.archlinux.org/title/Systemd-resolved
- https://wiki.archlinux.org/title/Avahi
- https://wiki.archlinux.org/title/CUPS
- https://github.com/avahi/nss-mdns/blob/master/README.md
- https://github.com/omacom/omarchy/blob/quattro/docs/file-layout.md
- https://github.com/omacom/omarchy/blob/v4.0.3/etc/nsswitch.conf
- https://github.com/omacom/omarchy/blob/v4.0.3/etc/systemd/resolved.conf.d/10-disable-multicast.conf
- https://github.com/omacom/omarchy/blob/v4.0.3/install/config/enable-services.sh
- https://wiki.archlinux.org/title/Uncomplicated_Firewall
- https://git.launchpad.net/ufw/plain/conf/before.rules
- https://git.launchpad.net/ufw/patch/?id=c7acf0166e9cb175d32c42ee957c2a0d89fc9c87
- https://www.rfc-editor.org/rfc/rfc6762.txt
- https://github.com/avahi/avahi/blob/master/avahi-core/query-sched.c
- https://github.com/avahi/avahi/blob/master/avahi-core/dns.h
- https://github.com/omacom/omarchy/blob/quattro/install/config/firewall.sh
- https://github.com/omacom/omarchy/blob/quattro/etc/nsswitch.conf