netbirdio/netbird · error

start service after reconfigure: %w

Error message

start service after reconfigure: %w

What it means

The reconfigured service was reinstalled but s.Start() failed, leaving it installed-but-stopped. The wrapped manager error (systemd job result, SCM code) identifies the start failure; the daemon's own logs usually hold the real reason.

Source

Thrown at client/cmd/service_installer.go:260

		cmd.Println("Removing existing service configuration...")
		if err := s.Uninstall(); err != nil {
			return fmt.Errorf("uninstall existing service: %w", err)
		}

		cmd.Println("Installing service with new configuration...")
		if err := s.Install(); err != nil {
			return fmt.Errorf("install service with new config: %w", err)
		}

		if err := saveServiceParams(currentServiceParams()); err != nil {
			cmd.PrintErrf("Warning: failed to save service params: %v\n", err)
		}

		if wasRunning {
			cmd.Println("Starting NetBird service...")
			if err := s.Start(); err != nil {
				return fmt.Errorf("start service after reconfigure: %w", err)
			}
			cmd.Println("NetBird service has been reconfigured and started")
		} else {
			cmd.Println("NetBird service has been reconfigured")
		}

		return nil
	},
}

func isServiceRunning() (bool, error) {
	cfg, err := newSVCConfig()
	if err != nil {
		return false, err
	}

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Check why it failed: journalctl -u netbird -e (or Windows event log) and systemctl status netbird
  2. Verify the ExecStart path in the unit points to an existing netbird binary
  3. Fix the flags passed to reconfigure (valid --daemon-addr, valid log level) and re-run
  4. Start manually with sudo netbird service start after correcting the cause
Defensive patterns

Strategy: retry

Validate before calling

if _, err := exec.LookPath("netbird"); err != nil {
	return errors.New("netbird binary not on PATH for the service ExecStart")
}

Try / catch

if err := s.Start(); err != nil {
	log.Warnf("start failed, inspecting: %v", err)
	if out, jerr := exec.Command("journalctl", "-u", serviceName, "-n", "50", "--no-pager").CombinedOutput(); jerr == nil {
		log.Debugf("service log tail: %s", out)
	}
	time.Sleep(2 * time.Second)
	if retryErr := s.Start(); retryErr != nil {
		return fmt.Errorf("start service after reconfigure: %w", retryErr)
	}
}

Prevention

When it happens

Trigger: The ExecStart binary path no longer exists (manually moved/upgraded binary); the service exits immediately due to a bad flag such as an invalid --daemon-addr; systemd start job timed out; Windows start access denied.

Common situations: Replacing the netbird binary out from under an installed service; reconfiguring with a flag combination the daemon rejects at startup.

Related errors


AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16). Data as JSON: /api/errors/a891bcfa6a57a023. Report an issue: GitHub.