Kevin DeGraaf
2007-Jan-18 22:57 UTC
[Nut-upsuser] APC Back-UPS XS 1200 - permission denied
I have a new APC Back-UPS XS 1200. It is detected properly by the Linux kernel (2.6.16): # dmesg usb 5-3.4: new low speed USB device using ehci_hcd and address 9 usb 5-3.4: new device found, idVendor=051d, idProduct=0002 usb 5-3.4: new device strings: Mfr=3, Product=1, SerialNumber=2 usb 5-3.4: Product: Back-UPS XS 1200 FW:8.g1 .D USB FW:g1 usb 5-3.4: Manufacturer: American Power Conversion usb 5-3.4: SerialNumber: BB0100009999 usb 5-3.4: configuration #1 chosen from 1 choice hiddev96: USB HID v1.10 Device [American Power Conversion Back-UPS XS 1200 FW:8.g1 .D USB FW:g1 ] on usb-0000:00:1d.7-3.4 This UPS works properly with apcupsd, but I'd rather use NUT. :-) Here's my ups.conf: [xs1200] driver = newhidups port = auto user = upsd desc = "Back-UPS XS 1200" I receive this error when I run newhidups manually: # /usr/lib/ups/driver/newhidups xs1200 Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3) No matching USB/HID UPS found Forcing it to use the "root" user makes a positive difference: # /usr/lib/ups/driver/newhidups -u root xs1200 Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3) Detected a UPS: American Power Conversion/Back-UPS XS 1200 FW:8.g1 .D USB FW:g1 Using subdriver: APC HID 0.8 Here's the relevant strace output from upsd itself: # strace /usr/sbin/upsd 2>&1 [snip ...] socket(PF_FILE, SOCK_STREAM, 0) = 5 connect(5, {sa_family=AF_FILE, path="newhidups-auto"}, 110) = -1 EACCES (Permission denied) close(5) = 0 time(NULL) = 1169155308 write(2, "Can\'t connect to UPS [xs1200] (n"..., 66Can't connect to UPS [xs1200] (newhidups-auto): Permission denied [snip ...] For what it's worth: # lsusb Bus 005 Device 009: ID 051d:0002 American Power Conversion Back-UPS Pro 500/1000/1500 # ls -l /dev/bus/usb/005/009 crw-r--r-- 1 upsd root 189, 520 Jan 18 16:20 /dev/bus/usb/005/009 Any ideas? I'm not sure where in the filesystem upsd is attempting to write the "newhidups-auto" socket. Thanks. -- Kevin DeGraaf
Peter Selinger
2007-Jan-19 00:19 UTC
[Nut-upsuser] APC Back-UPS XS 1200 - permission denied
If you run newhidups with "-u root", then you have to run upsd "-u root" as well. If you run newhidups without "-u root", then it runs as the user specified by the ./configure --with-user option, or by the ups.conf user option (i.e. upsd in your case). It looks like> crw-r--r-- 1 upsd root 189, 520 Jan 18 16:20 /dev/bus/usb/005/009should in principle be readable, so I am not sure why it's not working without "-u root". You can try -D or -DD to get more verbose output from newhidups. Did you check /proc/bus/usb? The newhidups-auto socket usually lives in /var/state/ups, or in the directory specified by ./configure --with-statepath=DIR. -- Peter Kevin DeGraaf wrote:> > I have a new APC Back-UPS XS 1200. It is detected properly by the Linux > kernel (2.6.16): > > # dmesg > usb 5-3.4: new low speed USB device using ehci_hcd and address 9 > usb 5-3.4: new device found, idVendor=051d, idProduct=0002 > usb 5-3.4: new device strings: Mfr=3, Product=1, SerialNumber=2 > usb 5-3.4: Product: Back-UPS XS 1200 FW:8.g1 .D USB FW:g1 > usb 5-3.4: Manufacturer: American Power Conversion > usb 5-3.4: SerialNumber: BB0100009999 > usb 5-3.4: configuration #1 chosen from 1 choice > hiddev96: USB HID v1.10 Device [American Power Conversion Back-UPS XS > 1200 FW:8.g1 .D USB FW:g1 ] on usb-0000:00:1d.7-3.4 > > This UPS works properly with apcupsd, but I'd rather use NUT. :-) > > Here's my ups.conf: > > [xs1200] > driver = newhidups > port = auto > user = upsd > desc = "Back-UPS XS 1200" > > I receive this error when I run newhidups manually: > > # /usr/lib/ups/driver/newhidups xs1200 > Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3) > No matching USB/HID UPS found > > Forcing it to use the "root" user makes a positive difference: > > # /usr/lib/ups/driver/newhidups -u root xs1200 > Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3) > Detected a UPS: American Power Conversion/Back-UPS XS 1200 FW:8.g1 .D > USB FW:g1 > Using subdriver: APC HID 0.8 > > Here's the relevant strace output from upsd itself: > > # strace /usr/sbin/upsd 2>&1 > [snip ...] > socket(PF_FILE, SOCK_STREAM, 0) = 5 > connect(5, {sa_family=AF_FILE, path="newhidups-auto"}, 110) = -1 EACCES > (Permission denied) > close(5) = 0 > time(NULL) = 1169155308 > write(2, "Can\'t connect to UPS [xs1200] (n"..., 66Can't connect to UPS > [xs1200] (newhidups-auto): Permission denied > [snip ...] > > For what it's worth: > > # lsusb > Bus 005 Device 009: ID 051d:0002 American Power Conversion Back-UPS Pro > 500/1000/1500 > > # ls -l /dev/bus/usb/005/009 > crw-r--r-- 1 upsd root 189, 520 Jan 18 16:20 /dev/bus/usb/005/009 > > Any ideas? I'm not sure where in the filesystem upsd is attempting to > write the "newhidups-auto" socket. Thanks. > > -- > Kevin DeGraaf > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser@lists.alioth.debian.org > http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser >