Re: [Nut-upsuser] Getting a Plexus 500VA to work with NUT

2011-01-24 Thread Paul Banks

On 24 Jan 2011, at 14:18, Charles Lepple wrote:

> On Jan 23, 2011, at 2:16 PM, Paul Banks wrote:
> 
>> $ ./blazer_usb -a rupert -D -u root
> 
> ^ If this is in a non-root shell, this won't work.

Charles, thanks for clarifying.

As I mentioned I was initially working in a root shel but came up against 
errors I couldn't find any reference to anywhere.

It was only whilst composing my post here that I thought to try it as a 
non-root user in case that had been an assumed step in any instructions I'd 
followed.

OK, so disregarding the permissions (which I can assume if not fine are at 
least a separate issue), can anyone make any recommendations about where I 
should go from here: (note root shell)

# ./blazer_usb -D -a rupert -u root
Network UPS Tools - Megatec/Q1 protocol USB driver 0.03 (2.6.0)
   0.00 send_to_all: SETINFO driver.parameter.port "auto"
   0.003137 debug level is '5'
   0.023508 Checking device (0001/) (003/006)
   0.030542 - VendorID: 0001
   0.032742 - ProductID: 
   0.035366 - Manufacturer: ATCL FOR UPS
   0.037801 - Product: ATCL FOR UPS
   0.040178 - Serial Number: ATCL FOR UPS
   0.042693 - Bus: 003
   0.045032 Trying to match device
   0.047385 Device matches
   0.065112 send_to_all: SETINFO ups.vendorid "0001"
   0.067529 send_to_all: SETINFO ups.productid ""
   0.070556 send_to_all: SETINFO device.type "ups"
   0.072796 send_to_all: SETINFO driver.version "2.6.0"
   0.075564 send_to_all: SETINFO driver.version.internal "0.03"
   0.078335 send_to_all: SETINFO driver.name "blazer_usb"
   0.081055 Trying megatec protocol...
   0.083423 send: Q1
   0.087710 read: error sending control message: Broken pipe
   0.091693 Stall condition cleared
   0.094179 blazer_status: short reply
   0.096664 Status read 1 failed
   0.099547 send: Q1
   0.103623 read: error sending control message: Broken pipe
   0.106326 Stall condition cleared
   0.108771 blazer_status: short reply
   0.111610 Status read 2 failed
   0.114070 send: Q1
   0.118025 read: error sending control message: Broken pipe
   0.121712 Stall condition cleared
   0.124013 blazer_status: short reply
   0.126304 Status read 3 failed
   0.128969 Trying mustek protocol...
   0.131854 send: QS
   0.134344 read: QS
   0.136835 blazer_status: short reply
   0.139482 Status read 1 failed
   0.141970 send: QS
   0.144155 read: QS
   0.146496 blazer_status: short reply
   0.148775 Status read 2 failed
   0.151226 send: QS
   0.153406 read: QS
   0.155615 blazer_status: short reply
   0.158165 Status read 3 failed
   0.160564 Trying megatec/old protocol...
   0.162959 send: D
   0.164992 read: D
   0.167053 blazer_status: short reply
   0.168869 Status read 1 failed
   0.171206 send: D
   0.173712 read: D
   0.176037 blazer_status: short reply
   0.178380 Status read 2 failed
   0.180818 send: D
   0.183006 read: D
   0.185347 blazer_status: short reply
   0.187743 Status read 3 failed
   0.190084 No supported UPS detected

Help is much appreciated!
___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


Re: [Nut-upsuser] Getting a Plexus 500VA to work with NUT

2011-01-24 Thread Charles Lepple

On Jan 23, 2011, at 2:16 PM, Paul Banks wrote:


$ ./blazer_usb -a rupert -D -u root


^ If this is in a non-root shell, this won't work.

NUT has no hooks to go from a non-root user ID to root, nor can it  
change from one non-root user to another non-root user. (To do so  
would require setuid binaries, or calling an existing setuid tool like  
sudo.)


The "-u root" option is to override the default behavior when started  
as root, which is to change to the non-root user specified at  
configuration time (usually "nut", or the last-resort "nobody").



Note that I get the above output when running the command from a
normal non-root user. (not nut user as that has no shell). If I run
the same as root I get a different error saying it couldn't connect to
UPS at all - I originally was going to post about that when I realised
that I probably should be running blazer-usb command as non-root. If
it SHOULD work to launch the driver directly as root then let me know
and I'll post the output as that might identify better the actual
issue here.


If you want to invoke a driver from a non-root account, then "-u"  
won't have an effect, and that non-root account should be the one  
specified at configuration time.


