netbirdio/netbird · error
uninstall service: %w
Error message
uninstall service: %w
What it means
kardianos/service Uninstall() failed while deregistering the NetBird service. The underlying manager error is preserved; typical causes are missing privileges, the service not existing, or the manager refusing while it is running.
Source
Thrown at client/cmd/service_installer.go:190
if err := setupServiceCommand(cmd); err != nil {
return err
}
cfg, err := newSVCConfig()
if err != nil {
return fmt.Errorf("create service config: %w", err)
}
ctx, cancel := context.WithCancel(cmd.Context())
defer cancel()
s, err := newSVC(newProgram(ctx, cancel), cfg)
if err != nil {
return err
}
if err := s.Uninstall(); err != nil {
return fmt.Errorf("uninstall service: %w", err)
}
if runtime.GOOS == "linux" {
if err := cleanupSystemdNetworkd(); err != nil {
log.Warnf("failed to cleanup systemd-networkd configuration: %v", err)
}
}
cmd.Println("NetBird service has been uninstalled")
return nil
},
}
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.`,View on GitHub (pinned to 93e97f4bf1)
Solutions
- Run elevated: sudo netbird service uninstall
- Stop the service first: sudo netbird service stop (or systemctl stop netbird)
- If the service is already gone, treat not-installed as success instead of retrying
- On Windows, reopen the shell or reboot if the SCM reports deletion pending
Defensive patterns
Strategy: validation
Validate before calling
if os.Geteuid() != 0 {
return errors.New("netbird service uninstall requires root/admin")
} Type guard
func isNotInstalled(err error) bool {
return err != nil && strings.Contains(strings.ToLower(err.Error()), "not installed")
} Try / catch
if err := s.Uninstall(); err != nil {
if isNotInstalled(err) {
return nil // already gone: treat as success
}
return fmt.Errorf("uninstall service: %w", err)
} Prevention
- Stop the service before uninstalling
- Treat not-installed as success in automation scripts
- Always uninstall from an elevated shell
When it happens
Trigger: `netbird service uninstall` without root/admin; uninstalling when no unit/service is registered; Windows SCM has the service marked for deletion but still referenced; a manager that requires the service stopped first.
Common situations: Running uninstall twice; uninstalling from a non-elevated shell; uninstalling immediately after stop on Windows before the SCM completes the delete.
Related errors
- install service: %w
- uninstall existing service: %w
- install service with new config: %w
- start service after reconfigure: %w
- create service config: %w
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/dd3e97461830b813.
Report an issue: GitHub.