Error when setting up TrueNAS as UPS slave

Hi.

I’ve got a separate system as master for my ups and would like to set up truenas scale as a slave. After doing the setup (details below) I’m getting the following error in /var/log/daemon.log:

Sep 21 08:31:14 truenas systemd[1]: nut-driver@ups.service: Scheduled restart job, restart counter is at 8268.
Sep 21 08:31:14 truenas systemd[1]: Stopped nut-driver@ups.service - Network UPS Tools - device driver for ups.
Sep 21 08:31:14 truenas systemd[1]: Starting nut-driver@ups.service - Network UPS Tools - device driver for ups...
Sep 21 08:31:14 truenas nut-driver@ups[265960]: FATAL: The '/etc/nut/ups.conf' file does not exist or is not readable
Sep 21 08:31:14 truenas nut-driver@ups[265959]: FATAL: Could not find a NUT device section for service unit ups
Sep 21 08:31:14 truenas systemd[1]: nut-driver@ups.service: Control process exited, code=exited, status=1/FAILURE
Sep 21 08:31:14 truenas systemd[1]: nut-driver@ups.service: Failed with result 'exit-code'.
Sep 21 08:31:14 truenas systemd[1]: Failed to start nut-driver@ups.service - Network UPS Tools - device driver for ups.

I tried touch ups.conf; chown root:nut ups.conf, but I then got a similar error saying that the file was empty. Opening a shell in TrueNAS and running upsc ups@10.17.17.10:3493 successfully connects to the ups.

On my master system I’ve added the following to upsd.users and restarted:

[truenas]
password = <redacted>
upsmon slave

and my truenas UPS service looks like this:

All fields below that are left as default or empty.
Shutdown mode: UPS goes on battery
Shutdown Timer: 30
Host Sync: 15
Power off UPS: Disabled
Everything else: empty

Hi,

have you ever solved this issue.

I just installed my TNS and running in the same error.
Ihc got a NUT-Server running on my pfsense.

So I want to connect as slave from TNS. CLI looks fine with the command upsc Ellipse-Pro-650@10.10.10.1:3493.

But logging says

2025-03-09 23:54:08.388	
appname=systemd
facility=daemon
procid=1
severity=error
Failed to start nut-driver@ups.service - Network UPS Tools - device driver for ups.
2025-03-09 23:54:08.388	
appname=systemd
facility=daemon
procid=1
severity=warning
nut-driver@ups.service: Failed with result 'exit-code'.



2025-03-09 23:54:08.388	
appname=systemd
facility=daemon
procid=1
severity=notice
nut-driver@ups.service: Control process exited, code=exited, status=1/FAILURE
2025-03-09 23:54:08.388	
appname=nut-driver@ups
facility=daemon
procid=2897370
severity=informational
FATAL: Could not find a NUT device section for service unit ups
2025-03-09 23:54:08.388	
appname=nut-driver@ups
facility=daemon
procid=2897378
severity=informational
FATAL: The '/etc/nut/ups.conf' file does not exist or is not readable
2025-03-09 23:54:08.388	
appname=systemd
facility=daemon
procid=1
severity=informational
Starting nut-driver@ups.service - Network UPS Tools - device driver for ups...
2025-03-09 23:54:08.388	
appname=systemd
facility=daemon
procid=1
severity=informational
Stopped nut-driver@ups.service - Network UPS Tools - device driver for ups.
2025-03-09 23:54:08.388	
appname=systemd
facility=daemon
procid=1
severity=informational
nut-driver@ups.service: Scheduled restart job, restart counter is at 50383.
2025-03-09 23:53:57.887	
appname=snmpd
facility=daemon
procid=2511
severity=informational
systemstats_linux: unexpected header length in /proc/net/snmp. 237 != 224

Did anyone find a fix for this? Our local energy provider has a fault on their network and we keep getting power cuts so I need to get this sorted out.

I believe I manually edited the files in /etc/nut. It was a while ago though so I can’t tell you for sure what I did to solve it, but it does appear to work now. I still cannot see any UPS stats in the reporting menu, I assume that would require it to be the master, but the NAS does power down during a power outage. Here are the contents of those files as they look for me right now:

/etc/nut/nut.conf

MODE=netclient

/etc/nut/upsmon.conf (replace ‘ups’, the ip address, username and password with your equivalents)

MONITOR ups@192.168.1.10:3493 1 username password SLAVE
NOTIFYCMD /usr/sbin/upssched
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG LOWBATT SYSLOG+EXEC
NOTIFYFLAG ONLINE SYSLOG+EXEC
NOTIFYFLAG COMMBAD SYSLOG+EXEC
NOTIFYFLAG COMMOK SYSLOG+EXEC
NOTIFYFLAG REPLBATT SYSLOG+EXEC
NOTIFYFLAG NOCOMM SYSLOG+EXEC
NOTIFYFLAG FSD SYSLOG+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+EXEC
SHUTDOWNCMD "/sbin/shutdown -P now"
HOSTSYNC 15

