Package: release.debian.org
Severity: normal
Tags: trixie
X-Debbugs-Cc: [email protected]
Control: affects -1 + src:nut
User: [email protected]
Usertags: pu

[ Reason ]
When an UPS is running a calibration, nut will set its calibration flag,
but that flag was never cleared, this seems to completely break the
state machine.

[ Impact ]
There are two different bug reports with opposite symptoms. In one the
machine was not shutdown even when the UPS was low on battery. On the
other one, the machine was randomly shutdown, causing a DOS

[ Tests ]
It's difficult to reproduce on my UPS at home, it doesn't support
calibration

[ Risks ]
The patch is trivial and already released in testing and unstable for
months.

[ Checklist ]
  [X] *all* changes are documented in the d/changelog
  [X] I reviewed all changes and I approve them
  [X] attach debdiff against the package in (old)stable
  [X] the issue is verified as fixed in unstable

[ Changes ]
The flag is being cleared when the UPS is not in calibration state.
diff -Nru nut-2.8.1/debian/changelog nut-2.8.1/debian/changelog
--- nut-2.8.1/debian/changelog  2025-06-27 23:04:07.000000000 +0200
+++ nut-2.8.1/debian/changelog  2026-09-16 15:25:21.000000000 +0200
@@ -1,3 +1,12 @@
+nut (2.8.1-5+deb13u1) trixie; urgency=medium
+
+  * d/p/upsmon-clear-CAL-flag.patch: Clear the CAL flag in upsmon once
+    the UPS has finished its calibration, otherwise a critical (OB+LB)
+    state following a self-test is never acted upon and the shutdown is
+    not triggered. (Closes: #1056190)
+
+ -- Laurent Bigonville <[email protected]>  Wed, 16 Sep 2026 15:25:21 +0200
+
 nut (2.8.1-5) unstable; urgency=medium
 
   * d/p/fixsoname.patch: Fix name of the dynamicly loaded libraties in
diff -Nru nut-2.8.1/debian/patches/series nut-2.8.1/debian/patches/series
--- nut-2.8.1/debian/patches/series     2025-06-27 23:04:07.000000000 +0200
+++ nut-2.8.1/debian/patches/series     2026-09-16 15:25:21.000000000 +0200
@@ -8,3 +8,4 @@
 0005-Set-the-DesktopFileName-in-scripts-python-app-NUT-Mo.patch
 NoDisplay-nut-monitor-py3qt5.patch
 fixsoname.patch
+upsmon-clear-CAL-flag.patch
diff -Nru nut-2.8.1/debian/patches/upsmon-clear-CAL-flag.patch 
nut-2.8.1/debian/patches/upsmon-clear-CAL-flag.patch
--- nut-2.8.1/debian/patches/upsmon-clear-CAL-flag.patch        1970-01-01 
01:00:00.000000000 +0100
+++ nut-2.8.1/debian/patches/upsmon-clear-CAL-flag.patch        2026-09-16 
15:25:21.000000000 +0200
@@ -0,0 +1,31 @@
+From: Laurent Bigonville <[email protected]>
+Date: Wed, 16 Sep 2026 15:24:15 +0200
+Subject: upsmon: clear the CAL flag when calibration is over
+
+The ST_CAL flag was raised when "CAL" showed up in the UPS status, but it
+was never cleared again once the hardware finished its calibration.
+is_ups_critical() then kept refusing to declare a critical state ("seems
+that UPS [...] is OB+LB now, but it is also calibrating - not declaring a
+critical state"), so upsmon never triggered the shutdown when the UPS went
+OB+LB after a self-test.  Restarting upsmon was the only workaround.
+
+Origin: upstream, 
https://github.com/networkupstools/nut/commit/b606d757660b85ba9123757609e6ac70a1684cbf
+Bug: https://github.com/networkupstools/nut/issues/2168
+Applied-Upstream: 2.8.2
+---
+ clients/upsmon.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/clients/upsmon.c b/clients/upsmon.c
+index bcdbba5..b518c58 100644
+--- a/clients/upsmon.c
++++ b/clients/upsmon.c
+@@ -2130,6 +2130,8 @@ static void parse_status(utype_t *ups, char *status)
+               clearflag(&ups->status, ST_LOWBATT);
+       if (!strstr(status, "FSD"))
+               clearflag(&ups->status, ST_FSD);
++      if (!strstr(status, "CAL"))
++              clearflag(&ups->status, ST_CAL);
+       if (!strstr(status, "OFF"))
+               ups_is_notoff(ups);
+       if (!strstr(status, "BYPASS"))

Reply via email to