I had a problem: An APC UPS was running off a dead battery for an extended period of time, and managed to miscalibrate itself. As a result, even after the battery was replaced, the UPS believed that it could provide power only for 0 minutes, even whtn a battery charged at 100%.
Worse yet, this meant that whenever the server controlling the UPS was rebooted, the UPS power cycled itself, rebooting several other pieces of equipment that were connected to it. Clearly, this was an untenable situation.
To make a long story short, I fixed the problem by calibrating the UPS utilizing the appropriate APC tools. To do so, I had to install these tools, temporarily stop the NUT (Network UPS Tools) service, and manually run a calibration.
1. Installing the tools:
# dnf install apctest
# dnf install apcupsd
Simple, isn't it.
2. Stop NUT:
# systemctl stop nut-server
# systemctl stop nut-driver@APC-RS1500
3. Run apctest
:
# apctest
[...]
10) Perform battery calibration
11) Test alarm
12) View/Change self-test interval
Q) Quit
Select function number: 10
This test instructs the UPS to perform a battery calibration
operation and reports the result when the process completes.
The battery level must be at 100% and the load must be at least
10% to begin this test.
Battery level is 100% -- OK
Load level is 26% -- OK
Clearing previous self test result...CLEARED
The battery calibration should automatically end
when the battery level drops below about 25%.
This process can take minutes or hours, depending on
the size of your UPS and the load attached.
Initiating battery calibration...INITIATED
Waiting for calibration to complete...
To abort the calibration, press ENTER.
Battery level: 100%
Battery level: 99%
Battery level: 98%
[...]
Battery level: 25%.
CALIBRATION COMPLETED
Result of last self test: PASSED
[...]
Select function number: q
2025-03-08 17:27:19 End apctest.
Note that the first calibration attempt failed; I had to run a self-test first. Not sure if this is relevant or was simply a glitch.
4. Restart NUT:
# systemctl start nut-driver@APC-RS1500
# systemctl start nut-driver
# systemctl start nut-server
5. Verify that the reported battery runtime is consistent with its charge:
# /usr/bin/upsc APC-RS1500@localhost
[...]
battery.runtime: 1440
[...]
6. Restart nut-monitor
:
The nut-monitor service was disabled as it kept shutting down the server even after a momentary power outage due to the misreported runtime.
# systemctl enable nut-monitor
# systemctl start nut-monitor
Thankfully, with these steps the UPS is fully back in service and the server runs reliably. Moreover, when it is rebooted, it no longer causes the UPS itself to cycle power.