UPS Service Access Denied

sgt_jamez

Explorer
Joined
Jul 30, 2021
Messages
88
I have been running NUT server on my Scale host for some time. My Scale host runs the nightly builds and is currently on TrueNAS-SCALE-22.12-MASTER-20220327-112906. The UPS is a Cyber Power
There are 4 clients talking to the Scale NUT server and it has been working well. Today I noticed a NUT client machine was giving error messages that my UPS was unavailable.
I ran the check command from the client:
Code:
$ sudo upsc ups@192.168.2.230
Error: Connection failure: Connection refused


On my Scale host, I check the Services page, and the service is started, set start automatically, and configured as before. I can post the contents of the .conf files or a screenshot
of the UPS configuration page if needed.
Checking the status of the service from the CLI:
Code:
$ sudo service nut-server status
sh: 0: getcwd() failed: No such file or directory
● nut-server.service - Network UPS Tools - power devices information server
     Loaded: loaded (/lib/systemd/system/nut-server.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Sun 2022-03-27 14:48:51 PDT; 4min 56s ago
    Process: 1098645 ExecStart=/sbin/upsd (code=exited, status=1/FAILURE)

Mar 27 14:48:51 krustynas upsd[1098645]: listening on 127.0.0.1 port 3493
Mar 27 14:48:51 krustynas upsd[1098645]: listening on 192.168.2.230 port 3493
Mar 27 14:48:51 krustynas upsd[1098645]: not listening on ::0 port 3493
Mar 27 14:48:51 krustynas upsd[1098645]: not listening on 0.0.0.0 port 3493
Mar 27 14:48:51 krustynas upsd[1098645]: Can't open /etc/nut/ups.conf: Can't open /etc/nut/ups.conf: Permission denied
Mar 27 14:48:51 krustynas upsd[1098645]: Can't open /etc/nut/ups.conf: Can't open /etc/nut/ups.conf: Permission denied
Mar 27 14:48:51 krustynas upsd[1098645]: Network UPS Tools upsd 2.7.4
Mar 27 14:48:51 krustynas systemd[1]: nut-server.service: Control process exited, code=exited, status=1/FAILURE
Mar 27 14:48:51 krustynas systemd[1]: nut-server.service: Failed with result 'exit-code'.
Mar 27 14:48:51 krustynas systemd[1]: Failed to start Network UPS Tools - power devices information server.


The getcwd() error is new, and being a novice Linux user I don't really understand the error. I just know it wasn't there before.
Then I see that the ups.conf isn't being read.

Checking the /etc/nut folder:
Code:
$ ls -la
total 28
drwxr-xr-x   2 root root      8 Mar 27 14:48 .
drwxr-xr-x 143 root root    256 Mar 27 14:48 ..
-r--r-----   1 root gluster  15 Mar 27 14:48 nut.conf
-r--r-----   1 root gluster  75 Mar 27 14:48 ups.conf
-r--r-----   1 root gluster  96 Mar 27 14:48 upsd.conf
-r--r-----   1 root gluster  45 Mar 27 14:48 upsd.users
-r--r-----   1 root gluster 450 Mar 27 14:48 upsmon.conf
-r--r-----   1 root gluster 563 Mar 27 14:48 upssched.conf


I see that all the files are owned by root:gluster. I am confused about this group membership. What user is Scale using to invoke the
nut service? I would think it is root, and should be able to read the files.

Can anyone help me get this service back up and running?

Thanks!
 
Joined
Jun 2, 2019
Messages
591
I'm on 22.12-MASTER-20220327-072907

1. Where did you download TrueNAS-SCALE-22.12-MASTER-20220327-112906 update file?

I see the manifest file lists are even more current version, but they are not avail for download. Perhaps a borked nightly that was pulled?

Code:
{"filename": "TrueNAS-SCALE-22.12-MASTER-20220327-152906.update", "version": "22.12-MASTER-20220327-152906", "date": "2022-03-27T19:47:14.277595", "changelog": "", "checksum": "564d32721db965da9d574212b5294dd201e464a7aa51db17ddcb4ed648876f2a"}


2. Have you tried to reverting to the previous nightly running your nut-server?


pfsense is UPS master
TrueNAS CORE/SCALE are slaves


Code:
root@NAS-3[~]# upsc apcups@pfsense
Init SSL without certificate database
battery.charge: 97
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2001/09/25
battery.mfr.date: 2021/06/23
battery.runtime: 2394
battery.runtime.low: 120
battery.type: PbAc
battery.voltage: 26.9
battery.voltage.nominal: 24.0
device.mfr: American Power Conversion
device.model: Back-UPS XS 1500M
device.serial: 3B2125X60993
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.version: 2.7.4
driver.version.data: APC HID 0.96
driver.version.internal: 0.41
input.sensitivity: medium
input.transfer.high: 139
input.transfer.low: 88
input.transfer.reason: input voltage out of range
input.voltage: 121.0
input.voltage.nominal: 120
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.firmware: 947.d11 .D
ups.firmware.aux: d11
ups.load: 16
ups.mfr: American Power Conversion
ups.mfr.date: 2021/06/23
ups.model: Back-UPS XS 1500M
ups.productid: 0002
ups.realpower.nominal: 900
ups.serial: 3B2125X60993
ups.status: OL CHRG
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
 
Last edited:

sgt_jamez

Explorer
Joined
Jul 30, 2021
Messages
88
1. I updated to the newest nightly when I noticed the issue thinking it may solve the issue. I will see try to roll back to a prior update.

2. Here's the file permissions for /etc/nut
Code:
# ls -lart
total 28
-r--r-----   1 root gluster  39 Mar 27 15:39 ups.conf
-r--r-----   1 root gluster  39 Mar 27 15:39 upsd.conf
-r--r-----   1 root gluster  39 Mar 27 15:39 upsd.users
-r--r-----   1 root gluster 425 Mar 27 15:39 upsmon.conf
-r--r-----   1 root gluster 563 Mar 27 15:39 upssched.conf
-r--r-----   1 root gluster  15 Mar 27 15:39 nut.conf
drwxr-xr-x   2 root root      8 Mar 27 15:39 .
drwxr-xr-x 138 root root    249 Mar 27 15:40 ..


The Scale host has been running update upon update since way back. Just now i did a fresh install from ISO of 22.02.0.1. I checked /etc/nut permissions and they were root:nut. Then I applied the 112906 update and the perms are back to root:gluster.

My configuration file was saved under the nightly, is there any way to use that on a fresh install of the release version? I tried and it failed due to the config file being from a newer version. Just wonder if I can go to the release version without having to rebuild everything.
 
Joined
Jun 2, 2019
Messages
591
2. Here's the file permissions for /etc/nut
Maybe try changing the file group

Code:
cd /etc/nut
chown root:nut *


My configuration file was saved under the nightly, is there any way to use that on a fresh install of the release version?
I had the same problem trying to roll back to the release version from a nightly. There is a compatibility problem trying to restore a config file saved from a nightly to a fresh install of a release version. I managed to pull out the freenas-v1.db file from the TAR fail and resort it, then manually set up all my passwords again. It would not allow me to restore a TAR file that contained the pwenc_secret seed file. I learned my lesson and set the KEEP flag on the release boot image, so I can always roll back.

 
Last edited:

sgt_jamez

Explorer
Joined
Jul 30, 2021
Messages
88
I changed the group as you indicated and restarted the service
Code:
service nut-server restart

And checked
Code:
# service nut-server status
      Active: active (running) since Sun 2022-03-27 16:31:35 PDT; 6s ago
    Process: 23141 ExecStart=/sbin/upsd (code=exited, status=0/SUCCESS)
  Main PID: 23142 (upsd)
         Tasks: 1 (limit: 37774)
     Memory: 752.0K
     CGroup: /system.slice/nut-server.service
             └─23142 /lib/nut/upsd

Mar 27 16:31:35 krustynas upsd[23141]: not listening on ::0 port 3493
Mar 27 16:31:35 krustynas upsd[23141]: not listening on 0.0.0.0 port 3493
Mar 27 16:31:35 krustynas upsd[23141]: Connected to UPS [ups]: usbhid-ups-ups
Mar 27 16:31:35 krustynas upsd[23141]: Connected to UPS [ups]: usbhid-ups-ups
Mar 27 16:31:35 krustynas upsd[23142]: Startup successful
Mar 27 16:31:35 krustynas systemd[1]: Started Network UPS Tools - power devices information server.
Mar 27 16:31:37 krustynas upsd[23142]: User upsmon@192.168.2.232 logged into UPS [ups]
Mar 27 16:31:37 krustynas upsd[23142]: User upsmon@127.0.0.1 logged into UPS [ups]
Mar 27 16:31:37 krustynas upsd[23142]: User upsmon@192.168.2.3 logged into UPS [ups]
Mar 27 16:31:39 krustynas upsd[23142]: User upsmon@192.168.2.2 logged into UPS [ups]


So that part of it worked, however the chown changes do not survive a reboot. How can I make that permanent?
 

sgt_jamez

Explorer
Joined
Jul 30, 2021
Messages
88
I'm on 22.12-MASTER-20220327-072907

1. Where did you download TrueNAS-SCALE-22.12-MASTER-20220327-112906 update file?

https://update.freenas.org/scale/TrueNAS-SCALE-Angelfish-Nightlies/

I see the manifest file lists are even more current version, but they are not avail for download. Perhaps a borked nightly that was pulled?

I pulled it from that same location.

Maybe I should be asking if the version numbers have a specific meaning? Or are they just sequence numbers?

I'm thinking to fall back to the release install and then try the 0727907.
 
Joined
Jun 2, 2019
Messages
591

gordon19284

Dabbler
Joined
Dec 13, 2021
Messages
14
I am seeing this same behavior on the TrueNAS-SCALE-22.02.1 release. My workaround for now is to create a startup task that runs the following: chown root:nut /etc/nut/*; systemctl restart nut-server.service. I've also filed a bug report: NAS-116110.

init-script.png
 

TurtleFX

Dabbler
Joined
Nov 20, 2018
Messages
11
I am seeing this same behavior on the TrueNAS-SCALE-22.02.1 release. My workaround for now is to create a startup task that runs the following: chown root:nut /etc/nut/*; systemctl restart nut-server.service. I've also filed a bug report: NAS-116110.
I've noticed exactly the same behaviour on TrueNAS-SCALE-22.02.1 - permissions are set for ladvd group. If I change group to nut, nut-server can be started.
Lets hope it will get fixed.
 
Top