On this page
Where apcupsd fits
apcupsd has been around since the late 1990s and is still packaged by most Linux distributions and BSDs. It is also the engine behind Unraid's built-in UPS settings (see Unraid UPS setup). Its appeal is simplicity: one daemon, one config file, one status command, and sensible defaults for APC hardware.
Its limits are equally clear. Development has been quiet for years, it is designed around APC's protocols, and its network model is less flexible than Network UPS Tools. If you have an APC unit and one or two Linux machines, it is a fine choice. For anything bigger or mixed, read the comparison at the end first.
A working USB configuration
Install the package (named apcupsd on major distributions), then edit /etc/apcupsd/apcupsd.conf. These are the lines that matter for a typical USB-connected APC unit; leave the rest at defaults.
## /etc/apcupsd/apcupsd.conf
UPSNAME office-ups
UPSCABLE usb
UPSTYPE usb
DEVICE
POLLTIME 60
## Shutdown thresholds: whichever is reached first wins
BATTERYLEVEL 5
MINUTES 3
TIMEOUT 0
## Events
ONBATTERYDELAY 6
ANNOY 300
ANNOYDELAY 60
## Network information server (for apcaccess and remote clients)
NETSERVER on
NISIP 127.0.0.1
NISPORT 3551
What each setting does
| Directive | Example | Meaning |
|---|---|---|
UPSCABLE | usb | Cable type. usb for USB; smart or a cable part designation for serial; ether for network clients |
UPSTYPE | usb | Protocol driver: usb, apcsmart (serial Smart-UPS), net (another apcupsd), snmp, and others depending on build |
DEVICE | (blank) | Blank for USB autodetect; a serial port such as /dev/ttyS0; or host:3551 for network clients |
BATTERYLEVEL | 5 | Shut down when charge falls to this percent |
MINUTES | 3 | Shut down when the UPS's runtime estimate falls to this many minutes |
TIMEOUT | 0 | Shut down after this many seconds on battery; 0 disables the timer |
ONBATTERYDELAY | 6 | Seconds after a power failure before the onbattery event fires (filters blips) |
NETSERVER | on | Enables the network information server used by apcaccess and clients |
NISIP | 127.0.0.1 | Address to listen on; set to the LAN address (or 0.0.0.0) to serve clients |
NISPORT | 3551 | TCP port for the information server |
Defaults for NISIP differ between the upstream sample file and some distribution packages. Set it explicitly so you know what it is.
Our rule of thumb: the defaults are too late for most servers
BATTERYLEVEL 5 and MINUTES 3 are the shipped defaults, and on a fresh battery with a light load they work. But a 3 minute estimate from an aging battery under a heavy load can collapse to well under a minute, and a NAS or VM host may need several minutes to stop cleanly. For servers, a more forgiving starting point is MINUTES at about twice your measured shutdown time, plus a TIMEOUT of a few minutes if your outages are usually either short blips or long. See how much runtime you need.
Start it and read the status
sudo systemctl enable --now apcupsd
apcaccess status
On older Debian and Ubuntu packages you also had to set ISCONFIGURED=yes in /etc/default/apcupsd before the service would start. If apcaccess returns quickly with a page of fields, the daemon is talking to the UPS. The fields you will look at most:
| Field | Meaning | What to watch for |
|---|---|---|
STATUS | ONLINE, ONBATT, LOWBATT, CAL, TRIM, BOOST, COMMLOST, SHUTTING DOWN, and combinations | COMMLOST means apcupsd cannot reach the UPS |
LINEV | Input line voltage | Frequent dips near the transfer point explain repeated switching to battery |
LOADPCT | Load as a percent of capacity | Sustained high load shortens runtime sharply; see UPS load percentage |
BCHARGE | Battery charge percent | Should return to 100 within hours of an outage |
TIMELEFT | Estimated runtime in minutes at current load | Compare with MINUTES; drifts with battery age until recalibrated |
BATTV | Battery voltage | Compare with NOMBATTV; low when charged suggests a weak battery |
LOTRANS / HITRANS | Transfer voltages | Where the UPS switches to battery |
LASTXFER, NUMXFERS, TONBATT, CUMONBATT | Last transfer reason, count and time on battery | A good diagnostic for a UPS that keeps switching to battery |
SELFTEST, BATTDATE | Last self-test result, battery date | BT or failed results mean the battery needs attention |
Not every model reports every field, and USB Back-UPS units usually report fewer than Smart-UPS units.
Sharing one UPS with other machines
The host with the USB cable runs apcupsd as above with the information server reachable on the LAN:
## On the server (USB-connected host)
NETSERVER on
NISIP 192.168.1.10
NISPORT 3551
Each other machine runs apcupsd in client mode, polling the server instead of a cable:
## On each client
UPSCABLE ether
UPSTYPE net
DEVICE 192.168.1.10:3551
POLLTIME 10
BATTERYLEVEL 20
MINUTES 8
TIMEOUT 0
The client applies its own thresholds to the data it reads. Set them higher than the server's so clients finish shutting down while the server is still up. The older apcupsd docs called these clients "slaves"; the mechanism is the same.
Port 3551 has no authentication
The information server is read-only, but anyone who can reach it can see your UPS status, and a client trusts whatever it receives. Bind NISIP to a LAN address, allow 3551 only from your LAN in the host firewall, and never forward it from the internet.
Event scripts with apccontrol
When something happens, apcupsd calls /etc/apcupsd/apccontrol with the event name. The default script logs a message, notifies logged-in users and, for shutdown events, calls the system shutdown. To customize an event, create an executable script in /etc/apcupsd/ with the event's name. apccontrol runs it first; if your script exits with code 99, apccontrol skips its own default action for that event.
| Event | When it fires | Typical custom action |
|---|---|---|
onbattery | Power failed and ONBATTERYDELAY passed | Send an email or push alert |
offbattery / mainsback | Utility power returned | Send an all-clear |
doshutdown | A threshold was reached | Stop VMs or containers, then shut down |
commfailure / commok | Lost or regained contact with the UPS | Alert: a dead link means no protection |
changeme | UPS reports the battery needs replacing | Alert; see when to replace a UPS battery |
A minimal /etc/apcupsd/onbattery script:
#!/bin/sh
# $1 is the UPS name passed by apccontrol
echo "UPS $1 on battery at $(date)" | mail -s "Power failure" admin@example.com
exit 0
Exiting 0 lets the default actions still run. Many distributions already ship small onbattery and offbattery scripts that send mail to root, so check before overwriting.
apctest: diagnostics and settings
apctest is an interactive tool that talks to the UPS directly. Stop apcupsd before running it, because both cannot hold the device. Depending on the UPS model and connection type, it can run a battery calibration, test killpower, and on some models read or change EEPROM settings such as transfer voltages and alarm behavior. Menus vary with the connection: USB units typically expose fewer options than serial Smart-UPS units. Start apcupsd again when finished.
Killpower and automatic restart
After a threshold-triggered shutdown, the system's halt scripts call apcupsd's killpower routine, which tells the UPS to turn its outputs off after a delay. When utility power returns, the UPS restarts output and machines set to power on after AC loss boot. Whether this works depends on the distribution's shutdown integration and the UPS model, so verify it once with a real test at a planned time.
Working with non-APC hardware
apcupsd's USB driver uses HID Power Device reports, which many brands share. Some non-APC units therefore show basic data. Results are inconsistent, though: values may be missing or misread, and shutdown commands may not work. Treat non-APC support as partial at best, and prefer NUT for those units.
apcupsd vs NUT
| apcupsd | NUT | |
|---|---|---|
| Hardware support | APC focused; partial for other HID units | Many brands over USB, serial, SNMP and more |
| Configuration | One file | Several small files, clear role separation |
| Network port | 3551 | 3493 |
| Network authentication | None | Per-user passwords and roles |
| Coordinated multi-host shutdown | Each client uses its own thresholds | Primary declares FSD and waits for secondaries |
| Development activity | Low; mature and stable | Active, regular releases |
| Built into platforms | Unraid | Synology, TrueNAS, Home Assistant integration, many others |
| Best for | One or two Linux hosts on an APC UPS | Anything mixed, networked or long-lived |
Bottom line
If apcupsd is already working on an APC unit, there is no urgent reason to replace it. For new setups, especially homelabs with a NAS, a hypervisor and Home Assistant on one UPS, NUT is the better long-term foundation. If the computer cannot see the UPS at all, start with UPS not detected by computer.
Frequently asked questions
Does apcupsd work with CyberPower or Eaton UPS units?
Sometimes, partially. Because apcupsd's USB driver speaks the generic HID Power Device protocol, some non-APC units report basic status like on-battery and charge. Others report wrong values or are not recognized, and killpower may not work. For non-APC hardware, Network UPS Tools is the more reliable choice.
Why does apcaccess say Connection refused?
apcaccess reads from apcupsd's network information server, so it fails if apcupsd is not running or NETSERVER is off. Check systemctl status apcupsd, confirm NETSERVER on, and confirm apcaccess is pointed at the address in NISIP. On Debian-based systems, older packages also required enabling the daemon in /etc/default/apcupsd.
What does TIMELEFT mean in apcaccess output?
It is the UPS's own estimate of runtime in minutes at the current load. It depends on the battery calibration in the UPS firmware, so on an aging battery it can be optimistic. A runtime calibration, done from the UPS or vendor software, updates the estimate. Treat it as a guide, not a guarantee.
Can apcupsd and NUT run on the same machine?
Not against the same USB UPS. Both want exclusive access to the device and will interfere with each other. You can, however, run apcupsd on one host and let NUT on another host read from it, since NUT has an apcupsd client driver, though most people simply pick one tool for the whole network.
How do I stop apcupsd from shutting down on short power blips?
Short blips do not trigger shutdown; only the three limits do. If notifications on every blip are annoying, raise ONBATTERYDELAY so the on-battery event waits a few seconds before firing. Frequent blips themselves usually point to power quality issues or a sensitivity setting worth reviewing on the UPS.
Sources and further reading
- apcupsd project site and user manual
- apcupsd man pages: apcupsd(8), apcupsd.conf(5), apcaccess(8), apctest(8), apccontrol(8)
- Network UPS Tools documentation (apcupsd-ups driver)
- APC by Schneider Electric, Back-UPS and Smart-UPS user manuals