{"record":{"id":"f00a2fb1549c9c15","repo":"tailscale/tailscale","slug":"connecting-to-system-bus-w","errorCode":null,"errorMessage":"connecting to system bus: %w","messagePattern":"connecting to system bus: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"net/dns/nm.go","lineNumber":82,"sourceCode":"\t// configured before the DNS manager was invoked, but it might\n\t// take a little time for the netlink notifications to propagate\n\t// up. So, keep retrying for the duration of the reconfigTimeout.\n\tvar err error\n\tfor ctx.Err() == nil {\n\t\terr = m.trySet(ctx, config)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(10 * time.Millisecond)\n\t}\n\n\treturn err\n}\n\nfunc (m *nmManager) trySet(ctx context.Context, config OSConfig) error {\n\tconn, err := dbus.SystemBus()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"connecting to system bus: %w\", err)\n\t}\n\n\t// This is how we get at the DNS settings:\n\t//\n\t//               org.freedesktop.NetworkManager\n\t//                              |\n\t//                    [GetDeviceByIpIface]\n\t//                              |\n\t//                              v\n\t//           org.freedesktop.NetworkManager.Device <--------\\\n\t//              (describes a network interface)             |\n\t//                              |                           |\n\t//                   [GetAppliedConnection]             [Reapply]\n\t//                              |                           |\n\t//                              v                           |\n\t//          org.freedesktop.NetworkManager.Connection       |\n\t//                   (connection settings)            ------/\n\t//          contains {dns, dns-priority, dns-search}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/net/dns/nm.go#L64-L100","documentation":"nmManager.SetDNS retries trySet every 10ms until reconfigTimeout; each trySet starts with dbus.SystemBus() to reach NetworkManager. This error means the D-Bus system bus connection itself failed: no system bus daemon running, the socket path wrong, or access denied. The wrapped error from go.dbus carries the underlying cause.","triggerScenarios":"trySet calls dbus.SystemBus() and it returns an error: /run/dbus/system_bus_socket missing, dbus-daemon not running, DBUS_SYSTEM_BUS_ADDRESS pointing somewhere invalid, or the process lacks permission to connect to the socket.","commonSituations":"Minimal containers or chroots without D-Bus; dbus.service failed or masked while NetworkManager appears installed; tailscaled started before dbus at boot; DBUS_SYSTEM_BUS_ADDRESS set incorrectly in the unit Environment.","solutions":["Start and enable the bus and NM: `systemctl enable --now dbus NetworkManager`.","Check the socket: `ls -l /run/dbus/system_bus_socket` and `busctl --system` to confirm connectivity.","Inspect DBUS_SYSTEM_BUS_ADDRESS in the tailscaled environment and unset it if wrong.","If D-Bus truly cannot run on this host, select a different DNS manager (e.g. direct resolv.conf) instead of the NetworkManager one."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Probe the system bus before depending on the NetworkManager manager\nconn, err := dbus.SystemBus()\nif err != nil {\n    return nil, fmt.Errorf(\"system dbus unavailable, cannot use NetworkManager DNS: %w\", err)\n}\ndefer conn.Close()","typeGuard":null,"tryCatchPattern":"Retry SetDNS with backoff — dbus availability at boot is ordering-dependent, and SetDNS's internal loop already retries until reconfigTimeout; persistent failure means an environment problem, so surface 'start dbus' to the operator.","preventionTips":["Order unit startup: dbus.service before tailscaled (After=dbus.service).","Keep dbus and NetworkManager enabled on hosts using this manager.","Verify /run/dbus/system_bus_socket exists in the service's mount namespace (containers)."],"tags":["linux","dbus","networkmanager","dns"],"backgroundTag":"dbus-system-bus-connect-failed","analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}