netbirdio/netbird · error

check service status: %w

Error message

check service status: %w

What it means

During reconfigure, isServiceRunning failed for a reason other than querying status. Status errors are wrapped with ErrGetServiceStatus and tolerated by the caller; this wrap therefore comes from newSVCConfig (bad --service-env parse) or newSVC (service.New cannot find a supported service manager).

Source

Thrown at client/cmd/service_installer.go:220

}

var reconfigureCmd = &cobra.Command{
	Use:   "reconfigure",
	Short: "reconfigures NetBird service with new settings",
	Long: `Reconfigures the NetBird service with new settings without manual uninstall/install.
This command will temporarily stop the service, update its configuration, and restart it if it was running.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		if err := setupServiceCommand(cmd); err != nil {
			return err
		}

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

		wasRunning, err := isServiceRunning()
		if err != nil && !errors.Is(err, ErrGetServiceStatus) {
			return fmt.Errorf("check service status: %w", err)
		}

		svcConfig, err := createServiceConfigForInstall()
		if err != nil {
			return err
		}

		ctx, cancel := context.WithCancel(cmd.Context())
		defer cancel()

		s, err := newSVC(newProgram(ctx, cancel), svcConfig)
		if err != nil {
			return fmt.Errorf("create service: %w", err)
		}

		if wasRunning {
			cmd.Println("Stopping NetBird service...")
			if err := s.Stop(); err != nil {

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Fix the --service-env format to KEY=VALUE
  2. Run reconfigure elevated on a host with a real init system
  3. Distinguish the wrapped text: 'parse service environment variables' means flags, an unsupported-system message means the manager
  4. Re-run sudo netbird service reconfigure
Defensive patterns

Strategy: validation

Validate before calling

if len(serviceEnvVars) > 0 {
	if _, err := parseServiceEnvVars(serviceEnvVars); err != nil {
		return err
	}
}
if _, err := os.Stat("/run/systemd/system"); runtime.GOOS == "linux" && err != nil {
	return errors.New("no systemd detected; reconfigure needs a supported init system")
}

Type guard

func isStatusProbeFailure(err error) bool {
	return errors.Is(err, ErrGetServiceStatus)
}

Try / catch

wasRunning, err := isServiceRunning()
if err != nil && !errors.Is(err, ErrGetServiceStatus) {
	return fmt.Errorf("check service status: %w", err)
}
// Status-probe failures are tolerated; only config/manager construction errors abort.

Prevention

When it happens

Trigger: `netbird service reconfigure --service-env BAD` (no '='); running reconfigure in an environment with no systemd/launchd/SCM/openrc so kardianos cannot select a backend.

Common situations: Reconfiguring inside a container or init-less VM; forwarding install flags to reconfigure with a typo in KEY=VALUE.

Related errors


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