Monitoring CMOS Batteries
A depleted CMOS battery can be a tad irritating because BIOS changes might be reset to defaults. Modern computers use non volatile memory (NVM) to retain changes but not so with older computers.
A common indicator of a depleted battery is the system date and time no longer are maintained while the computer is powered off. Another indicator is the system might start self-awakening every day at the same time.
The date and time are a function of the on-board real-time clock (RTC) rather than CMOS storage. The on-board clock stops functioning when the battery depletes. Manually fixing the system date and time is not a big deal, but restoring other BIOS changes can be annoying if NVM is unavailable.
Modern computers often are designed to provide a way to save BIOS changes to external media, but many people never save the configuration. In the days of yore before such a feature existed the changes had to be restored from memory and notes.
Unlike predecessor boards from many years ago, most modern CMOS batteries are not rechargeable. A common battery type used is the CR2032 “coin” battery. While these batteries should last at least three to five years before needing replacement and many will last longer, having some warning might be helpful that the battery is about to expire.
The RTC is part of the board chip set. The Linux kernel provides a way to check the RTC configuration with
cat /proc/driver/rtc. In that output the
batt_status field will display
okay when the CMOS battery is in acceptable condition.
This is a go-no-go test and no voltage is displayed. Browsing the kernel
rtc code seems to indicate the only results returned are
dead. The code seems to check the RTC date and time rather than the battery voltage. If the RTC date (
rtc_date) and time (
rtc_time) are reasonable then the battery voltage is presumed to be okay.
This presumptive go-no-go indicator usually is a warning that is “too little too late.”
Without opening the computer case and using a voltmeter, the
sensors command in the
lm-sensors package might help. Unless explicitly identified with something like
Vbat, knowing which sensor voltage is the CMOS battery can be confusing.
Nominal voltage for a CR2032 is 3.0 VDC but when new the out-of-circuit voltage usually is higher. The actual voltage cannot be recorded out-of-circuit. Such measurements will be misleading. The voltage must be recorded in circuit with a load. With battery holders that are flush and horizontal to the main board, the top of the battery will be the positive side. This placement allows recording the voltage by touching the negative voltmeter lead to chassis ground.
A data sheet might show “knee of the curve” depletion begins when voltage lowers to about 90%, or about 2.7 to 2.8 VDC. That voltage does not mean the battery has failed or failure is imminent. Depending on the load demand some coin batteries function fine at lower voltages. The proverbial handwriting is on the wall though. The battery probably should be replaced sooner rather than later.
There might be other methods to monitor the CMOS battery, such as
ipmitool, or the system event log in rack servers.
On desktop computers the
conky tool can be used to display the CMOS battery health. Without desktops a cron job could continually monitor battery health.
A handwritten note on the computer case when the battery was replaced would provide a reminder of the current life span. A similar option might be a text file in the computer file system noting the replacement date. A shell script could query that date to provide a reminder warning.
All of these strategies might prove insufficient. Often there is no warning when the battery depletes beyond the point of no return.