Connected UPS with NUT (network ups tools) package: usb problem after reinstall

Hi everybody,
try to install e config NUT (network ups tools) software for managing only two main goals... sending a Telegram message - via api, with curl - in case of power outage and eventually turn off the workstation connected to the ups itself, an apc 650 cs.
OpenWrt is 19.07.08 on an r7800 router.
Now, first step is installation. I did it a couple of day ago, it worked (please note openWrt uses three config file to config NUT files, see wiki... this is a little different with other linux distro) and I can also see cgi page with the detail or reach the ups via the router with WinNUT tool.
I started to config the various file to do what I told, but I make some mistakes so lesson learned and I disinstalled everything to restart with the job (note: if you modify the nut config file by yourself, do not forget to change the symbolic link, as described in the wiki).
Now, after (several) restart of the router, and several plug and unplug of the cable, I always have this error when I try to force the connection:

root@router1:/etc/hotplug.d/usb# upsdrvctl start

Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
USB communication driver 0.33

Can't claim USB device [051d:0002]: No such file or directory

Driver failed to start (exit status=1)

Please note that lsusb give me the fact that the ups is connected, and the device is manageable by nut user:


Bus 003 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
root@router1:/dev/bus/usb/003# ll
drwxr-xr-x    2 root     root            80 Jan 30 23:19 ./
drwxr-xr-x    6 root     root           120 Jan  1  1970 ../
crw-------    1 root     root      189, 256 Jan  1  1970 001
crw-rw----    1 nut      nut       189, 258 Jan 30 23:20 003

I've seen there was a sort of similar problem in an old version but I dont know if it is related to mine and I have not understood the solution

I've found other similar error in very old version of ubuntu, they told to change udev permissions etc, but I dont think this is the case.
Any idea?

ps: hope to solve this and go further to reach the goals, I'll try to update or enrich the wiki, there are very few info just for a base config that seems do nothing (no shutdown or alert on on battery events...)

I get exactly the same error, but NUT is working. In my case, this error is expected because NUT is running. I suspect that in your case, NUT has already claimed the UPS.

What do you get when you run:

netstat -plnt

And how about this:

upsc <upsname>@localhost