/etc/nut/upssched.conf

CMDSCRIPT   "/usr/bin/sudo /usr/local/bin/custom-upssched-cmd"
PIPEFN      /var/run/nut/private/upssched.pipe
LOCKFN      /var/run/nut/private/upssched.lock

AT NOCOMM   * EXECUTE NOTIFY-NOCOMM
AT COMMBAD  * START-TIMER NOTIFY-COMMBAD 10
AT COMMOK   * CANCEL-TIMER NOTIFY-COMMBAD COMMOK
AT FSD      * EXECUTE NOTIFY-FSD
AT LOWBATT  * EXECUTE NOTIFY-LOWBATT
AT ONBATT   * EXECUTE NOTIFY-ONBATT
AT ONLINE   * EXECUTE NOTIFY-ONLINE
AT REPLBATT * EXECUTE NOTIFY-REPLBATT
AT SHUTDOWN * EXECUTE NOTIFY-SHUTDOWN
AT ONBATT   * START-TIMER SHUTDOWN 30
AT ONLINE   * CANCEL-TIMER SHUTDOWN

I have this issue on ElectricEel-24.10.2.1.

Or at least I might?

My log output is slightly different:

Oct 04 05:53:40 hostname systemd[1]: nut-driver@ups.service: Scheduled restart job, restart counter is at 65.
Oct 04 05:53:40 hostname systemd[1]: Stopped nut-driver@ups.service - Network UPS Tools - device driver for NUT device 'ups'.
Oct 04 05:53:40 hostname systemd[1]: Starting nut-driver@ups.service - Network UPS Tools - device driver for NUT device 'ups'...
Oct 04 05:53:40 hostname nut-driver@ups[32320]: FATAL: The '/etc/nut/ups.conf' file does not exist or is not readable
Oct 04 05:53:40 hostname nut-driver@ups[32319]: FATAL: Could not find a NUT device section for service unit ups
Oct 04 05:53:40 hostname systemd[1]: nut-driver@ups.service: Control process exited, code=exited, status=1/FAILURE
Oct 04 05:53:40 hostname systemd[1]: nut-driver@ups.service: Failed with result 'exit-code'.
Oct 04 05:53:40 hostname systemd[1]: Failed to start nut-driver@ups.service - Network UPS Tools - device driver for NUT device 'ups'.
Oct 04 05:53:55 hostname systemd[1]: nut-driver@ups.service: Scheduled restart job, restart counter is at 66.
Oct 04 05:53:55 hostname systemd[1]: Stopped nut-driver@ups.service - Network UPS Tools - device driver for NUT device 'ups'.
Oct 04 05:53:55 hostname systemd[1]: Starting nut-driver@ups.service - Network UPS Tools - device driver for NUT device 'ups'...
Oct 04 05:53:55 hostname nut-driver@ups[32675]: FATAL: The '/etc/nut/ups.conf' file does not exist or is not readable
Oct 04 05:53:55 hostname nut-driver@ups[32671]: FATAL: Could not find a NUT device section for service unit ups
Oct 04 05:53:55 hostname systemd[1]: nut-driver@ups.service: Control process exited, code=exited, status=1/FAILURE
Oct 04 05:53:55 hostname systemd[1]: nut-driver@ups.service: Failed with result 'exit-code'.
Oct 04 05:53:55 hostname systemd[1]: Failed to start nut-driver@ups.service - Network UPS Tools - device driver for NUT device 'ups'.

The logic appears to be, the nut-driver.service still appears to be enabled by TrueNAS or other even when the UPS mode of in Services > UPS is set to “Slave”.

Which I say should not be needed because there is no need to poll any local drivers because the slave server has the info.

But it is enabled and restarts when TrueNAS service management instructs it to, and can’t find /etc/nut/ups.conf and so it dies.

And it might be first in chain.

I think this because I found nut-monitor.service was disabled and not operating at the time.

A solve for me is to disable nut-driver and enable nut-monitor.

 % sudo systemctl disable --now nut-driver@ups.service
Removed "/etc/systemd/system/nut-driver.target.wants/nut-driver@ups.service".
 % sudo systemctl enable nut-monitor.service
Created symlink /etc/systemd/system/nut.target.wants/nut-monitor.service → /lib/systemd/system/nut-monitor.service.

Now I see the service is enabled, there is plaintext TCP traffic on :3493 between this host and the NUT server, sending “OL CHRG” etc.

I expect this will only last indefinitely until this host is rebooted or UPS service restarted.

Then TrueNAS middleware will try to enable nut-driver.service again?