Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: exit agent when exec fails after binary replacement during auto-update

rcourtman6f156cd211c0
diff --git a/VERSION b/VERSION
index d4bda08b51..fc3aa7739a 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5.1.8
+5.1.9
diff --git a/internal/agentupdate/update.go b/internal/agentupdate/update.go
index 20d940cb7d..0204f98dda 100644
--- a/internal/agentupdate/update.go
+++ b/internal/agentupdate/update.go
@@ -207,6 +207,14 @@ func (u *Updater) CheckAndUpdate(ctx context.Context) {
if err := u.performUpdateFn(ctx); err != nil {
u.logger.Error().Err(err).Msg("Failed to self-update agent")
+ // If the binary was replaced but exec failed, the old process is still
+ // running with a stale binary. Exit so systemd restarts us with the
+ // new binary. The "failed to restart" error comes from restartProcess()
+ // which is called AFTER the binary is atomically replaced on disk.
+ if strings.Contains(err.Error(), "failed to restart") {
+ u.logger.Error().Msg("Binary replaced but exec failed - exiting so service manager restarts with new binary")
+ os.Exit(1)
+ }
return
}