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. :(
Maybe the (re)install script in a package fails somewhere and do not create nut user?
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
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:
the user/group nut that has not been recreated
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?
(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):
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).