APC UPS - help needed!

Discussion in 'Hardware' started by McBrian, Oct 4, 2011.

  1. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 4, 2011

    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 (text):
    1.  
    2. freenas: Using subdriver: APC HID 0.93
    3. freenas: Network UPS Tools - Generic HID driver 0.34 (2.4.1)
    4. freenas: USB communication driver 0.31
    5. freenas: Can't initialize data from HID UPS
    6. freenas: Driver failed to start (exit status=1)
    7. freenas: Network UPS Tools - UPS driver controller 2.4.1
    8. root: /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
    9. freenas: /usr/local/etc/rc.d/nut: WARNING: failed precmd routine for nut
    10. freenas[1642]: Executing: /usr/sbin/service nut_upsmon restart
    11. freenas: nut_upsmon not running? (check /var/db/nut/upsmon.pid).
    12. freenas: Starting nut_upsmon.
    13. freenas: UPS: ups (master) (power value 1)
    14. freenas[1642]: Executing: /usr/sbin/service nut_upslog restart
    15. upsmon[2404]: UPS [ups]: connect failed: Connection failure: Connection refused
    16. upsmon[2404]: Communications with UPS ups lost
    17. freenas: nut_upslog not running? (check /var/db/nut/upslog.pid).
    18. freenas: Starting nut_upslog.
    19. freenas: Warning: initial connect failed: Connection failure: Connection refused
    20. freenas[1642]: Executing: /bin/pgrep -F /var/db/nut/upsd.pid upsd
    21. upsmon[2404]: UPS [ups]: connect failed: Connection failure: Connection refused
    22. upsmon[2404]: UPS ups is unavailable
    23.  
    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?
  2. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 9, 2011

    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 (text):
    1.  
    2. upsd[2502]: Can't connect to UPS [ups] (usbhid-ups-ups): No such file or directory
    3.  
    4. upsmon[2518]: Poll UPS [ups] failed - Driver not connected
    5.  
    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?
  3. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 9, 2011

    The best I can find is this from the FreeBSD 'man pages': http://linux.die.net/man/8/usbhid-ups

  4. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 9, 2011

    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
  5. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 9, 2011

    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.
  6. olegsomphane New Member

    Member Since:
    Oct 6, 2011
    Message Count:
    18
    Likes Received:
    0
    Trophy Points:
    0
    olegsomphane, Oct 9, 2011

    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?
  7. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 10, 2011

    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 (text):
    1.  
    2. kernel: ugen0.3: <American Power Conversion> at usbus0 (disconnected)
    3. upsmon[1525]: Poll UPS [ups] failed - Driver not connected
    4.  
    And when reconnecting again:

    Code (text):
    1.  
    2. kernel: ugen0.3: <American Power Conversion> at usbus0
    3. root: Unknown USB device: vendor 0x051d product 0x0002 bus uhub0
    4. upsmon[1525]: Poll UPS [ups] failed - Driver not connected
    5.  
    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:
  8. olegsomphane New Member

    Member Since:
    Oct 6, 2011
    Message Count:
    18
    Likes Received:
    0
    Trophy Points:
    0
    olegsomphane, Oct 10, 2011

    Perhaps use a serial connection or look into switching from NUT to apcupsd? Unfortunately, I do not have any advice on where to start...
  9. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 10, 2011

    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 (text):
    1.  
    2. 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
    3. upsmon[3192]: Communications with UPS ups@localhost established
    4. upssched-cmd: Communications with the UPS ups@localhost are established
    5.  
    Voila!

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

    Code (text):
    1.  
    2. battery.charge: 100
    3. battery.charge.low: 10
    4. battery.charge.warning: 50
    5. battery.date: 2011/04/13
    6. battery.mfr.date: 2011/04/13
    7. battery.runtime: 2407
    8. battery.runtime.low: 120
    9. battery.temperature: 29.2
    10. battery.type: PbAc
    11. battery.voltage: 13.7
    12. battery.voltage.nominal: 12.0
    13. device.mfr: American Power Conversion
    14. device.model: Back-UPS CS 650
    15. device.serial: 7B1116L00259  
    16. device.type: ups
    17. driver.name: usbhid-ups
    18. driver.parameter.pollfreq: 30
    19. driver.parameter.pollinterval: 2
    20. driver.parameter.port: auto
    21. driver.version: 2.6.0
    22. driver.version.data: APC HID 0.95
    23. driver.version.internal: 0.35
    24. input.sensitivity: medium
    25. input.voltage: 232.0
    26. input.voltage.nominal: 230
    27. output.voltage: 230.0
    28. output.voltage.nominal: 230.0
    29. ups.beeper.status: enabled
    30. ups.delay.shutdown: 20
    31. ups.delay.start: 30
    32. ups.firmware: 817.v7 .I
    33. ups.firmware.aux: v7
    34. ups.load: 2.0
    35. ups.mfr: American Power Conversion
    36. ups.mfr.date: 2011/04/13
    37. ups.model: Back-UPS CS 650
    38. ups.productid: 0002
    39. ups.serial: 7B1116L00259  
    40. ups.status: OL
    41. ups.test.result: No test initiated
    42. ups.timer.reboot: 0
    43. ups.timer.shutdown: -1
    44. ups.timer.start: 0
    45. ups.vendorid: 051d
    46.  
    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
  10. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 10, 2011

    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.
  11. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 10, 2011

    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..
  12. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 10, 2011

    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.
  13. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 10, 2011

    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.
  14. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 10, 2011

    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.
  15. McBrian New Member

    Member Since:
    Oct 4, 2011
    Message Count:
    14
    Likes Received:
    0
    Trophy Points:
    0
    McBrian, Oct 10, 2011

    Thanks, I'm going to have a go at 8.0.1 now. And then I will require a timeout ;)
  16. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,094
    Likes Received:
    50
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 10, 2011

    @ 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.
  17. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 10, 2011

    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!
  18. joeschmuck Old Man

    Member Since:
    May 28, 2011
    Message Count:
    2,094
    Likes Received:
    50
    Trophy Points:
    48
    Occupation:
    Electrical Engineer, Data Analysis, and Management
    Location:
    Virginia
    joeschmuck, Oct 10, 2011

    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.
  19. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 10, 2011

    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.
  20. ProtoSD Active Member

    Member Since:
    Jul 1, 2011
    Message Count:
    3,359
    Likes Received:
    7
    Trophy Points:
    38
    Location:
    Leaving FreeNAS
    ProtoSD, Oct 10, 2011

    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 (text):
    1. battery.charge: 120
    2. battery.charge.low: 10
    3. battery.charge.warning: 20
    4. battery.mfr.date: CPS
    5. battery.runtime: 2940
    6. battery.runtime.low: 300
    7. battery.type: PbAcid
    8. battery.voltage: 14.1
    9. battery.voltage.nominal: 12
    10. driver.name: usbhid-ups
    11. driver.parameter.pollfreq: 30
    12. driver.parameter.pollinterval: 2
    13. driver.parameter.port: /dev/ugen4.2
    14. driver.version: 2.4.1
    15. driver.version.data: CyberPower HID 0.2
    16. driver.version.internal: 0.34
    17. input.transfer.high: 140
    18. input.transfer.low: 90
    19. input.voltage: 122.0
    20. input.voltage.nominal: 120
    21. output.voltage: 122.0
    22. ups.beeper.status: enabled
    23. ups.delay.shutdown: 20
    24. ups.delay.start: 30
    25. ups.load: 9
    26. ups.mfr: CPS
    27. ups.model: UPS BF800
    28. ups.productid: 0501
    29. ups.realpower.nominal: 450
    30. ups.status: OL
    31. ups.test.result: Done and passed
    32. ups.timer.shutdown: -1
    33. ups.timer.start: 0
    34. ups.vendorid: 0764

Share This Page