On 12/08/2016 09:38 PM, Charles Lepple wrote:> On Dec 8, 2016, at 7:56 PM, Jack McGee <jack at greendesk.net> wrote: >> I rebooted machine and nut cannot connect to the UPS. > Any messages from the kernel regarding USB HID drivers? (Check dmesg and/or journalctl.)dmesg: [ 1.658554] usb 3-5: new full-speed USB device number 4 using xhci_hcd [ 1.787602] usb 3-5: New USB device found, idVendor=0764, idProduct=0501 [ 1.787604] usb 3-5: New USB device strings: Mfr=3, Product=1, SerialNumber=2 [ 1.787606] usb 3-5: Product: CP1500PFCLCD [ 1.787606] usb 3-5: Manufacturer: CPS [ 1.787607] usb 3-5: SerialNumber: 000000000000 [ 1.787673] usb 3-5: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes [ 1.790036] hidraw: raw HID events driver (C) Jiri Kosina [ 1.792323] usbcore: registered new interface driver usbhid [ 1.792324] usbhid: USB HID core driver [ 1.796791] hid-generic 0003:0764:0501.0001: hiddev0,hidraw0: USB HID v1.10 Device [CPS CP1500PFCLCD] on usb-0000:00:14.0-5/input0 journalctl: Dec 09 21:28:49 amethi upsmon[2359]: UPS [CyberUPS1 at localhost]: connect failed: Connection failure: Connection refused Now, I found out that if I do service nut-server stop service nut-server start It works. But this is how it is before those commands: ? nut-server.service - LSB: Network UPS Tools initscript Loaded: loaded (/etc/init.d/nut-server; bad; vendor preset: enabled) Active: active (running) since Fri 2016-12-09 13:48:34 CST; 7h ago Docs: man:systemd-sysv-generator(8) Process: 1886 ExecStart=/etc/init.d/nut-server start (code=exited, status=0/SUCCESS) CGroup: /system.slice/nut-server.service ??2082 /lib/nut/usbhid-ups -a CyberUPS1 Dec 09 13:48:33 amethi systemd[1]: Starting LSB: Network UPS Tools initscript... Dec 09 13:48:33 amethi nut-server[1886]: * Starting NUT - power devices information server and drivers Dec 09 13:48:34 amethi usbhid-ups[2082]: Startup successful Dec 09 13:48:34 amethi upsd[2083]: not listening on 192.168.0.105 port 3493 Dec 09 13:48:34 amethi upsd[2083]: listening on 127.0.0.1 port 3493 Dec 09 13:48:34 amethi upsd[2083]: no listening interface available Dec 09 13:48:34 amethi nut-server[1886]: ...done. Dec 09 13:48:34 amethi systemd[1]: Started LSB: Network UPS Tools initscript. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20161209/f5e98f82/attachment.html>
> On Dec 9, 2016, at 10:40 PM, Jack McGee wrote: > > ? nut-server.service - LSB: Network UPS Tools initscript > Loaded: loaded (/etc/init.d/nut-server; bad; vendor preset: enabled) > Active: active (running) since Fri 2016-12-09 13:48:34 CST; 7h ago > Docs: man:systemd-sysv-generator(8) > Process: 1886 ExecStart=/etc/init.d/nut-server start (code=exited, status=0/SUCCESS) > CGroup: /system.slice/nut-server.service > ??2082 /lib/nut/usbhid-ups -a CyberUPS1 > > Dec 09 13:48:33 amethi systemd[1]: Starting LSB: Network UPS Tools initscript... > Dec 09 13:48:33 amethi nut-server[1886]: * Starting NUT - power devices information server and drivers > Dec 09 13:48:34 amethi usbhid-ups[2082]: Startup successful > Dec 09 13:48:34 amethi upsd[2083]: not listening on 192.168.0.105 port 3493 > Dec 09 13:48:34 amethi upsd[2083]: listening on 127.0.0.1 port 3493 > Dec 09 13:48:34 amethi upsd[2083]: no listening interface availableWait, when you say "NUT cannot connect to the UPS", which part are you referring to? The error you posted before from the driver looked like something else was already connected to the UPS. Only one copy of the driver can be running, and the log quoted above shows that it is (PID 2082). There is supposed to be logic in the driver to detect that a copy is already running, and to send a termination signal to that before trying to continue. However, if you get a "Connection Refused" error, then upsd is not listening on port 3493 yet. The last three lines above indicate that it couldn't bind to 192.168.0.105, so if a restart fixes that, then I guess systemd isn't properly waiting for the network to come up. Maybe someone else has a suggestion for that, but for me, the path of least resistance would be to listen on 0.0.0.0 and use a firewall rule to limit connections to that subnet.
On 12/10/2016 07:42 AM, Charles Lepple wrote:>> On Dec 9, 2016, at 10:40 PM, Jack McGee wrote: >> >> ? nut-server.service - LSB: Network UPS Tools initscript >> Loaded: loaded (/etc/init.d/nut-server; bad; vendor preset: enabled) >> Active: active (running) since Fri 2016-12-09 13:48:34 CST; 7h ago >> Docs: man:systemd-sysv-generator(8) >> Process: 1886 ExecStart=/etc/init.d/nut-server start (code=exited, status=0/SUCCESS) >> CGroup: /system.slice/nut-server.service >> ??2082 /lib/nut/usbhid-ups -a CyberUPS1 >> >> Dec 09 13:48:33 amethi systemd[1]: Starting LSB: Network UPS Tools initscript... >> Dec 09 13:48:33 amethi nut-server[1886]: * Starting NUT - power devices information server and drivers >> Dec 09 13:48:34 amethi usbhid-ups[2082]: Startup successful >> Dec 09 13:48:34 amethi upsd[2083]: not listening on 192.168.0.105 port 3493 >> Dec 09 13:48:34 amethi upsd[2083]: listening on 127.0.0.1 port 3493 >> Dec 09 13:48:34 amethi upsd[2083]: no listening interface available > Wait, when you say "NUT cannot connect to the UPS", which part are you referring to? > > The error you posted before from the driver looked like something else was already connected to the UPS. Only one copy of the driver can be running, and the log quoted above shows that it is (PID 2082). There is supposed to be logic in the driver to detect that a copy is already running, and to send a termination signal to that before trying to continue. > > However, if you get a "Connection Refused" error, then upsd is not listening on port 3493 yet. The last three lines above indicate that it couldn't bind to 192.168.0.105, so if a restart fixes that, then I guess systemd isn't properly waiting for the network to come up. Maybe someone else has a suggestion for that, but for me, the path of least resistance would be to listen on 0.0.0.0 and use a firewall rule to limit connections to that subnet.sorry, after reboot I started seeing this error in terminal: Broadcast message from nut at amethi (somewhere) (Sat Dec 10 08:05:01 2016): UPS CyberUPS1 at localhost is unavailable I had a similar issue I think when Ubuntu moved to SystemD with Mythtv not waiting to start until network was up and then erroring. I will see if I can recall what I did to fix that and apply it to NUT and see if that fixes it.