I have a DNS-323-B1 and just last week flashed from stock firmware + ffp to Alt-F RC4. It was pretty easy to get everything reconfigured except I cannot get the Alt-F Network UPS Tools package to work under this firmware. (I did have it working previously through ffp.) I have to admit my Linux skills are basic but here is what I have been able to figure out.
I have an APC BackUPS product which uses the usbhid-ups driver. When trying to load the driver via the "upsdrvctl start" command I get the error:No matching HID UPS foundDriver failed to start (exit status=1)By raising the debug level with "export USB_DEBUG=2" I can get additional info.
usb_os_init: No USB VFS found, is it mounted?
USB error: couldn't opendir(): No such file or directoryFrom what I have been able to find via Google, it looks like the driver (or maybe it's libusb) is expecting a usbfs mount at /proc/bus/usb which does not exist.
# mount
rootfs on / type rootfs (rw)
tmpfs on /rootmnt type tmpfs (rw,relatime)
/rootmnt/dev/loop0 on /rootmnt/ro type squashfs (ro,relatime)
aufs on / type aufs (rw,relatime,si=6bceb318)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,relatime,size=162816k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/sda4 on /mnt/sda4 type ext2 (rw,relatime,errors=continue)
/dev/md0 on /mnt/md0 type ext2 (rw,relatime,errors=continue)
/dev/sdb4 on /mnt/sdb4 type ext2 (rw,relatime,errors=continue)At this point I am stuck but think I am on the right track for why the driver fails. Is there a way to get the desired mount point? I do see other posts where this mount point exists
so perhaps I am doing something wrong.
Thanks.Bill
Install the usbutils pckages and try 'lsusb -tv'.
Yesterday I upgraded my DNS-323-B1 to Alt-F RC4. I now have the exact same problem that Bill encountered, but I don't have another box to setup NUT as the master and would like to get it up and working again in RC4 if at all possible. To me it looks like the usbhid-ups driver is looking for the usb devices in the old location and an updated version is required.
On Sunday, July 6, 2014 10:51:48 AM UTC+10, João Cardoso wrote:
Install the usbutils pckages and try 'lsusb -tv'.
[root@xxxxxx]# lsusb -tv
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=orion-ehci/1p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M
|__ Port 1: Dev 3, If 0, Class=print, Driver=usblp, 12M
|__ Port 3: Dev 6, If 0, Class=HID, Driver=usbhid, 1.5M
|__ Port 4: Dev 5, If 0, Class=hub, Driver=hub/4p, 480M
I have tried nut-2.4.1-1 via ffp (previously working on Alt-F RC3):
[root@xxxxxx]# /ffp/bin/usbhid-ups -a APC_UPS
Network UPS Tools - Generic HID driver 0.34 (2.4.1)
USB communication driver 0.31
usb_set_debug: Setting debugging level to 2 (on)
usb_os_init: No USB VFS found, is it mounted?
USB error: couldn't opendir(): No such file or directory
No matching HID UPS found
and also installing nuts 2.6.1-2 via Alt-F:
[root@xxxxxx]# /usr/bin/usbhid-ups -a APC_UPS
Network UPS Tools - Generic HID driver 0.35 (2.6.1)
USB communication driver 0.31
usb_set_debug: Setting debugging level to 2 (on)
usb_os_init: No USB VFS found, is it mounted?
USB error: couldn't opendir(): No such file or directory
No matching HID UPS found
If you don't have any more suggestions,
is it safe to flash back to Alt-F RC3 after installing RC4?
Thanks,
Glenn.
Any difference with and without the UPS connected?
Does the UPS appears there?
What does 'dmesg | tail' displays right after plugging the UPS?
What are the contents of /dev? Any difference with and without the UPS plugged?
You could try to add -DDD to the 'usbhid-ups' command
You could also try to run 'strace' on 'usbhid-ups'
I could try to compile a newer version of libusb. As I told above, /proc/usb (usbfs) has been deprecated in linux-3.x, and probably some tunning is needed.
João, thanks for your speedy reply and excellent level of support for Alt-F :)
On Tuesday, September 2, 2014 11:53:46 AM UTC+10, João Cardoso wrote:
Any difference with and without the UPS connected?
Output with UPS connected:
[root@xxxxxx]# lsusb -tv
usb_set_debug: Setting debugging level to 2 (on)
usb_os_init: No USB VFS found, is it mounted?
USB error: couldn't opendir(): No such file or directory
1-1.1:1.0: No such file or directory
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=orion-ehci/1p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/4p, 480M
|__ Port 1: Dev 3, If 0, Class=print, Driver=, 12M
|__ Port 3: Dev 8, If 0, Class=HID, Driver=usbhid, 1.5M
Output from dmesg | tail right after plugging in the UPS:[root@xxxxxx]# dmesg | tail
usblp0: removed
usb 1-1.3: USB disconnect, device number 6
usb 1-1.3: new low-speed USB device number 7 using orion-ehci
hid-generic 0003:051D:0002.0003: device has no listeners, quitting
usb 1-1.3: USB disconnect, device number 7
usb 1-1.3: new low-speed USB device number 8 using orion-ehci
hid-generic 0003:051D:0002.0004: device has no listeners, quitting
usb 1-1.3: USB disconnect, device number 8
usb 1-1.3: new low-speed USB device number 9 using orion-ehci
hid-generic 0003:051D:0002.0005: device has no listeners, quitting
What are the contents of /dev? Any difference with and without the UPS plugged?
-crw-rw---- 1 root root 189, 10 Sep 2 14:59 1-1.3
You could also try to run 'strace' on 'usbhid-ups'
open("/dev/bus/usb", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = -1 ENOENT (No such file or directory)
open("/proc/bus/usb", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = -1 ENOENT (No such file or directory)
What is upsetting me is the "device has no listeners, quitting" message
The upshid-ups program is trying (using libusb?) to open /dev/bus/usb which doesn't exists.(then it tries to open /proc/bus/usb, which is deprecated in linux-3.x and doesn't exists)Then probably it will scan all device nodes there and try to identify them.But it might follow other strategy. On my system, /dev/bus/usb has subdirectories, organized by USB bus, and the device nodes are named after the USB device.assuming that 1-1.3 is the device node, as above. Adapt to the current situation, as it can changeA-Taking the easy route:mkdir -p /dev/bus/usb # create /dev/bus/usbln -sf /dev/1-1.3 /dev/bus/usb/foobar # create a link to the device node where it expects to find it. Ignoring the name -- might failNow, try running upshid-ups, and if it doesn't work,
B-A more principled approach:mkdir -p /dev/bus/usb/001 # create /dev/bus/usb/001ln -sf /dev/1-1.3 /dev/bus/usb/001/003 # using bus/device insteadNow, try running upshid-ups, and if it doesn't work, more research is needed.
I also need the content of /var/log/hot.log, with the USB attached. That is to try to automate the device node creation, not requiring manual intervention (if the above works)
Worked? which one A or B? both worked? Please post strace output for each case.
On Wednesday, September 3, 2014 8:41:24 AM UTC+10, João Cardoso wrote:
B-A more principled approach:mkdir -p /dev/bus/usb/001 # create /dev/bus/usb/001ln -sf /dev/1-1.3 /dev/bus/usb/001/003 # using bus/device insteadNow, try running upshid-ups, and if it doesn't work, more research is needed.
This method works!! :D
On Wednesday, September 3, 2014 1:36:53 PM UTC+1, Glenn Farrell wrote:
On Wednesday, September 3, 2014 8:41:24 AM UTC+10, João Cardoso wrote:(...)B-A more principled approach:mkdir -p /dev/bus/usb/001 # create /dev/bus/usb/001ln -sf /dev/1-1.3 /dev/bus/usb/001/003 # using bus/device insteadNow, try running upshid-ups, and if it doesn't work, more research is needed.
This method works!! :DGood!Now, to automate the device creation/removal on USB plug/unplug, please do:-stop all NUT processes-unplug the UPS USB connector from the box-remove all created device node using 'rm -rf /dev/bus'-apply the mdev.patch using 'patch -p0 -i /path/to/mdev.patch'-plug the UPS USB connector into th box-verify that /dev/bus/usb/BBB/DDD exists and is a character device using 'ls -lR /dev/bus'-start the NUT processes (please use the Alt-F binaries, not the ffp)On USB unplugging the device node should be removedWorked?
PS-please attach logs instead of using them inline, it preserves formating and are easier to read
PS-2: The patch will survive a reboot (as you have Alt-F packages installed).However, it will not be active at boot time until the Alt-F on disk folder is detected, so you might have to plug/unplug the USB connector.
A better alternative is to create a NUT initscript, and it will only be executed after the Alt-F folder being detected, and the device node can then be programmatically fixed.
On Thursday, September 4, 2014 7:10:55 AM UTC+10, João Cardoso wrote:
On Wednesday, September 3, 2014 1:36:53 PM UTC+1, Glenn Farrell wrote:
On Wednesday, September 3, 2014 8:41:24 AM UTC+10, João Cardoso wrote:(...)
B-A more principled approach:mkdir -p /dev/bus/usb/001 # create /dev/bus/usb/001ln -sf /dev/1-1.3 /dev/bus/usb/001/003 # using bus/device insteadNow, try running upshid-ups, and if it doesn't work, more research is needed.
This method works!! :D
Good!Now, to automate the device creation/removal on USB plug/unplug, please do:-stop all NUT processes-unplug the UPS USB connector from the box-remove all created device node using 'rm -rf /dev/bus'-apply the mdev.patch using 'patch -p0 -i /path/to/mdev.patch'-plug the UPS USB connector into th box-verify that /dev/bus/usb/BBB/DDD exists and is a character device using 'ls -lR /dev/bus'-start the NUT processes (please use the Alt-F binaries, not the ffp)On USB unplugging the device node should be removedWorked?
Yes, this worked. I changed the permissions to 666 as I am not running NUT as root.
PS-please attach logs instead of using them inline, it preserves formating and are easier to read
Sorry about that, I've cleaned up my previous posts to allow for easier reading.PS-2: The patch will survive a reboot (as you have Alt-F packages installed).However, it will not be active at boot time until the Alt-F on disk folder is detected, so you might have to plug/unplug the USB connector.
Yes, I need to unplug/plug the USB connector to create the /dev/bus/usb structure after a reboot.A better alternative is to create a NUT initscript, and it will only be executed after the Alt-F folder being detected, and the device node can then be programmatically fixed.
I already have scripts (start|stop|restart|status) for NUT.
However, without the /dev/bus/usb structure at reboot NUT will not start automatically. So, for now I can simply unplug/plug the USB and run the NUT script manually.
The package install script adds group "nut", perhaps using "root:nut" instead of "0:0" in mdev.conf?
Do you mind attaching a USB hub and simultaneously plugging some USB disk, pen or mouse? I'm looking for possible negative side effects.
I already have scripts (start|stop|restart|status) for NUT.Do you mind sharing it? I could add it to the package.
What are the minimum requirements for a NUT webUI? Do you have any suggestion? Using the KISS Alt-F approach :-)
Now, to automate the device creation/removal on USB plug/unplug, please do:-stop all NUT processes-unplug the UPS USB connector from the box-remove all created device node using 'rm -rf /dev/bus'-apply the mdev.patch using 'patch -p0 -i /path/to/mdev.patch'-plug the UPS USB connector into th box-verify that /dev/bus/usb/BBB/DDD exists and is a character device using 'ls -lR /dev/bus'-start the NUT processes (please use the Alt-F binaries, not the ffp)
Network UPS Tools - Generic HID driver 0.35 (2.6.1)
USB communication driver 0.31
No matching HID UPS found
Driver failed to start (exit status=1)
Network UPS Tools - UPS driver controller 2.6.1
/dev/bus:
total 0
drwxrwxrwx 3 root root 60 Dec 26 22:03 usb
/dev/bus/usb:
total 0
drwxr-xr-x 2 root root 60 Dec 26 22:03 001
/dev/bus/usb/001:
total 0
crw-rw---- 1 root root 189, 9 Dec 26 22:03 010
PS-2: The patch will survive a reboot (as you have Alt-F packages installed).However, it will not be active at boot time until the Alt-F on disk folder is detected, so you might have to plug/unplug the USB connector.
Yes, I need to unplug/plug the USB connector to create the /dev/bus/usb structure after a reboot.
A better alternative is to create a NUT initscript, and it will only be executed after the Alt-F folder being detected, and the device node can then be programmatically fixed.
I already have scripts (start|stop|restart|status) for NUT. However, without the /dev/bus/usb structure at reboot NUT will not start automatically. So, for now I can simply unplug/plug the USB and run the NUT script manually.
Network UPS Tools - UPS driver controller 2.6.1
Network UPS Tools - Generic HID driver 0.35 (2.6.1)USB communication driver 0.31
Using subdriver: APC HID 0.95
Network UPS Tools upsd 2.6.1listening on 127.0.0.1 port 3493Connected to UPS [APC_UPS]: usbhid-ups-APC_UPS
I have applied the patch with succes, the /dev/bus structure is created when connecting the UPS.Is there any alternative to do this automatically for now without the need to unplug/plug the USB connection with the UPS (i.e. a script that checks for changes)?
# should upsd be started as root? it will drop privileges
if ! res=$(RC_PIDFILE=$RUN_DIR/upsd.pid start upsd --chuid $RC_USER:$RC_GROUP); then$DRV_DIR/upsdrvctl stop >& /dev/null
-u usernameIf starting a driver, this value will direct it to setuid(2) to the user id associated with username.If the driver is started as root without specifying this value, it will use the username that was compiled into the binary. This defaults to "nobody", and is far from ideal.This may be set in ups.conf with "user" in the global section.
-u userSwitch to user user after startup if started as root. This overrides whatever you may have compiled in with configure --with-user.
$DEVNAME=bus/usb/([0-9]+)/([0-9]+) 0:0 660 =bus/usb/%1/%2