I’ve come up with a workaround for users that have a UPS affected by the old version of NUT that is used by TrueNAS which throws false alerts of a battery failure (“replace battery”). My workaround doesn’t require anything except to run a custom Docker app via YAML and to set the TrueNAS UPS service to “slave” mode to connect to the new (and updated) NUT “master” running in the container..
Best thing about this is:
doesn’t require disabling safety checks
persists across updates
easily reversible
The code along with instructions are at my repo here:
I hope someone finds this useful!
Admins: hope this doesn’t violate any rules as my implementation works completely within the confines of TrueNAS’s functionality without '“breaking” anything.
Tagging because the following expressed interest in the other thread:
Yes, correct. I noted this in my Github repo. “On server restarts, you will receive a UPS communications lost error because the Docker container hasn’t started yet. Once it starts up, the error will be cleared.”
I feel it’s a small one time annoyance compared to constant false alarms or having to overwrite system files by hand every time there is an update. I rarely restart unless needed
I also built a docker container before, but it will be shut down when it is shut down. Ups can’t receive the signal to turn off ups. Now I use docker and the system kernel to build the UPS driver and specify the directory to start running through a script.
Docker already solves part of the problem, but I’m talking about a deeper issue: when the system shuts down, the Docker containers are also terminated. At that point, because the container is already closed, it can no longer send the signal to the UPS to power it off.
@invar I am just learning setting up docker etc.. but can I just say thanks for this workaround. I have an APC SMT1500IC which is not fully supported in the current TrueNAS version of NUT.
just some questions not in your instructions, or I cannot read
I think you should mention how to get the driver name of the UPS being used in TrueNAS before making any changes. i.e. go to the ups section or add a link to the drivers section
The driver name is actually there in your screenshot. (usbhid-ups). A lot of devices are supported through that driver, even ones not from APC.
The image can be updated if you modify the YAML’s ARG nut_version variable, which is currently set to v2.8.5. It needs to match a release from the actual NUT repo.
Yes, once you put it the TrueNAS UPS service into slave mode, parts of the dialog disappear so you shouldn’t even be able to change the UPS model setting anymore.
I am removing the docker-compose.yml that I made and am replacing it with a bash script that will:
-build the latest NUT drivers
-copy the new usbhid-ups driver into a specified directory
-automatically update the ups.conf to allow loading of the alternate driver
Changes are easily and completely reversible, and only one file (usbhid-ups) needs to be retained from the build. In fact, a restart reverts all the changes and that’s why a POSTINIT command (taken care of by the script) is necessary.
This retains full functionality, including power down.
Yes, you get the alert regarding the UPS not available, right after boot, when the proper way would be to wait a little for the network to be ready, etc!
This happens too when I put my TN secondary servers to sleep. You get that annoying alert regarding UPS not available, plus another alert for NTP servers not reachable!
Can IX not handle these common scenarios BETTER?
(Start those network dependant services AFTER the network is up!?).
The issue with receiving the alerts is a bit tricky. There are a ton of timing settings that can be tweaked but may have undesirable effects. (Failure to notify for short power-outage events, etc.)
All the options are documented here:
Of interest: POLLFREQ, DEADTIME, NOCOMMWARNTIME
But those settings would have to be manually placed into /etc/nut/upsmon.conf with a POSTINIT command, and a manual restart of /lib/nut/upsmon