diff --git a/bin/dot b/bin/dot index a483820..f7acadc 100755 --- a/bin/dot +++ b/bin/dot @@ -139,8 +139,9 @@ netbird_service() { has_systemd || { warn "no systemd; skipping netbird service"; return; } sed "s|@NETBIRD@|$bin|" "$DOTFILES_DIR/config/netbird/netbird.service" | SUDO tee /etc/systemd/system/netbird.service >/dev/null SUDO systemctl daemon-reload - SUDO systemctl enable --now netbird.service - ok "netbird daemon running ($bin)" + SUDO systemctl enable netbird.service + SUDO systemctl restart netbird.service # picks up a changed unit or a new binary after `dot switch` + ok "netbird daemon running ($bin); first time: netbird up --management-url https://netbird.godemperordoge.org" } defguard_service() { diff --git a/config/netbird/netbird.service b/config/netbird/netbird.service index 95b75f6..665742a 100644 --- a/config/netbird/netbird.service +++ b/config/netbird/netbird.service @@ -6,6 +6,10 @@ After=network-online.target Wants=network-online.target [Service] +# The daemon neither creates its socket dir (/run/netbird) nor its state dir (/var/lib/netbird): without these +# it dies with "listen unix /var/run/netbird/sock: bind: no such file or directory" and restart-loops forever. +RuntimeDirectory=netbird +StateDirectory=netbird ExecStart=@NETBIRD@ service run --config /var/lib/netbird/config.json --log-file console Restart=on-failure RestartSec=5