netbirdio/netbird · error

create service: %w

Error message

create service: %w

What it means

service.New() refused to construct the service handle during reconfigure. kardianos detects the platform service manager at construction and errors when none is supported, so the daemon cannot be managed on this system.

Source

Thrown at client/cmd/service_installer.go:233

			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 {
				cmd.Printf("Warning: failed to stop service: %v\n", err)
			}
		}

		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)
		}

View on GitHub (pinned to 93e97f4bf1)

Solutions

  1. Run reconfigure on the host with its real init system
  2. If containerized, ensure systemd runs as PID 1 (privileged container with /sbin/init)
  3. Confirm the platform is supported by kardianos/service
  4. Fall back to explicit sudo netbird service uninstall && sudo netbird service install on the host
Defensive patterns

Strategy: validation

Validate before calling

if runtime.GOOS == "linux" {
	if _, err := os.Stat("/run/systemd/system"); err != nil {
		return errors.New("systemd not detected; cannot manage the service here")
	}
}

Try / catch

s, err := newSVC(newProgram(ctx, cancel), svcConfig)
if err != nil {
	return fmt.Errorf("create service: %w", err)
}
// Unsupported-manager errors are environmental: fix the environment (run on the host, systemd as PID 1), do not retry.

Prevention

When it happens

Trigger: Reconfigure in a minimal container, chroot, or init-less environment where no systemd/launchd/Windows SCM/openrc backend is detectable.

Common situations: Trying to manage the service from inside docker; CI scripts invoking reconfigure in scratch containers.

Related errors


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