APC UPS - help needed!

Status
Not open for further replies.

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
I'm having problems connecting my UPS to FreeNAS via USB cable. The FreeNAS is able to see the UPS device, but doesn't install it.

UPS model: APC Back-UPS CS 650
OS: FreeNAS 8.0.1 Release

Settings FreeNAS:
Driver: APC Back-UPS USB USB (usbhid-ups)
Port: /dev/ugen0.2

Log:
Code:
freenas: Using subdriver: APC HID 0.93
freenas: Network UPS Tools - Generic HID driver 0.34 (2.4.1)
freenas: USB communication driver 0.31
freenas: Can't initialize data from HID UPS
freenas: Driver failed to start (exit status=1)
freenas: Network UPS Tools - UPS driver controller 2.4.1
root: /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
freenas: /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
freenas[1642]: Executing: /usr/sbin/service nut_upsmon restart
freenas: nut_upsmon not running? (check /var/db/nut/upsmon.pid).
freenas: Starting nut_upsmon.
freenas: UPS: ups (master) (power value 1)
freenas[1642]: Executing: /usr/sbin/service nut_upslog restart
upsmon[2404]: UPS [ups]: connect failed: Connection failure: Connection refused
upsmon[2404]: Communications with UPS ups lost
freenas: nut_upslog not running? (check /var/db/nut/upslog.pid).
freenas: Starting nut_upslog.
freenas: Warning: initial connect failed: Connection failure: Connection refused
freenas[1642]: Executing: /bin/pgrep -F /var/db/nut/upsd.pid upsd
upsmon[2404]: UPS [ups]: connect failed: Connection failure: Connection refused
upsmon[2404]: UPS ups is unavailable


I've been trying other ports, other drivers and also searching this forum. The log indicates that this have something to do with "nut" - whatever that might be. Obviously I am not very familiar with FreeBSD.

Also found other threads suggesting FreeNAS is having difficulties with some UPS models, is this correct? Is there any solution to my problem, or do I have to wait for another release?
 

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
68 views and no replies? I guess UPS and FreeNAS means trouble :D

Anyway, I attached the unit to Windows Server 2008 to rule out a defective UPS, but the UPS is ok. I also installed FreeNAS on other hardware, but the problem remains. FreeNAS doesn't connect to the UPS. That is, it does see the unit when I insert the usb cable, but give the following error messages when I start the UPS service:

Code:
upsd[2502]: Can't connect to UPS [ups] (usbhid-ups-ups): No such file or directory

upsmon[2518]: Poll UPS [ups] failed - Driver not connected


Now what does this mean? Am I sending FreeNAS looking at the wrong port? I've tried "auto" and the port that FreeNAS reports when inserting the usb cable, "/dev/ugen0.2", but to no avail. Or is there something with the driver? I've tried all available drivers but it seems the "usbhid-ups" should be the right one.

Any suggestions? Anyone?
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
The best I can find is this from the FreeBSD 'man pages': http://linux.die.net/man/8/usbhid-ups

At the present time, usbhid-ups supports:

all MGE UPS SYSTEMS USB models, some APC models, some Belkin models, some Cyber Power Systems models.

For a more complete list, refer to the NUT hardware compatibility list, available in the source distribution as data/drivers.list, or on the NUT website. You may use the "explore" driver option to gather information from HID UPSes which are not yet supported; see below for details.
 

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
Thank you protosd, I am sure it must work. It has to, I am not willing to give up. Not yet. I really want a ZFS server, and after trying Openindiana (with Napp-it), ZFS-guru and FreeNAS 7, I decided FreeNAS 8 is the way to go. But a working UPS is essential, and without it FreeNAS 8 won't be an option.

I've been looking around, and it seems some people (Volker and a few others) got the APC Back-UPS 650 working in FreeNAS 7, it is even listed as a "known to work UPS" here: http://wiki.freenas.org/freenas_users_hardware#ups_-_known_to_work_uninterruptible_power_suplies

I'm thinking of checking the configuration files, unfortunately I am not very familiar with FreeBSD. How do I edit files in FreeNAS 8? Is there an "online guide"? I don't feel like running back to Windows quite yet :D
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
How do I edit files in FreeNAS 8?

I prefer 'vi', but if you're not familiar with it, I thinks there' nano, and eh?? not sure of the other. There are several I just don't keep track since I use 'vi'. You'll probably need to remount the root filesystem so it's read-write (mount -uw /), but depending on what you edit, it may not persist when you reboot.

I'm wondering if it's one of those things that got fixed and didn't make it into the release, but check your PMs, I just sent you one.
 

olegsomphane

Dabbler
Joined
Oct 6, 2011
Messages
18
I think you can use 'edit' as well. While your freenas box is running, can you disconnect and reconnect the usb cable for the ups then see if you can restart the ups service from freenas?
 

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
Olegsomphane, yes I can restart the service. The service will even restart when the USP is disconnected.