___
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser


[Nut-upsuser] Getting a Plexus 500VA to work with NUT

2011-01-23 Thread Paul Banks
Hi all,

First off thanks you for such a great tool - my searching so far
indicates that the developers and community behind nut are committed
and doing a great job!

Background: I've just purchased a Plexus 500VA UPS for ebuyer because
it was cheap. I didnt expect much but I've seen a few references to
people getting the same and similar models to work with NUT so was
encouraged to try! The NUT website compatability chart lists that the
blazer_usb driver is the correct one to use.

The monitoring server is actualy a linksys NSLU2 (ARM architecture)
but flashed to run vanilla debian etch. Initially, I installed nut
from the apt repositories (v 2.2.2 I believe) however this version did
not include the blazer_usb driver. I did not a t this stage attempt to
use another driver as the compat chart seemed to indicate blazer was
the way to go.

Instead I apt-get removed nut, and then downloaded and compile the
latest 2.6 source from tar ball (installing dependencies, and using
--with-user=nut --with-group=nut and --with-usb). I've check nut user
and group exist and nut user is a member of group nut.

I now have nut 2.6.0 installed however can't get the blazer_usb driver
to communicate with the UPS due to permissions issues. Debug output:

$ cat ups.conf
[rupert]
driver = blazer_usb
port = auto

$ ./blazer_usb -a rupert -D -u root
Network UPS Tools - Megatec/Q1 protocol USB driver 0.03 (2.6.0)
   0.00 debug level is '5'
   0.019447 Checking device (0001/) (003/010)
   0.022465 - VendorID: 0001
   0.024659 - ProductID: 
   0.027246 - Manufacturer: unknown
   0.029307 - Product: unknown
   0.031805 - Serial Number: unknown
   0.034021 - Bus: 003
   0.036163 Trying to match device
   0.038393 Device matches
   0.040732 failed to claim USB device: could not claim interface 0:
Operation not permitted
   0.042969 failed to detach kernel driver from USB device: could not
detach kernel driver from interface 0: Operation not permitted
   0.045468 failed to claim USB device: could not claim interface 0:
Operation not permitted
   0.048084 failed to detach kernel driver from USB device: could not
detach kernel driver from interface 0: Operation not permitted
   0.050467 failed to claim USB device: could not claim interface 0:
Operation not permitted
   0.052842 failed to detach kernel driver from USB device: could not
detach kernel driver from interface 0: Operation not permitted
   0.055540 failed to claim USB device: could not claim interface 0:
Operation not permitted
   0.058121 failed to detach kernel driver from USB device: could not
detach kernel driver from interface 0: Operation not permitted
   0.060418 Can't claim USB device [0001:]: could not detach
kernel driver from interface 0: Operation not permitted

I've seen this come up and have checked all permisions/udev related
things. The relevant entry in udev rules is there (whole script copied
from the tar ball scripts/udev/52-nut-usbups.rules):

#  Krauler UP-M500VA  - blazer_usb
ATTR{idVendor}=="0001", ATTR{idProduct}=="", MODE="664", GROUP="nut"

However it appears not to work. Incidentally, it DID work when I still
had the old 52_nut-usbups.rules file left over from the apt install. I
could ls -al the appropriate bus/device in /dev/bus/usb and see it was
owned by root:nut.

As part of troubleshooting I have removed the 52_nut-usbups.rules that
was left over from apt install and copied the 52-nut-usbups.rules file
from the 2.6.0 tar ball and now it appears not to work! i.e. ls -l
shows the correct bus/device dir owned by root:root. That seems to be
a secondary issue for now though because even with the older script
and ls -l returning correct perms, launching the driver still failed
with an identical debug output. Similarly, if I manual chown root:nut
the device dir now, I still get the same result form starting the
driver. If anyone has any ideas why the old version of udev rules
worked and the current doesn't that would be interesting but appears
not to be the root of my problem currently.

I've also created /var/run/nut and tried it with root:nut and nut:nut
ownership, even with 777 permissions. All give the same output as
above regardless of the -u setting.

Note that I get the above output when running the command from a
normal non-root user. (not nut user as that has no shell). If I run
the same as root I get a different error saying it couldn't connect to
UPS at all - I originally was going to post about that when I realised
that I probably should be running blazer-usb command as non-root. If
it SHOULD work to launch the driver directly as root then let me know
and I'll post the output as that might identify better the actual
issue here.

I've tried looking at all the options I've seen discussed related to
permissions and USB with NUT but I have searched for many hours now
with nothing getting this to work!

Would be very grateful for any ti