[Nut-upsuser] Cyberpower BRG1350AVRLCD with powerpanel driver timeouts

Greg Troxel gdt at lexort.com
Sun May 14 00:56:12 BST 2023


Arturo Javier Alejandro Morán Rouzaud via Nut-upsuser
<nut-upsuser at alioth-lists.debian.net> writes:

> This is my first time using a mailing list, so please let me know if I
> missed something.

You are doing great!  Your message is well-formatted, readable, and on
topic.

I know nothing about Proxmox and have never used a cyberpower UPS, so I
held back but you deserve some help so here goes:

> - OS name and version: Proxmox Virtual Environment 7.4-3
> - NUT version: 2.7.4-13
> - NUT installation method: Debian package/apt
> - Exact device name and related information: Cyberpower BRG1350AVRLCD
> https://www.cyberpowersystems.com/product/ups/intelligent-lcd/brg1350avrlcd/

That has USB and serial.  usbhid is likely better, but it likely does
not work well in 2.7.4.

> - Complete problem description:

2.7.4 is ancient.  The current release is 2.8.0, from a year ago, and
there are fixes since then.  But so much was fixed from 2.7.4 to 2.8.0
that it just does not make sense to run 2.7.4, especially on a UPS that
is newer than 10 years old.  (I use UPS units manufactured in 1995, but
I'm odd!)

Building nut is not super hard, and I would recommend that you do that.
I am not clear on exactly where the docs are, but peruse:
  https://networkupstools.org/
  https://github.com/networkupstools/nut/
I have been building from git, running autogen.sh and configure.  I have
attached my script; it's for NetBSD instead of Debian but it will not be
hard to adjust.

> I'm trying to use this UPS over a serial connection with a Lenovo computer
> running Proxmox. I've already been successful in using it over the USB
> connection with a Raspberry Pi and both Raspbian and OpenWRT, but given
> this computer has a built-in (and as of yet non-functional) serial port, I
> wanted to try it out and see if I'm able to free up a USB port after all.

Do you mean that
  - running ups-nut on a RPI with Raspbian
  - using a USB/serial adaptor on the RPI
  - connecting the adaptor to the UPS with say a DB9 cable
then you can "upsc foo" and see UPS status?

and what version of nut?

Note to others: "man powerpanel" to understand that text is a flavor of
communications protocol that the powerpanel driver supports.

> I am able to connect successfully using the text protocol, however, it
> seems the driver times out after negotiating a link over the serial
> connection. At the moment I am testing it over a USB to Serial adapter, but
> even through this method the official Powerpanel is unable to detect the
> UPS at all, so only NUT seems to be the option here.

Are you sure the virtual USB device is really connected to the serial
lines?  I'm jumping to conclusions but this smells like a virtualization
interface issue.  On the other hand you seem to be getting bits.

> If I'm able to get the UPS working over the USB adapter, I'll be able to
> discard the powerpanel driver as a potential issue and move on to
> diagnosing the onboard RS-232, but for the moment I hope I've included
> enough information as a starting point.

You have, but this points to the port.   I suggest running the driver
with debugging.

> Thanks for the help!
>
> Settings:
> /etc/nut/ups.conf
> maxretry = 5
> [cyberpower]
>     driver = powerpanel
>     protocol = text
>     port = /dev/ttyUSB0

man page says protocol is autodetected, so presumably you set it in the UPS.

> Debug trace:
> /lib/nut/powerpanel -a cyberpower -DDDDDD
> Network UPS Tools - CyberPower text/binary protocol UPS driver 0.27 (2.7.4)
> Warning: This is an experimental driver.
> Some features may not function correctly.
>
>    0.000000     debug level is '6'
>    0.011614     Trying text protocol...
>    0.112022     send: (2 bytes) => 0d 0d
>    0.212152     read: (3 bytes) => 23 2d 33
>    0.362686     send: (3 bytes) => 50 34 0d
>    0.762718     read: (66 bytes) => 23 42 52 47 31 33 35 30 41 56 52 4c 43
> 44 2c 42 46 30
>    0.762744      31 34 30 31 42 41 33 31 2c 42 47 38 4b 50 32 30 30 30 30
> 30 32 2c 43 79 62
>    0.762752      65 72 50 6f 77 65 72 20 53 79 73 74 65 6d 73 20 49 6e 63
> 2e 2c 2c 2c
>    0.762771     CyberPower UPS with text protocol on /dev/ttyUSB0 detected

that's a good sign.

>    0.762792     send_to_all: SETINFO device.type "ups"
>    0.762814     send_to_all: SETINFO driver.version "2.7.4"
>    0.762819     send_to_all: SETINFO driver.version.internal "0.27"
>    0.762828     send_to_all: SETINFO driver.name "powerpanel"
>    0.762833     send_to_all: SETINFO ups.mfr "CyberPower"
>    0.762837     send_to_all: SETINFO ups.model "[unknown]"
>    0.762842     send_to_all: SETINFO ups.serial "[unknown]"
>    0.762847     send_to_all: SETINFO ups.delay.start "60"
>    0.762852     send_to_all: SETINFO ups.delay.shutdown "60"
>    0.762858     send_to_all: SETINFO ups.model "BRG1350AVRLCD"
>    0.762863     send_to_all: SETINFO ups.firmware "BF01401BA31"
>    0.762868     send_to_all: SETINFO ups.serial "BG8KP2000002"
>    0.762872     send_to_all: SETINFO ups.mfr "CyberPower Systems Inc."
>    0.913265     send: (3 bytes) => 50 33 0d
>    1.013433     read: (16 bytes) => 23 31 32 2c 32 78 31 2c 31 32 2c 30 2c
> 33 2c 38
>    1.013449     send_to_all: SETINFO battery.voltage.nominal "12"
>    1.013468     send_to_all: SETINFO battery.packs "2"
>    1.013473     send_to_all: SETINFO battery.capacity "12"
>    1.163985     send: (3 bytes) => 50 32 0d
>    1.264124     read: (24 bytes) => 23 31 33 35 30 2c 38 31 30 2c 31 32 30
> 2c 35 37 2c 36
>    1.264136      33 2c 31 31 2e 33
>    1.264144     send_to_all: SETINFO ups.power.nominal "1350"
>    1.264164     send_to_all: SETINFO ups.realpower.nominal "810"
>    1.264169     send_to_all: SETINFO input.voltage.nominal "120"
>    1.264174     send_to_all: SETINFO input.frequency.low "57"
>    1.264179     send_to_all: SETINFO input.frequency.high "63"
>    1.414690     send: (3 bytes) => 50 31 0d
>    1.514887     read: (18 bytes) => 23 31 32 30 2c 31 32 39 2c 31 30 33 2c
> 30 2c 33 30 30
>    1.514903     send_to_all: SETINFO input.transfer.high "129"
>    1.514921     send_to_all: SETINFO input.transfer.low "103"
>    1.514926     send_to_all: SETINFO battery.charge.low "0"
>    1.514943     send_to_all: ADDCMD test.battery.start.quick
>    1.514948     send_to_all: ADDCMD test.battery.stop
>    1.514967     send_to_all: ADDCMD beeper.enable
>    1.514972     send_to_all: ADDCMD beeper.disable
>    1.514977     send_to_all: ADDCMD beeper.on
>    1.514981     send_to_all: ADDCMD beeper.off
>    1.514986     send_to_all: ADDCMD shutdown.stop
>    1.665448     send: (3 bytes) => 50 36 0d
>    1.765626     read: (8 bytes) => 23 31 32 39 2b 31 2a 36
>    1.765639     send_to_all: SETFLAGS input.transfer.high RW
>    1.765659     send_to_all: ADDENUM input.transfer.high "129"
>    1.916165     send: (3 bytes) => 50 37 0d
>    2.016345     read: (7 bytes) => 23 39 37 2b 31 2a 36
>    2.016359     send_to_all: SETFLAGS input.transfer.low RW
>    2.016380     send_to_all: ADDENUM input.transfer.low "97"
>    2.166804     send: (3 bytes) => 50 38 0d
>    2.267000     read: (3 bytes) => 23 2d 33
>    2.267029     send_to_all: SETFLAGS battery.charge.low RW
>    2.267035     send_to_all: ADDENUM battery.charge.low "-3"

that looks wrong but minor.

>    2.417484     send: (3 bytes) => 50 35 0d
>    2.517639     read: (4 bytes) => 23 31 32 30
>    2.668106     send: (3 bytes) => 50 39 0d
>    2.768317     read: (4 bytes) => 23 de d7 c0
>    2.868582     send: (2 bytes) => 43 0d
>    2.968682     read: (4 bytes) => 23 2d 31 30
>    2.968709     send_to_all: ADDCMD shutdown.return
>    2.968714     send_to_all: ADDCMD shutdown.stayoff
>    2.968719     send_to_all: ADDCMD shutdown.reboot
>    3.069074     send: (2 bytes) => 44 0d
>    3.269214     read: (35 bytes) => 23 49 31 31 38 2e 39 4f 31 31 38 2e 39
> 4c 39 42 31 30
>    3.269241      30 56 32 37 2e 36 46 36 30 2e 30 48 46 36 30 2e 30
>    3.519628     read: timeout
>    3.519661       \_: (23 bytes) => 52 31 34 31 51 30 2e 35 53 80 84 c0 88
> 80 57 00 0d 00
>    3.519666      00 00 00 00 00
>    3.519670     Communications with UPS lost: Status read failed!

looks like the read timeout is very much too aggressive.

>    3.519740     dstate_init: sock /run/nut/powerpanel-cyberpower open on fd
> 5
>    3.519758     send_to_all: SETINFO driver.parameter.pollinterval "2"
>    3.519763     send_to_all: SETINFO driver.parameter.synchronous "no"
>    3.519768     send_to_all: SETINFO device.mfr "CyberPower Systems Inc."
>    3.519772     send_to_all: SETINFO device.model "BRG1350AVRLCD"
>    3.519776     send_to_all: SETINFO device.serial "BG8KP2000002"
>    3.620077     send: (2 bytes) => 44 0d
>    3.820259     read: (35 bytes) => 23 49 31 31 38 2e 39 4f 31 31 38 2e 39
> 4c 37 42 31 30
>    3.820286      30 56 32 37 2e 36 46 36 30 2e 30 48 46 36 30 2e 30
>    4.070655     read: timeout
>    4.070686       \_: (23 bytes) => 52 36 30 51 30 2e 36 53 80 84 c0 88 80
> 57 00 0d 00 00
>    4.070690      00 00 00 00 00
>    4.070696     Communications with UPS lost: Status read failed!
>    5.620922     send: (2 bytes) => 44 0d
>    5.821119     read: (35 bytes) => 23 49 31 31 38 2e 38 4f 31 31 38 2e 38
> 4c 39 42 31 30
>    5.821130      30 56 32 37 2e 36 46 36 30 2e 30 48 46 36 30 2e 30
>    6.071446     read: timeout
>    6.071489       \_: (23 bytes) => 52 31 33 32 51 30 2e 35 53 80 84 c0 88
> 80 57 00 0d 00
>    6.071508      00 00 00 00 00
>    6.071512     Communications with UPS lost: Status read failed!
>    7.622016     send: (2 bytes) => 44 0d
>    7.822199     read: (35 bytes) => 23 49 31 31 38 2e 38 4f 31 31 38 2e 38
> 4c 39 42 31 30
>    7.822211      30 56 32 37 2e 36 46 36 30 2e 30 48 46 36 30 2e 30
>    8.072581     read: timeout
>    8.072613       \_: (23 bytes) => 52 31 32 37 51 30 2e 35 53 80 84 c0 88
> 80 57 00 0d 00
>    8.072618      00 00 00 00 00
>    8.072623     Communications with UPS lost: Status read failed!
> ^C

Overall, you may be running into driver bugs that others have fixed
already.  Get on git master and try again.  Learn to use -D on the
driver.   Then ask again with what you've learned.


-------------- next part --------------
#!/bin/sh

export PYTHON=/usr/pkg/bin/python3.10
export MAKE=make
# \todo Make optional.
#PAR="-j6"

export V=1

PATH=/home/gdt/bin/ccache:$PATH

sudo rm -rf BUILD DESTDIR OUT.*
mkdir BUILD DESTDIR

# nut-scanner has dups
find . -name \*.[ch] | egrep -v nut-scanner | etags -

time ./autogen.sh > OUT.00.autogen 2>&1

(cd BUILD &&

     # Try to match pgksrc.
     CPPFLAGS=-I/usr/pkg/include \
	     LDFLAGS="-L/usr/pkg/lib -Wl,-R/usr/pkg/lib" \
	     time ../configure --prefix=/usr/pkg \
	     --prefix=/usr/pkg \
	     --with-drvpath=/usr/pkg/libexec/nut \
	     --with-pidpath=/var/db/nut \
	     --with-altpidpath=/var/db/nut \
	     --with-user=nut --with-group=nut \
 	     --with-doc=man \
	     --without-python2 \
	     --with-python=${PYTHON} \
	 > ../OUT.01.configure 2>&1 &&
     time ${MAKE} ${PAR} \
	  > ../OUT.10.make 2>&1 &&
     time ${MAKE} ${PAR} \
	  check > ../OUT.20.check 2>&1 &&
     time ${MAKE} ${PAR} DESTDIR=/home/gdt/SOFTWARE/IOT/nut/DESTDIR install \
	  > ../OUT.30.install 2>&1 &&

     # distcheck-light
     CPPFLAGS=-I/usr/pkg/include \
	     LDFLAGS="-L/usr/pkg/lib -Wl,-R/usr/pkg/lib" \
	     time ${MAKE} ${PAR} dist \
	     > ../OUT.40.dist 2>&1 &&

     (cp -p nut-*.tar.gz /usr/pkgsrc/distfiles;
      if [ "$PUBLISH" = yes ]; then
	  ./_publish
      fi)
)


More information about the Nut-upsuser mailing list