replace with whatever you have named the UPS in your configuration in the config driver stanza (it'll be config driver 'upsname').

Hi,
the upsc client said connection error.
In netstat -plnt output there is no evidence of nut port... I'm going to try a fresh new install of the packages, but I think there is some binding at udev level and I'm not expert to manage it.

just reinstalled and re configured... the driver now seems to start via CLI, while upsd says it does not find the upsd.pid file: upsc always says not connected. I've also seen that some folders do not belong to nut user and nut user has not been created (I'm enough sure it happened the first time I did it), infact if I do /etc/init.d/nut-server start it says nut user and group do not exist. I have not understood the relation within upsd and nut-server, too. :(:frowning:
Maybe the (re)install script in a package fails somewhere and do not create nut user?

Let's see config files and status:

Please copy the output of the following commands and post it here using the "Preformatted text </> " button:
grafik
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

cat /etc/config/nut_server 
cat /etc/config/nut_monitor
netstat -plnt
logread | grep ups
 

Here you are :slight_smile:

cat /etc/config/nut_server


config user
        option username 'upsuser'
        option password 'password'
        option upsmon 'master'

config listen_address
        option address '172.16.1.1'
        option port '3493'

config driver 'ups'
        option port 'auto'
        option driver 'usbhid-ups'

config upsd upsd

cat /etc/config/nut_monitor

config upsmon 'upsmon'
        option notifycmd '/usr/bin/upssched-cmd'
        option defaultnotify 'SYSLOG EXEC'

config master
        option powervalue '1'
        option upsname 'ups'
        option hostname 'localhost'
        option username 'upsuser'
        option password 'password'

netstat -plnt

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3152/uhttpd
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      7986/dnsmasq
tcp        0      0 172.16.1.1:53           0.0.0.0:*               LISTEN      7986/dnsmasq
tcp        0      0 192.168.1.224:53        0.0.0.0:*               LISTEN      7986/dnsmasq
tcp        0      0 10.123.0.7:53           0.0.0.0:*               LISTEN      7986/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1281/dropbear
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      3152/uhttpd
tcp        0      0 :::80                   :::*                    LISTEN      3152/uhttpd
tcp        0      0 ::1:53                  :::*                    LISTEN      7986/dnsmasq
tcp        0      0 fe80::b2b9:8aff:fe4d:8bef:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 fe80::b2b9:8aff:fe4d:8bee:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 fd77:ba07:ad24::1:53    :::*                    LISTEN      7986/dnsmasq
tcp        0      0 fe80::b2b9:8aff:fe4d:8bee:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 2001:b07:5d2a:5896:b2b9:8aff:fe4d:8bef:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 2001:b07:5d2a:5896::532:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 fe80::b2b9:8aff:fe4d:8bef:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 fe80::b2b9:8aff:fe4d:8bf0:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 fe80::b2b9:8aff:fe4d:8bf1:53 :::*                    LISTEN      7986/dnsmasq
tcp        0      0 :::22                   :::*                    LISTEN      1281/dropbear
tcp        0      0 :::443                  :::*                    LISTEN      3152/uhttpd

logread | grep ups

Mon Jan 31 11:50:36 2022 kern.debug kernel: [    0.333893] pci_bus 0000:00: fixups for bus
Mon Jan 31 11:50:36 2022 kern.debug kernel: [    0.340054] pci_bus 0000:01: fixups for bus
Mon Jan 31 11:50:36 2022 kern.debug kernel: [    0.575317] pci_bus 0001:00: fixups for bus
Mon Jan 31 11:50:36 2022 kern.debug kernel: [    0.581635] pci_bus 0001:01: fixups for bus
Mon Jan 31 11:50:37 2022 user.notice dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Mon Jan 31 11:50:56 2022 daemon.err upsd[3450]: user nut not found
Mon Jan 31 11:50:56 2022 daemon.info upsd[3450]: Network UPS Tools upsd 2.7.4
Mon Jan 31 11:50:56 2022 daemon.info usbhid-ups[3449]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 11:50:56 2022 daemon.info usbhid-ups[3449]: USB communication driver 0.33
Mon Jan 31 11:51:01 2022 user.notice dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Mon Jan 31 11:51:01 2022 daemon.info upsd[4440]: Network UPS Tools upsd 2.7.4
Mon Jan 31 11:51:01 2022 daemon.err upsd[4440]: user nut not found
Mon Jan 31 11:51:01 2022 daemon.info usbhid-ups[4452]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 11:51:01 2022 daemon.info usbhid-ups[4452]: USB communication driver 0.33
Mon Jan 31 11:51:06 2022 daemon.info upsd[5755]: Network UPS Tools upsd 2.7.4
Mon Jan 31 11:51:06 2022 daemon.err upsd[5755]: user nut not found
Mon Jan 31 11:51:06 2022 daemon.info usbhid-ups[5759]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 11:51:06 2022 daemon.info usbhid-ups[5759]: USB communication driver 0.33
Mon Jan 31 11:51:10 2022 daemon.err upsmon[6687]:    0.000000   fopen /var/run/upsmon.pid: No such file or directory
Mon Jan 31 11:51:10 2022 daemon.err upsmon[6687]:    0.000957   Using power down flag file /var/run/killpower
Mon Jan 31 11:51:10 2022 daemon.err upsmon[6687]:    0.001032   UPS: ups@localhost (master) (power value 1)
Mon Jan 31 11:51:10 2022 daemon.err upsmon[6687]:    0.003032   debug level is '1'
Mon Jan 31 11:51:10 2022 daemon.err upsmon[6687]:    0.003160   user nutmon not found
Mon Jan 31 11:51:11 2022 daemon.err upsd[7017]: user nut not found
Mon Jan 31 11:51:11 2022 daemon.info upsd[7017]: Network UPS Tools upsd 2.7.4
Mon Jan 31 11:51:11 2022 daemon.info usbhid-ups[7025]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 11:51:11 2022 daemon.info usbhid-ups[7025]: USB communication driver 0.33
Mon Jan 31 12:11:27 2022 daemon.err upsd[7562]: user nut not found
Mon Jan 31 12:11:27 2022 daemon.info upsd[7562]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:11:28 2022 daemon.info usbhid-ups[7563]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:11:28 2022 daemon.info usbhid-ups[7563]: USB communication driver 0.33
Mon Jan 31 12:11:32 2022 daemon.info upsd[7609]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:11:32 2022 daemon.err upsd[7609]: user nut not found
Mon Jan 31 12:11:32 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 6 crashes, 0 seconds since last crash
Mon Jan 31 12:11:33 2022 daemon.info usbhid-ups[7610]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:11:33 2022 daemon.info usbhid-ups[7610]: USB communication driver 0.33
Mon Jan 31 12:11:33 2022 daemon.info procd: Instance nut-server::ups s in a crash loop 6 crashes, 0 seconds since last crash
Mon Jan 31 12:11:41 2022 daemon.err upsmon[7616]:    0.000000   fopen /var/run/upsmon.pid: No such file or directory
Mon Jan 31 12:11:41 2022 daemon.err upsmon[7616]:    0.000317   Using power down flag file /var/run/killpower
Mon Jan 31 12:11:41 2022 daemon.err upsmon[7616]:    0.000532   UPS: ups@localhost (master) (power value 1)
Mon Jan 31 12:11:41 2022 daemon.err upsmon[7616]:    0.000725   debug level is '1'
Mon Jan 31 12:11:41 2022 daemon.err upsmon[7616]:    0.000977   user nutmon not found
Mon Jan 31 12:12:01 2022 daemon.err upsmon[7773]:    0.000000   fopen /var/run/upsmon.pid: No such file or directory
Mon Jan 31 12:12:01 2022 daemon.err upsmon[7773]:    0.000587   Using power down flag file /var/run/killpower
Mon Jan 31 12:12:01 2022 daemon.err upsmon[7773]:    0.001034   UPS: ups@localhost (master) (power value 1)
Mon Jan 31 12:12:01 2022 daemon.err upsmon[7773]:    0.001388   debug level is '1'
Mon Jan 31 12:12:01 2022 daemon.err upsmon[7773]:    0.001950   user nutmon not found
Mon Jan 31 12:12:21 2022 daemon.err upsmon[7783]:    0.000000   fopen /var/run/upsmon.pid: No such file or directory
Mon Jan 31 12:12:21 2022 daemon.err upsmon[7783]:    0.000591   Using power down flag file /var/run/killpower
Mon Jan 31 12:12:21 2022 daemon.err upsmon[7783]:    0.001044   UPS: ups@localhost (master) (power value 1)
Mon Jan 31 12:12:21 2022 daemon.err upsmon[7783]:    0.001407   debug level is '1'
Mon Jan 31 12:12:21 2022 daemon.err upsmon[7783]:    0.001917   user nutmon not found
Mon Jan 31 12:12:27 2022 user.notice dnsmasq: DNS rebinding protection is active, will discard upstream RFC1918 responses!
Mon Jan 31 12:12:41 2022 daemon.err upsmon[8051]:    0.000000   fopen /var/run/upsmon.pid: No such file or directory
Mon Jan 31 12:12:41 2022 daemon.err upsmon[8051]:    0.001456   Using power down flag file /var/run/killpower
Mon Jan 31 12:12:41 2022 daemon.err upsmon[8051]:    0.002057   UPS: ups@localhost (master) (power value 1)
Mon Jan 31 12:12:41 2022 daemon.err upsmon[8051]:    0.002364   debug level is '1'
Mon Jan 31 12:12:41 2022 daemon.err upsmon[8051]:    0.002743   user nutmon not found
Mon Jan 31 12:13:01 2022 daemon.err upsmon[8054]:    0.000000   fopen /var/run/upsmon.pid: No such file or directory
Mon Jan 31 12:13:01 2022 daemon.err upsmon[8054]:    0.000676   Using power down flag file /var/run/killpower
Mon Jan 31 12:13:01 2022 daemon.err upsmon[8054]:    0.001152   UPS: ups@localhost (master) (power value 1)
Mon Jan 31 12:13:01 2022 daemon.err upsmon[8054]:    0.001566   debug level is '1'
Mon Jan 31 12:13:01 2022 daemon.err upsmon[8054]:    0.002090   user nutmon not found
Mon Jan 31 12:13:21 2022 daemon.err upsmon[8055]:    0.000000   fopen /var/run/upsmon.pid: No such file or directory
Mon Jan 31 12:13:21 2022 daemon.err upsmon[8055]:    0.000967   Using power down flag file /var/run/killpower
Mon Jan 31 12:13:21 2022 daemon.err upsmon[8055]:    0.001161   UPS: ups@localhost (master) (power value 1)
Mon Jan 31 12:13:21 2022 daemon.err upsmon[8055]:    0.001555   debug level is '1'
Mon Jan 31 12:13:21 2022 daemon.err upsmon[8055]:    0.001938   user nutmon not found
Mon Jan 31 12:13:21 2022 daemon.info procd: Instance nut-monitor::upsmon s in a crash loop 7 crashes, 0 seconds since last crash
Mon Jan 31 12:16:50 2022 daemon.info usbhid-ups[8068]: Startup successful
Mon Jan 31 12:18:02 2022 daemon.err upsd[8177]: user nut not found
Mon Jan 31 12:18:02 2022 daemon.info upsd[8177]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:18:02 2022 daemon.info usbhid-ups[8176]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:18:02 2022 daemon.info usbhid-ups[8176]: USB communication driver 0.33
Mon Jan 31 12:18:07 2022 daemon.info upsd[8201]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:18:07 2022 daemon.err upsd[8201]: user nut not found
Mon Jan 31 12:18:07 2022 daemon.info usbhid-ups[8202]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:18:07 2022 daemon.info usbhid-ups[8202]: USB communication driver 0.33
Mon Jan 31 12:18:12 2022 daemon.info upsd[8203]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:18:12 2022 daemon.err upsd[8203]: user nut not found
Mon Jan 31 12:18:12 2022 daemon.info usbhid-ups[8204]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:18:12 2022 daemon.info usbhid-ups[8204]: USB communication driver 0.33
Mon Jan 31 12:18:17 2022 daemon.info upsd[8205]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:18:17 2022 daemon.err upsd[8205]: user nut not found
Mon Jan 31 12:18:17 2022 daemon.info usbhid-ups[8206]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:18:17 2022 daemon.info usbhid-ups[8206]: USB communication driver 0.33
Mon Jan 31 12:18:22 2022 daemon.info upsd[8207]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:18:22 2022 daemon.err upsd[8207]: user nut not found
Mon Jan 31 12:18:22 2022 daemon.info usbhid-ups[8208]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:18:22 2022 daemon.info usbhid-ups[8208]: USB communication driver 0.33
Mon Jan 31 12:18:27 2022 daemon.info upsd[8209]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:18:27 2022 daemon.err upsd[8209]: user nut not found
Mon Jan 31 12:18:27 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 6 crashes, 0 seconds since last crash
Mon Jan 31 12:18:27 2022 daemon.info usbhid-ups[8210]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:18:27 2022 daemon.info usbhid-ups[8210]: USB communication driver 0.33
Mon Jan 31 12:18:27 2022 daemon.info procd: Instance nut-server::ups s in a crash loop 6 crashes, 0 seconds since last crash
Mon Jan 31 12:53:48 2022 daemon.info upsd[8637]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:53:48 2022 daemon.err upsd[8637]: user nut not found
Mon Jan 31 12:53:48 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 7 crashes, 0 seconds since last crash
Mon Jan 31 12:53:48 2022 daemon.err upsd[8741]: user nut not found
Mon Jan 31 12:53:48 2022 daemon.info upsd[8741]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:53:48 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 8 crashes, 0 seconds since last crash
Mon Jan 31 12:53:48 2022 daemon.debug usbhid-ups[8068]: libusb_get_interrupt: No such device or address
Mon Jan 31 12:53:48 2022 daemon.info upsd[8845]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:53:48 2022 daemon.err upsd[8845]: user nut not found
Mon Jan 31 12:53:48 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 9 crashes, 0 seconds since last crash
Mon Jan 31 12:53:49 2022 daemon.info upsd[8949]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:53:49 2022 daemon.err upsd[8949]: user nut not found
Mon Jan 31 12:53:49 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 10 crashes, 0 seconds since last crash
Mon Jan 31 12:53:53 2022 daemon.info usbhid-ups[9090]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:53:53 2022 daemon.info usbhid-ups[9090]: USB communication driver 0.33
Mon Jan 31 12:53:53 2022 daemon.info procd: Instance nut-server::ups s in a crash loop 7 crashes, 0 seconds since last crash
Mon Jan 31 12:53:53 2022 daemon.err upsd[9172]: user nut not found
Mon Jan 31 12:53:53 2022 daemon.info upsd[9172]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:53:53 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 11 crashes, 0 seconds since last crash
Mon Jan 31 12:53:53 2022 daemon.info usbhid-ups[9307]: Network UPS Tools - Generic HID driver 0.41 (2.7.4)
Mon Jan 31 12:53:53 2022 daemon.info usbhid-ups[9307]: USB communication driver 0.33
Mon Jan 31 12:53:53 2022 daemon.info procd: Instance nut-server::ups s in a crash loop 8 crashes, 0 seconds since last crash
Mon Jan 31 12:53:54 2022 daemon.err upsd[9389]: user nut not found
Mon Jan 31 12:53:54 2022 daemon.info upsd[9389]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:53:54 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 12 crashes, 0 seconds since last crash
Mon Jan 31 12:53:54 2022 daemon.info upsd[9493]: Network UPS Tools upsd 2.7.4
Mon Jan 31 12:53:54 2022 daemon.err upsd[9493]: user nut not found
Mon Jan 31 12:53:54 2022 daemon.info procd: Instance nut-server::upsd s in a crash loop 13 crashes, 0 seconds since last crash

checking this enough new openWrt nut guide, https://linux-man.org/2021/09/28/monitoring-ups-status-with-nutnetwork-ups-tools-on-openwrt/ main difference is that nut user and group are not created... I can do manually but I do not know how many permissions on files and folders I should arrange.

Try changing this to 0.0.0.0

Comment out or remove this line (is there more below this -- if so, comment out the whole section):

just done (even if it worked with that ip, before), but

root@router1:~# /etc/init.d/nut-server reload
id: unknown user nut
chown: unknown user/group nut
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chown: unknown user/group nut
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chown: unknown user/group nut
id: unknown user nut
chgrp: unknown group
root@router1:~# /etc/init.d/nut-server restart
id: unknown user nut
chown: unknown user/group nut
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chown: unknown user/group nut
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chgrp: unknown group
id: unknown user nut
chown: unknown user/group nut
id: unknown user nut
chgrp: unknown group
root@router1:~#

I see two problems, maybe related:

  1. the user/group nut that has not been recreated
  2. the missing of the pid file (see below)
root@router1:~# upsd
Network UPS Tools upsd 2.7.4
fopen /var/run/nut/upsd.pid: No such file or directory
listening on 172.16.1.1 port 3493
Connected to UPS [ups]: usbhid-ups-ups

I remember I had similar problems, but mine is working without issue. We need to find where the user/group nut is being called... was the nut_server config file truncated?

nope... but dont you think is the installation script? I mean, the nut user does not exist if I check with id nut

nut user/group shouldn't be necessary... I don't have anything setup with that user or group (everything is just root).

What installation script did you use?

can you share the contents of each of the files located in /etc/nut

(I refer to install script that "install" the package(s) do not know how it works... ops) that's strange, I'm sure I had nut user group and in the link I posted a process is managed by nut /lib/nut/usbhid-ups -D -a apc -u nut, I had to all processes forced with -u nut parameter.
By the way, here the files in the folder (other are related to monitor and cgi, but before monitor upsd has to work):

root@router1:/etc/nut# cat hosts.conf
MONITOR ups@localhost "ups_650"

root@router1:/etc/nut# cat nut.conf
MODE=netserver

root@router1:/etc/nut# cat ups.conf
# Config file automatically generated from UCI config
[ups]
driver = usbhid-ups
port = auto

root@router1:/etc/nut# cat upsd.conf
# Config file automatically generated from UCI config
LISTEN 0.0.0.0 3493

root@router1:/etc/nut# cat upsd.users
# Config file automatically generated from UCI config
[upsuser]
  password = password
  upsmon master

Try this... not sure if it will work, but worth a quick test:

  • backup your current files (/etc/config/nut_monitor, /etc/config/nut_server)
  • replace the contents of those files as follows:
/etc/config/nut_server
config driver 'ups'
	option driver 'usbhid-ups'
	option port 'auto'

config user
	option username 'upsuser'
	option password 'password'
	option upsmon 'master'

config listen_address
	option address '0.0.0.0'

/etc/config/nut_monitor
config upsmon 'upsmon'
	option runas 'root'
	option shutdowncmd 'poweroff'

config master
	option powervalue '1'
	option upsname 'ups'
	option hostname 'localhost'
	option username 'upsuser'
	option password 'password'

nothing... :confused:

I'm going to try an install from scratch on 21.02.1. I'll document my steps and provide the resulting config files. Might take me a little while, though.

@wireless - Got it working with very little effort.

I did this on a fresh install (reset to defaults) of 21.02.1. Interesting to note that the config options are not contained in 'quotes' -- I wonder if that is where we went wrong earlier (I have a little MR3020 that runs 18.06 exclusively for running NUT for a USB UPS and putting that on the LAN with a wired ethernet connection -- I wrongly assumed that the 19.07 and 21.02 would require 'quotes' around the options where 18.06 did not).

opkg update; opkg install nut nut-driver-usbhid-ups nut-server nut-upsc nut-upsmon

Then I edited the two config files, as you'll see below (you could move these files into place if you want):

/etc/config/nut_server
#config driver_global 'driver_global'
#	option user nut

config driver 'ups'
	option driver usbhid-ups
	option port auto

config user
	option username upsuser
	option password upspassword
#	option actions optional-action
#	list instcmd optional-instant-command
	option upsmon master

config listen_address
	option address 0.0.0.0
	option port 3493

#config upsd 'upsd'
#	option maxage 15
#	option statepath /var/run/nut
#	option maxconn 1024
#	option runas nut
# NB: certificates only apply to SSL-enabled version
#       option certfile /usr/local/etc/upsd.pem
/etc/config/nut_monitor
config upsmon 'upsmon'
	option runas root
#	option minsupplies 1
#	option shutdowncmd '/usr/sbin/nutshutdown'
#	option notifycmd /path/to/cmd
	list defaultnotify SYSLOG
	option pollfreq 5
#	option pollfreqalert 5
# 	option hostsync 15
#	option deadtime 15
#	option onlinemsg "online message"
#	option onbattmsg "on battery message"
#	option lowbattmsg "low battery message"
#	option fsdmsg "forced shutdown message"
#	option comokmsg "communications restored message"
#	option combadmsg "communications bad message"
#	option shutdowmsg "shutdown message"
#	option replbattmsg "replace battery message"
#	option nocommmsg "no communications message"
#	option noparentmsg "no parent message"
#	option onlinenotify "online notify flag 1|0"
#	option onbattnotify "on battery notify flag 1|0"
#	option lowbattnotify "low battery notify flag 1|0"
#	option fsdnotify "forced shutdown notify flag 1|0"
#	option comoknotify "communications restored notify flag 1|0"
#	option combadnotify "communications bad notify flag 1|0"
#	option shutdownotify "shutdown notify flag 1|0"
#	option replbattnotify "replace battery notify flag 1|0"
#	option nocommnotify "no communications notify flag 1|0"
#	option noparentnotify "no parent notify flag 1|0"
#	option rbwarntime 4200 # replace battery warn time
#	option nocommwarntime 300 # no communications warn time
#	option finaldelay 5 # final delay
#	option certpath /path/to/ca/dir
#	option certverify 0
#	option forcessl 0

config master
	option upsname ups
	option hostname localhost
#	option port # optional port number
	option powervalue 1
	option username upsuser
	option password upspassword

#config slave
#	option upsname upsname
#	option hostname localhost
#	option port # optional port number
#	option powervalue 1
#	option username upsuser
#	option password upspassword

Then you can restart the router or just issue the following to restart just the two relevant services...

/etc/init.d/nut-server restart
/etc/init.d/nut-monitor restart

finally, you can verify that it is working by looking at the logs, but also by simply using upsc:

upsc ups@localhost

From there, edit the files to do whatever you need.