Here are the log message when disconnecting the UPS from FreeNAS:

Code:
kernel: ugen0.3: <American Power Conversion> at usbus0 (disconnected)
upsmon[1525]: Poll UPS [ups] failed - Driver not connected


And when reconnecting again:

Code:
kernel: ugen0.3: <American Power Conversion> at usbus0
root: Unknown USB device: vendor 0x051d product 0x0002 bus uhub0
upsmon[1525]: Poll UPS [ups] failed - Driver not connected


Next step is to try FreeNAS on different hardware. So far the driver has had to deal with AMD and Nvidia chipsets. Now I am going to try a Intel board to see if there is a driver issue with NUT that is driving me NUTs :rolleyes:
 

olegsomphane

Dabbler
Joined
Oct 6, 2011
Messages
18
Perhaps use a serial connection or look into switching from NUT to apcupsd? Unfortunately, I do not have any advice on where to start...
 

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
Yihaaa! Finally some progress!
I tried intel based hardware but without success. Still "no connect" from the driver. Protosd, I also tried your new build - 8195 - but this also wouldn't connect to the UPS.

Then I installed FreeNAS 0.7.2.5872 because of the later version of NUT in it. Same problem, it would simply not connect. Then I began to play around with the settings, still in FreeNAS 7, and by removing the ups.conf in the auxiliary parameters, something happened:

Code:
kernel: ugen0: <American Power Conversion Back-UPS CS 650 FW:817.v7 .I USB FW:v7, class 0/0, rev 1.10/0.06, addr 2> on uhub0
upsmon[3192]: Communications with UPS ups@localhost established
upssched-cmd: Communications with the UPS ups@localhost are established


Voila!

And to confirm it the following in the command line: upsc ups@localhost

Code:
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 50
battery.date: 2011/04/13
battery.mfr.date: 2011/04/13
battery.runtime: 2407
battery.runtime.low: 120
battery.temperature: 29.2
battery.type: PbAc
battery.voltage: 13.7
battery.voltage.nominal: 12.0
device.mfr: American Power Conversion
device.model: Back-UPS CS 650
device.serial: 7B1116L00259  
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.6.0
driver.version.data: APC HID 0.95
driver.version.internal: 0.35
input.sensitivity: medium
input.voltage: 232.0
input.voltage.nominal: 230
output.voltage: 230.0
output.voltage.nominal: 230.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.firmware: 817.v7 .I
ups.firmware.aux: v7 
ups.load: 2.0
ups.mfr: American Power Conversion
ups.mfr.date: 2011/04/13
ups.model: Back-UPS CS 650
ups.productid: 0002
ups.serial: 7B1116L00259  
ups.status: OL
ups.test.result: No test initiated
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.timer.start: 0
ups.vendorid: 051d


I will do some more testing with FreeNAS 7 before I revert back to FreeNAS 8. Protosd, I will give your build another try, and obviously I will pay close attention to the ups.conf file :D
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Thats great news, thanks for the feedback and problem solving! I hope you get it figured out in 8.01. I'm going to hook up my UPS later and start playing with it also.
 

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
Ok I've been doing some more testing.
FreeNAS 0.7.2.5872 works perfectly. FreeNAS even shuts down when I disconnect the power to the UPS. Auxiliary parameters must for some reason be left empty.
I also tested a more recent version of FreeNAS 7 (0.7.2.7904, a so called-7z version) - and this fails! No connection to the driver. 8.0.1 also fails, but I haven't been playing around with it yet.

The release notes for 0.7.2.5872 states: "Upgrade nut to 2.60."

What version of NUT is in 8.0.1? And is it possible to simply copy the files belonging to NUT from the .5872 version into the 8.0.1 version? If so, how is this done?

I am downloading 0.7.2.8191 at the moment, released some 21 hours ago. According to the release notes this is NUT 2.61. Could all my problems stem from the transition from NUT 2.60 to 2.61? Lets see..
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
I just looked at the version installed on 8.01 and it says "nut-2.4.1_6", so it seems to be a bit behind.
 

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
FreeNAS 0.7.2.8191 also fails to connect to the UPS. Or rather, the UPS service requires me to fill in Auxiliary parameters, such as ups.conf. And if I do the driver doesn't connect. And if I don't, the service refuses to start: "Error: The changes could not be applied (error code 1)." In other words a catch 21.

I don't want to be stuck with FreeNAS 0.7.2.5872 forever :D

So either I must change the content of ups.conf - but I didn't see anything wrong with it, or I must somehow try to import NUT 2.60 into FreeNAS 8.0.1.

Here is a link to the sourcefiles: http://www.networkupstools.org/source/2.6/

I have already copied the files from the NUT directory from the .5872 install, how do I copy it onto a 8.0.1 install (copy & replace)? I know this might not work, but I would like to try.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
The easiet way to *attempt* to upgrade 8.0.1 would be to

