As of Fedora 42, at least, bootstrapping nut is a little different. For starters, the service template, /usr/lib/systemd/system/nut-driver@.service is broken. It can be patched by user root with:
sed -i -e '/\$NUTDEV/s;;$&;g' /usr/lib/systemd/system/nut-driver@.service
systemctl daemon-reload
(This doubles the dollar signs ($) in the Exec scripts, which systemd then replaces with a single dollar sign rather than trying to expand a variable it doesn’t know about.)
After editing the config files in /etc/ups, verify that permissions and SELinux labels are correct:
chmod 0640 /etc/ups/*
chown root:nut /etc/ups/*
restorecon -Rv /etc/ups
Then, instead of enabling services individually, just enable nut.target and use upsdrvsvcctl from there:
systemctl enable nut.target
upsdrvsvcctl reconfigure
systemctl reboot
On my own system, in /etc/ups/nut.conf, I use MODE=standalone instead of MODE=netserver and just query the UPS on the command line as user root:
upsc my-ups
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
…
There are other improvements that can be made. For instance, in /usr/lib/systemd/system/nut-udev-settle.service, udevadm should have an absolute path:
sed -i -e '/=udevadm/s;;=/usr/sbin/udevadm;' /usr/lib/systemd/system/nut-udev-settle.service
systemctl daemon-reload
And in /usr/lib/systemd/system/nut-monitor.service, a delay should probably be added between restarts to avoid hammering the UPS. I suspect this might be a cause of the many reports about:
libusb1: Could not open any HID devices: insufficient permissions on everything
Once the system gets stuck like this, powering down both computer and UPS might be necessary. To avoid that, try:
ed /usr/lib/systemd/system/nut-monitor.service <<EOF
/^Restart=/a
RestartSec=30
.
wq
EOF
systemctl daemon-reload
Some eBay factory refurbished UPSes need higher values than the defaults for parameters MAXAGE and DEADTIME in /etc/ups/upsd.conf and /etc/ups/upsmon.conf, respectively:
ed /etc/ups/upsd.conf <<EOF
?MAXAGE?s;^;#;
a
MAXAGE 25
.
wq
EOF
ed /etc/ups/upsmon.conf <<EOF
?DEADTIME?s;^;#;
a
DEADTIME 25
.
wq
EOF
Finally, editing /usr/lib/systemd/system files directly is always a bad idea since they will eventually be overwritten. A better strategy is to use systemctl edit, which creates an override in /etc/systemd.