September 3, 2026

NUT on Fedora -- part 2

My UPS is a Cyberpower CP1500PFCLCD. I am running Fedora 44 on an x86 desktop.

In part 1, I installed the nut package, and did my first edits to nut.conf and ups.conf in /etc/ups.

I decide to also set up the web status (on localhost), so I pull in two more packages.

su
dnf install httpd
dnf install nut-cgi
systemctl start httpd.service
That's correct. I have never before run a web server on my home machine. I do get the Fedora webserver test page, so I am off to a decent start.

Note that the location "/etc/ups" is unique to Fedora and is where all the NUT configuration files are. Standard documentation would put these files in /etc/nut This hints of other undocumented Fedora tweaking that will need to be discovered.

After that I got into trouble. Some searching led me to this:

People run NUT on a Raspberry Pi (there are several videos). This surprises me, but see the notes below.

The preview of Techno Tims video showed the familiar display from the front of my CyberPower unit (wrong! See below). And the Fedora guide thanked him, so I probably ought to watch his video.

Notes from Techno Tim

His video is good. Not too fast, not too slow, and the sound is good.

I had to remind myself that "t" puts youtube into "theater mode", so I get less distracted and annoyed by all of the videos I might possibly be interested in, displayed on the right. He works with an APC UPS -- and the display does look a lot like my CyberPower (I was fooled).

First, I note that he and other talk about their "home lab", which is a label I find interesting. He has several (three) UPS units, and a strategy that keeps his network gear powered up longer than his servers. He in fact does run NUT on a raspberry pi. He doesn't want NUT to be running on one of his servers that will be getting shut down. His raspberry pi is powered via POE.

Fedora does not have a separate nut-server package -- but nut-client is separate, but gets pulled in when you install "nut".

The Fedora guide says that there are 8 files you need to edit. Here are my notes on each of them as I follow along in the video. The video only discusses 5 of the 8. Notes on the others are from the Fedora guide.
On Fedora these files are all in /etc/ups.

1 - ups.conf

He adds these 2 lines to ups.conf

pollinterval = 1
maxretry = 3
Maxretry was already set to 3 and pollinterval defaults to 2, so we are changing that. He includes the vendor and product ID -- which may be essential if you have several devices. I go ahead and add these to mine even though I have only one UPS device. The scanner also gave me a serial number, so I add this as well.

2 - upsmon.conf

Next upsmon.conf -- he sets up a MONITOR line.
MONITOR cyberpower@localhost 1 homer axehelve master
Here "home" and "axehelve" are set up in upsd.users

Note: It is not clear if we want "homer" or "admin" here.

He also sets "RUN_AS_USER root" -- otherwise nut will use a special user of some sort with a variety of permission issues. I see that installing the Fedora packages created a "nut" user. (In addition, installing httpd created an "apache" user.)

3 - upsd.users

To support the above, I add these lines (the file comes completely commented out).
[homer]
        password = axehelve
        admin master
I don't understand "admin master", I just copy techno tim here. He says there is plenty of documentation that you can go find and read about this.

4 - upsd.conf

The default (compiled in) is to listen on localhost (which is fine for standalone). He wants to support a client/server setup, so he wants to listen on any IP address and uses the second line. The comments in the file say to use LISTEN * 3493 for that case.
LISTEN 127.0.0.1 3493
#LISTEN 0.0.0.0 3493

5 - nut.conf

The thing to do here is to set MODE. I set it to "standalone" (for now). Someday I will set it to "netserver" and then set up nut on another machine (my new mac-mini) and set it there to "netclient".

6 - hosts.conf

This is from the Fedora guide and is only needed if you want to use the web/cgi thing. I find the file all commented out, I add one line:
MONITOR cyberpower@localhost "Local CyberPower UPS"

7 - upsset.conf

This is from the Fedora guide and is only needed if you want to use the web/cgi thing. The file is all commented out and has lots of instructions about securing your CGI web server. Once you have, you reassure NUT by uncommenting:
I_HAVE_SECURED_MY_CGI_DIRECTORY

8 - ups-cgi.conf

This is from the Fedora guide and is only needed if you want to use the web/cgi thing. This file is not in /etc/ups -- You need to create it from scratch as: /etc/httpd/conf.modules.d/ups-cgi.conf
ScriptAlias /nut-cgi-bin/ β€œ/var/www/nut-cgi-bin/”

AllowOverride None
Options None
Order allow,deny
Allow from all

Yes, the nut-cgi-bin directory exists.

Firewall configuration

