netbirdio/netbird · error
uninstall existing service: %w
Error message
uninstall existing service: %w
What it means
Mid-reconfigure, uninstalling the current registration failed. By this point the service may already have been stopped, and the wrapped kardianos error says why deregistration failed (privileges, missing unit, manager state).
Source
Thrown at client/cmd/service_installer.go:245
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)
}
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 {View on GitHub (pinned to 93e97f4bf1)
Solutions
- Run with sudo/elevation
- If the registration is already gone, do a fresh sudo netbird service install instead of reconfigure
- Remove leftover unit files by hand only after the manager reports not-installed
- Inspect the wrapped manager error before retrying
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(filepath.Join("/etc/systemd/system", serviceName+".service")); os.IsNotExist(err) {
// registration already gone; a plain install will succeed where reconfigure cannot
} Try / catch
if err := s.Uninstall(); err != nil {
return fmt.Errorf("uninstall existing service: %w", err)
}
// If the wrapped error says not-installed, switch to a fresh install instead of retrying reconfigure. Prevention
- Clean up registrations with netbird service uninstall, never rm
- Run reconfigure elevated end to end
When it happens
Trigger: reconfigure without elevation; service.json exists but the unit file was already removed manually (rm /etc/systemd/system/netbird.service); Windows SCM deletion pending from a previous operation.
Common situations: Manual cleanup with rm instead of netbird service uninstall between reconfigures; losing elevation mid-script.
Related errors
- install service with new config: %w
- install service: %w
- uninstall service: %w
- start service after reconfigure: %w
- check service status: %w
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/277009061bff6245.
Report an issue: GitHub.