1) mount -uw /
2) pkg_add -rv nut-2.6.1
3) edit /etc/local/nut/ups.conf
4) mount -ro /

Not sure if it will persist after a reboot or interact with the GUI properly.
 

McBrian

Dabbler
Joined
Oct 4, 2011
Messages
14
Thanks, I'm going to have a go at 8.0.1 now. And then I will require a timeout ;)
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
@ McBrian,
Just catching up here but with Protosd's build what do you have set for the configuration? Please don't take the way I write here as a sign that I think you're stupid or anything like that, I have to assume worse case and you might be overlooking something so this line of thinking works great for me to help out.

Here is what I'm trying to figure out and if I had your APC UPS what I'd do to try and get it functioning. First, as you know the 8.0.1-Release failed for everyone with UPS not working. It was fixed in the trunk builds but I can't say if it was fixed in the branches build (sorry Protosd, haven't tried your build on my real machine, just VM) but maybe Protosd has tested it on his system.

The steps I'd do to verify it works.

1) Download 8.0.1 from Protosd (hopefully UPS works there) or I can open up an anonymous FTP for an evening and let you grab my build (8158) which is an iso, not an upgrade and will not work as an upgrade either.
2) Install on your FreeNAS box (real computer, not VM).
3) Change your root/admin password (because it's good to do).
4) Under Services, open UPS Configuration.
5) Select APC Back-UPS PRO USB USB (usbhid-ups).
6) Port is a drop-down box reporting only ports on your system. Select the one that your UPS is connected to (this will be in the dmesg data).
7) Save the configuration as is, no need at this time to change anything else.
8) Try to turn on the UPS service.

What happens?

Also, if you are able to add the new nut, like Protosd said, I doubt it will be persistent with a reboot. That is likely required to be updated during build time.

-Mark

P.S. PM me and I'll toss you the IP address for the build and since I haven't tested my FTP from an outside location, guess you can give it a try.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Hi Mark,

I may be making a bad assumption, but my thinking with the branch builds on the 8.01 release branch, was that the trunk fixes were being back ported to the 8.01 release branch. That was true for email, but I haven't done *any* UPS testing in any version which is what I'm hoping to get around to here very shortly today. I'm running the 8195 branch build I sent you on my main NAS, so as soon as I can switch some cables around I'm going to test it out.

I did try to update the package with pkg_add, but it doesn't like the package name for some reason and I'm sure I'm just not getting the package name right for some reason.

Ok, thanks for the feedback, happy hacking!
 

joeschmuck

Old Man
Moderator
Joined
May 28, 2011
Messages
10,994
Hey Protosd,

I never know what goes on with the developers and I know the UPS issue was fixed in the truck well before 8.0.1-Release, there was a step backwards if you will, so I don't "know" if it has been migrated yet. If we had a recent nightly build we might know but since one of their computers doesn't work, nightly builds are on the back burner. When you look at the changes being made, sometimes it's to the trunk, sometimes it's to the branches, sometimes to both. You got me as to where these two stand side by side.

As for the pkg_add, did your remove the old nut first? If you tried to and it said it wasn't installed, I know the new nut will need to be build into the software. I don't think it will be too hard to update nut but I'm not sure it's needed in this case just yet. I could look into it but that won't be tonight.

You know that build of yours, damn if I didn't save it (opened up in winzip) and had to download it again.

And you know I'm happy when I'm hacking.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
6) Port is a drop-down box reporting only ports on your system. Select the one that your UPS is connected to (this will be in the dmesg data).

Another tip for finding the port name is to watch the console messages while you plug in or unplug your UPS to the USB port.
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
Ok, got my UPS hooked up and working. I did get the 'Driver not connected' error, but when I double checked the UPS model in "Control Services" it had the wrong model even though I know I selected the correct UPS in the UPS Service configuration. After I changed it to the correct model it worked. Now I am going to see if it emails me/shuts down correctly.

Code:
battery.charge: 120
battery.charge.low: 10
battery.charge.warning: 20
battery.mfr.date: CPS
battery.runtime: 2940
battery.runtime.low: 300
battery.type: PbAcid
battery.voltage: 14.1
battery.voltage.nominal: 12
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ugen4.2
driver.version: 2.4.1
driver.version.data: CyberPower HID 0.2
driver.version.internal: 0.34
input.transfer.high: 140
input.transfer.low: 90
input.voltage: 122.0
input.voltage.nominal: 120
output.voltage: 122.0
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 9
ups.mfr: CPS
ups.model: UPS BF800
ups.productid: 0501
ups.realpower.nominal: 450
ups.status: OL
ups.test.result: Done and passed
ups.timer.shutdown: -1
ups.timer.start: 0
ups.vendorid: 0764
 
Status
Not open for further replies.
Top