su
firewall-cmd --add-service=nut
firewall-cmd --add-service=http
firewall-cmd --runtime-to-permanent

Getting things going (ignore this section)

Techno Tim says you can either reboot or type these. Forget all this. Fedora is wildly different. See below.
su
systemctl restart nut-server.service
#systemctl restart nut-client.service
systemctl restart nut-monitor.service
#upsdrvctl stop
#upsdrvctl start
#systemctl restart nut-driver.service
Fedora tells me there is no service for nut-client, even though I installed that package. It also scolds me for running upsdrvctl directly, claiming it will conflict with nut-driver.service, but there is no such thing. A peek at /usr/lib/systemd/system shows me all these:
nut-driver-enumerator-daemon-activator.path
nut-driver-enumerator-daemon-activator.service
nut-driver-enumerator-daemon.service
nut-driver-enumerator.path
nut-driver-enumerator.service
nut-driver@.service
nut-driver.target
nut-logger.service
nut-monitor.service
nut-server.service
nut.target
nut-udev-settle.service
Wow! Maybe rebooting would be a good idea. It seems a pity, and I will lose my place in the video, but I go ahead and reboot. I use "ps" to look for nut processes and don't see any, which is worrisome.

Getting things going -- as per the Fedora guide

It will probably be worthwhile after doing all this, to reboot my system and ensure that all of this comes up properly.

As of Fedora 42, the rumor is that you only need to do this, but on my Fedora 44 system, there ain't no such thing!

systemctl enable nut-target
The above should work (but doesn't) I type this command:
systemctl list-unit-files | grep nut.
nut-driver-enumerator-daemon-activator.path                               disabled        disabled
nut-driver-enumerator.path                                                disabled        disabled
nut-driver-enumerator-daemon-activator.service                            static          -
nut-driver-enumerator-daemon.service                                      disabled        disabled
nut-driver-enumerator.service                                             enabled         disabled
nut-driver@.service                                                       indirect        disabled
nut-logger.service                                                        disabled        disabled
nut-monitor.service                                                       enabled         disabled
nut-server.service                                                        enabled         disabled
nut-udev-settle.service                                                   static          -
nut-driver.target                                                         disabled        disabled
nut.target                                                                disabled        disabled
I don't know what is going on, so I did this:
su
systemctl enable --now nut-driver-enumerator.service
systemctl enable --now nut-server.service
systemctl enable --now nut-monitor.service
systemctl enable --now httpd.service
I wait a bit and check these with:
systemctl status nut-driver-enumerator.service
systemctl status nut-server.service
systemctl status nut-monitor.service
systemctl status httpd.service
These all look good. It looks like the enumerator service runs once then exits.

Try upsc

It works! I can type "upsc cyberpower" and get a bunch of stuff.

Among many other things it shows:

battery.charge: 100
battery.runtime: 5150
battery.status: 100%
battery.voltage: 27.2
battery.voltage.nominal: 24
ups.load: 7
ups.power: 77
ups.power.nominal: 1500
ups.realpower: 78

Poking at upsmon

This command shows you the UPS log file:
journalctl -u nut-monitor
To trigger a forced shutdown without actually pulling the power cord, you can do this:
upsmon -c fsd
The log file mentions a file /etc/killpower, but there is no such file on my system.

Upsmon will directly issue system commands to produce a shutdown. There is no separate shutdown script. Everything is configured in upsmon.conf.

Note that there is a file /usr/lib/systemd/system-shutdown/nutshutdown

Trouble with the web CGI thing

I check this address in a browser:

http://localhost/nut-cgi-bin/upsstats.cgi
It gives me a 403 permission error.

I tried a variety of things. Then I edited /etc/.../httpd.conf and added +ExecCGI to this section:


    AllowOverride None
    Options +ExecCGI
    Require all granted

In that file, I also uncommented this line:
 AddHandler cgi-script .cgi
Then I copied the files in /var/www/nut-cgi-bin to /var/www/cgi-bin
Then:
service httpd restart
And now the CGI scripts work at these URL:
http://localhost/cgi-bin/upsstats.cgi
http://localhost/cgi-bin/upsimage.cgi
http://localhost/cgi-bin/upsset.cgi
Only "upsstats" is interesting.
The "upsset" thing complains that it cannot open upsset.conf to verify security settings.
The "upsimage" thing brings up a useless display with the words "no host or display" in barely readable yellow! Pretty lame.

Each of these is an ELF file (compiled executable).


Have any comments? Questions? Drop me a line!