<div dir="ltr"><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Apr 11, 2025 at 4:14 PM Jeremy Su <<a href="mailto:os369510@gmail.com">os369510@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div style="font-family:comic sans ms,sans-serif">Hi,</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">I meet a problem that systemd-resolved is not able to resolve the DNS.</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">systemd-resolved[1237]: sd-bus: starting bus bus-api-resolve by connecting to /run/dbus/system_bus_socket...<br>systemd-resolved[1237]: Added inotify watch for /run on bus bus-api-resolve: 2<br>systemd-resolved[1237]: Added inotify watch for /run/dbus on bus bus-api-resolve: 3<br>systemd-resolved[1237]: Added inotify watch for /run/dbus/system_bus_socket on bus bus-api-resolve: -1<br>systemd-resolved[1237]: sd-bus: starting bus bus-api-resolve by connecting to /run/dbus/system_bus_socket...<br><br></div><div style="font-family:comic sans ms,sans-serif">It seems to me that the systemd-resolved doesn't able to access /run/dbus/system_bus_socket. FWIU, the /run/dbus/system_bus_socket is created by dbus.socket.</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">However, the dependencies seem like:</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">systemd-resolved -> sysinit.target -> dbus.socket.</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">according to:</div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">$ systemctl show dbus.socket | grep -i after<br>After=-.mount sysinit.target system.slice<br></div><div style="font-family:comic sans ms,sans-serif"><br></div><div style="font-family:comic sans ms,sans-serif">$ systemctl show systemd-resolved | grep -i before<br>Before=initrd-switch-root.target shutdown.target nss-lookup.target network.target sysinit.target</div></div><div><br></div><div><div style="font-family:comic sans ms,sans-serif">If I set "Wants=dbus.socket" "Before=dbus.socket" in systemd-resolved, then it'll introduce circular dependency.</div></div></div></blockquote><div><br></div><div>It's a known issue with D-Bus being the way it is, and that's the whole purpose of the inotify watch: sd-bus is *watching for the socket to appear* so that resolved could start before the system bus does, and then connect to the bus as soon as the socket is created.</div><div><br></div><div>Systemd-resolved still offers services either through DNS at 127.0.0.53, or through a direct Unix socket – in current versions, libnss_resolve communicates with resolved through a direct socket instead of using the system bus, so the dependency on dbus.socket isn't as important.</div></div><div class="gmail_quote gmail_quote_container"><br></div></div>