[Nut-upsuser] usbhid-ups flooding system log
Robert Nichols
rnicholsNOSPAM at comcast.net
Fri Jul 24 01:49:16 BST 2026
Thanks for the response, but this is a different situation. In my case, the device actually _is_ disconnected (I disconnected the USB cable and shut down the UPS prior to replacing the batteries). This is not the only UPS, and it's not even the primary one for this host, so I do not want to stop nut.target. Restarting nut.target is not going to help unless I first edit the ups.conf, upsmon.conf, and hosts.conf files to remove references to the now disconnected unit, though now that I think of it, perhaps if the device is missing right from the start, then the package won't keep trying forever to look for it. I'll give that a try some time.
--
Bob Nichols AT comcast.net I am "RNichols42"
On 7/23/26 09:57, Raymond Burkholder wrote:
> I wrote up an article regarding this.
>
> NUT USB APC BeagleBone <https://blog.raymond.burkholder.net/index.php?/archives/1360-NUT-USB-APC-BeagleBone.html>
>
> For some reason, USB devices 'disconnect' and reconnect. When the device reconnects, a new DeviceID is assigned to the USB device. This breaks the usbhid-ups drivers supplied by NUT the packages. That is, usbhid-ups no longer sees the APC USB device.
>
> To resolve this, I used Debian's udev system to sense the device id change and to restart the NUT USB driver.
>
> # cat /etc/udev/rules.d/89-usb-ups-change.rules
> SUBSYSTEM=="usb", MODE="0660", ACTION=="add", ENV{ID_VENDOR_ID}=="051d", ENV{ID_MODEL_ID}=="0003", RUN+="/home/debian/usb_add.sh add '$env{DEVNAME}' '$env{ID_USB_SERIAL}'"
> SUBSYSTEM=="usb", MODE="0660", ACTION=="remove", RUN+="/home/debian/usb_remove.sh remove $env{DEVNAME}"
>
> Sense a removal, which stops nut.target
>
> $ cat usb_remove.sh
> #!/usr/bin/env bash
>
> logger "USB state change detected: $1 $2"
> echo "$(date) USB state change detected: $1 $2" >> /home/debian/usb-log.txt
> #systemctl stop nut.target
> exit 0
>
> Sense an addition, which restarts / starts
>
> $ cat usb_add.sh
> #!/usr/bin/env bash
>
> logger "USB state change detected: $1 $2 $3"
> echo "$(date) USB state change detected: $1 $2 $3" >> /home/debian/usb-log.txt
> systemctl restart nut.target
> exit 0
--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.
More information about the Nut-upsuser
mailing list