networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.13k stars 355 forks source link

Data stale Powerwalker Powerwalker VI 2200 SHL on Proxmox #1853

Closed MarvinMynx closed 1 year ago

MarvinMynx commented 1 year ago

PowerWalker VI 2200 SHL OS: Proxmox - Debian GNU/Linux 11 (bullseye)

upsd -v

Network UPS Tools upsd 2.7.4

uname -a

Linux pve 5.15.83-1-pve #1 SMP PVE 5.15.83-1 (2022-12-15T00:00Z) x86_64 GNU/Linux

I have a problem with my UPS. After some time, it sort of Disconnects and as a result the Driver times out or something. I don't quite understand the Problem. It's my first time debugging/configuring a USB Device / UPS. I have many Config Files and Log Messages that hopefully describe the Problem better than I can. And I have made some Screenshots from the Last time this happened Today. (This happens Multiple Times a Day)

First Image: DATA STALE image_2023-02-21_13-12-45 image_2023-02-21_13-14-02

Second Image: Reconnect to Temporarily get Rid of the Error image_2023-02-21_13-14-45

lsusb | grep -i ups

Bus 001 Device 006: ID 06da:ffff Phoenixtec Power Co., Ltd Offline UPS

upsc powerwalker

Init SSL without certificate database
battery. Charge: 100
battery.runtime: 3290
battery.type: PbAc
device.mfr: PPC
device.model: Offline UPS HID UPS
device.serial: 000000000
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 1
driver.parameter.port: auto
driver.parameter.productid: FFFF
driver.parameter.synchronous: no
driver.parameter.vendorid: 06DA
driver.version: 2.7.4
driver.version.data: MGE HID 1.40
driver.version.internal: 0.41
input.voltage: 235.0
outlet.1.status: on
output.frequency: 49.6
output.frequency.nominal: 50
output.voltage: 235.0
output.voltage.nominal: 230
ups.beeper.status: enabled
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 1
ups.mfr: PPC
ups.model: Offline UPS HID UPS
ups.power.nominal: 9
ups.productid: ffff
ups.serial: 000000000
ups.status: OL
ups.test.result: No test initiated
ups.timer.shutdown: 0
ups.timer.start: 0
ups.type: offline / line interactive
ups.vendorid: 06da

upscmd -l powerwalker

Instant commands supported on UPS [powerwalker]:

beeper.disable - Disable the UPS beeper
beeper.enable - Enable the UPS beeper
beeper.mute - Temporarily mute the UPS beeper
beeper.off - Obsolete (use beeper.disable or beeper.mute)
beeper.on - Obsolete (use beeper.enable)
load.off - Turn off the load immediately
load.off.delay - Turn off the load with a delay (seconds)
load.on - Turn on the load immediately
load.on.delay - Turn on the load with a delay (seconds)
shutdown.return - Turn off the load and return when power is back
shutdown.stayoff - Turn off the load and remain off
shutdown.stop - Stop a shutdown in progress
test.battery.start.deep - Start a deep battery test
test.battery.start.quick - Start a quick battery test
test.battery.stop - Stop the battery test

upsrw powerwalker

[output.voltage.nominal]
Nominal output voltage (V)
Type: ENUM
Option: "200"
Option: "208"
Option: "220"
Option: "230" SELECTED
Option: "240"

[ups.delay.shutdown]
Interval to wait after shutdown with delay command (seconds)
Type: STRING
Maximum length: 10
Value: 20

[ups.delay.start]
Interval to wait before (re)starting the load (seconds)
Type: STRING
Maximum length: 10
Value: 30

usbhid-dump -a 001:006

001:006:000:Failed to claim: Resource busy
001:006:000:Failed to release: Entity not found

/lib/nut/usbhid-ups -DD -a powerwalker

 15.797844     Checking device (1D6B/0002) (003/001)
  15.798149     - VendorID: 1d6b
  15.798156     - ProductID: 0002
  15.798159     - Manufacturer: unknown
  15.798162     - Product: unknown
  15.798164     - Serial Number: unknown
  15.798167     - Bus: 003
  15.798170     - Device release number: 0515
  15.798173     Trying to match device
  15.798178     Device does not match - skipping
  15.798188     Checking device (0BC2/AB34) (002/002)
  15.798212     - VendorID: 0bc2
  15.798218     - ProductID: ab34
  15.798224     - Manufacturer: unknown
  15.798230     - Product: unknown
  15.798235     - Serial Number: unknown
  15.798241     - Bus: 002
  15.798247     - Device release number: 0100
  15.798252     Trying to match device
  15.798259     Device does not match - skipping
  15.798268     Checking device (1D6B/0003) (002/001)
  15.798287     - VendorID: 1d6b
  15.798292     - ProductID: 0003
  15.798298     - Manufacturer: unknown
  15.798304     - Product: unknown
  15.798311     - Serial Number: unknown
  15.798316     - Bus: 002
  15.798322     - Device release number: 0515
  15.798328     Trying to match device
  15.798335     Device does not match - skipping
  15.798344     Checking device (06DA/FFFF) (001/006)
  15.803080     - VendorID: 06da
  15.803087     - ProductID: ffff
  15.803093     - Manufacturer: PPC
  15.803098     - Product: Offline UPS
  15.803104     - Serial Number: 000000000
  15.803110     - Bus: 001
  15.803115     - Device release number: 0003
  15.803121     Trying to match device
  15.803132     Device matches
  15.803141     failed to claim USB device: could not claim interface 0: Device or resource busy
  15.803172     detached kernel driver from USB device...
  15.803625     Path: UPS.PowerSummary.RemainingCapacity, Type: Feature, ReportID: 0x06, Offset: 0, Size: 8, Value: 100
  15.803659     Path: UPS.PowerSummary.RunTimeToEmpty, Type: Feature, ReportID: 0x06, Offset: 8, Size: 16, Value: 3290
  15.804142     Path: UPS.PowerSummary.iDeviceChemistry, Type: Feature, ReportID: 0x10, Offset: 0, Size: 8, Value: 5
  15.805872     Path: UPS.PowerSummary.Voltage, Type: Feature, ReportID: 0x07, Offset: 8, Size: 16, Value: 27.2
  15.805950     Path: UPS.PowerSummary.PercentLoad, Type: Feature, ReportID: 0x07, Offset: 0, Size: 8, Value: 1
  15.806477     Path: UPS.PowerSummary.DelayBeforeStartup, Type: Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: 0
  15.806998     Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, ReportID: 0x09, Offset: 0, Size: 32, Value: 0
  15.807010     Path: UPS.PowerSummary.DelayBeforeStartup, Type: Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: 0
  15.807018     Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, ReportID: 0x09, Offset: 0, Size: 32, Value: 0
  15.807659     Path: UPS.BatterySystem.Battery.Test, Type: Feature, ReportID: 0x24, Offset: 0, Size: 8, Value: 6
  15.808127     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 2
  15.808658     Path: UPS.Flow.[4].ConfigApparentPower, Type: Feature, ReportID: 0x74, Offset: 0, Size: 16, Value: 9
  15.809243     Path: UPS.PowerConverter.ConverterType, Type: Feature, ReportID: 0x4a, Offset: 0, Size: 8, Value: 1
  15.809916     Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, ReportID: 0x01, Offset: 0, Size: 8, Value: 1
  15.809946     Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Feature, ReportID: 0x01, Offset: 24, Size: 8, Value: 0
  15.809951     Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, ReportID: 0x01, Offset: 16, Size: 8, Value: 1
  15.809960     Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, ReportID: 0x01, Offset: 8, Size: 8, Value: 0
  15.809986     Path: UPS.PowerSummary.PresentStatus.Overload, Type: Feature, ReportID: 0x01, Offset: 48, Size: 8, Value: 0
  15.810665     Path: UPS.PowerConverter.Input.[1].PresentStatus.Buck, Type: Feature, ReportID: 0x2d, Offset: 8, Size: 8, Value: 0
  15.810673     Path: UPS.PowerConverter.Input.[1].PresentStatus.Boost, Type: Feature, ReportID: 0x2d, Offset: 0, Size: 8, Value: 0
  15.810699     Path: UPS.PowerSummary.PresentStatus.Good, Type: Feature, ReportID: 0x01, Offset: 32, Size: 8, Value: 1
  15.810774     Path: UPS.PowerSummary.PresentStatus.InternalFailure, Type: Feature, ReportID: 0x01, Offset: 40, Size: 8, Value: 0
  15.811346     Path: UPS.PowerConverter.Input.[1].Voltage, Type: Feature, ReportID: 0x31, Offset: 0, Size: 16, Value: 236
  15.812157     Path: UPS.PowerConverter.Output.Voltage, Type: Feature, ReportID: 0x42, Offset: 16, Size: 16, Value: 236
  15.812608     Path: UPS.Flow.[4].ConfigVoltage, Type: Feature, ReportID: 0x72, Offset: 0, Size: 8, Value: 230
  15.812649     Path: UPS.PowerConverter.Output.Frequency, Type: Feature, ReportID: 0x42, Offset: 0, Size: 16, Value: 49.6
  15.813108     Path: UPS.Flow.[4].ConfigFrequency, Type: Feature, ReportID: 0x36, Offset: 0, Size: 8, Value: 50
  15.813211     Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, ReportID: 0x01, Offset: 0, Size: 8, Value: 1
  15.813462     Path: UPS.BatterySystem.Battery.Test, Type: Feature, ReportID: 0x24, Offset: 0, Size: 8, Value: 6
  15.813471     Path: UPS.BatterySystem.Battery.Test, Type: Feature, ReportID: 0x24, Offset: 0, Size: 8, Value: 6
  15.813479     Path: UPS.BatterySystem.Battery.Test, Type: Feature, ReportID: 0x24, Offset: 0, Size: 8, Value: 6
  15.813485     Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, ReportID: 0x09, Offset: 0, Size: 32, Value: 0
  15.813489     Path: UPS.PowerSummary.DelayBeforeStartup, Type: Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: 0
  15.813493     Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, ReportID: 0x09, Offset: 0, Size: 32, Value: 0
  15.813502     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 2
  15.813505     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 2
  15.813509     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 2
  15.813513     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 2
  15.813517     Path: UPS.PowerSummary.AudibleAlarmControl, Type: Feature, ReportID: 0x13, Offset: 0, Size: 8, Value: 2
  16.064353     libusb_get_interrupt: Connection timed out
  16.064367     Got 0 HID objects...
  16.064374     Quick update...
  16.064893     Path: UPS.PowerSummary.DelayBeforeStartup, Type: Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: 0
  16.065300     Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, ReportID: 0x09, Offset: 0, Size: 32, Value: 0
  16.065896     Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, ReportID: 0x01, Offset: 0, Size: 8, Value: 1
  16.065908     Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Feature, ReportID: 0x01, Offset: 24, Size: 8, Value: 0
  16.065918     Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, ReportID: 0x01, Offset: 16, Size: 8, Value: 1
  16.065927     Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, ReportID: 0x01, Offset: 8, Size: 8, Value: 0
  16.679086     upsdrv_updateinfo...
  16.930313     libusb_get_interrupt: Connection timed out
  16.930327     Got 0 HID objects...
  16.930331     Quick update...
  16.930338     Path: UPS.PowerSummary.DelayBeforeStartup, Type: Feature, ReportID: 0x0a, Offset: 0, Size: 32, Value: 0
  16.930343     Path: UPS.PowerSummary.DelayBeforeShutdown, Type: Feature, ReportID: 0x09, Offset: 0, Size: 32, Value: 0
  16.930348     Path: UPS.PowerSummary.PresentStatus.ACPresent, Type: Feature, ReportID: 0x01, Offset: 0, Size: 8, Value: 1
  16.930353     Path: UPS.PowerSummary.PresentStatus.Discharging, Type: Feature, ReportID: 0x01, Offset: 24, Size: 8, Value: 0
  16.930362     Path: UPS.PowerSummary.PresentStatus.Charging, Type: Feature, ReportID: 0x01, Offset: 16, Size: 8, Value: 1
  16.930369     Path: UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit, Type: Feature, ReportID: 0x01, Offset: 8, Size: 8, Value: 0
  17.679955     upsdrv_updateinfo...
  17.680597     libusb_get_interrupt: error submitting URB: Device or resource busy
  17.680606     Got disconnected by another driver: Device or resource busy
  18.681073     upsdrv_updateinfo...
  18.681087     Got to reconnect!

cat /etc/nut/hosts.conf

MONITOR powerwalker@localhost "Powerwalker VI 2200 SHL UPS"

cat /etc/nut/nut.conf

MODE=netserver

cat /etc/nut/ups.conf

pollinterval = 1
maxretry = 3

[powerwalker]
    driver = usbhid-ups
    port = auto
    desc = "Powerwalker VI 2200 SHL UPS"
    vendorid = 06DA
    productid = FFFF

cat /etc/nut/upsd.conf

LISTEN 0.0.0.0 3493

cat /etc/nut/upsd.users

[monuser]
  password = <Password reducted>
  admin master

cat /etc/nut/upsmon.conf

MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD /usr/sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYMSG ONLINE        "UPS %s on line power"
NOTIFYMSG ONBATT        "UPS %s on battery"
NOTIFYMSG LOWBATT       "UPS %s battery is low"
NOTIFYMSG FSD           "UPS %s: forced shutdown in progress"
NOTIFYMSG COMMOK        "Communications with UPS %s established"
NOTIFYMSG COMMBAD       "Communications with UPS %s lost"
NOTIFYMSG SHUTDOWN      "Auto logout and shutdown proceeding"
NOTIFYMSG REPLBATT      "UPS %s battery needs to be replaced"
NOTIFYMSG NOCOMM        "UPS %s is unavailable"
NOTIFYMSG NOPARENT      "upsmon parent process died - shutdown impossible"
NOTIFYFLAG ONLINE   SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT   SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT  SYSLOG+WALL
NOTIFYFLAG FSD      SYSLOG+WALL+EXEC
NOTIFYFLAG COMMOK   SYSLOG+WALL+EXEC
NOTIFYFLAG COMMBAD  SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT SYSLOG+WALL
NOTIFYFLAG NOCOMM   SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT SYSLOG+WALL
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
RUN_AS_USER root
MONITOR powerwalker@localhost 1 admin <Password reducted> master

cat /etc/nut/upssched.conf

CMDSCRIPT /etc/nut/upssched-cmd
PIPEFN /etc/nut/upssched.pipe
LOCKFN /etc/nut/upssched.lock
AT ONBATT * START-TIMER onbatt 30
AT ONLINE * CANCEL-TIMER onbatt online
AT ONBATT * START-TIMER earlyshutdown 30
AT LOWBATT * EXECUTE onbatt
AT COMMBAD * START-TIMER commbad 30
AT COMMOK * CANCEL-TIMER commbad commok
AT NOCOMM * EXECUTE commbad
AT SHUTDOWN * EXECUTE powerdown
AT SHUTDOWN * EXECUTE powerdown

cat /etc/nut/upssched-cmd

#!/bin/sh
 case $1 in
       onbatt)
          logger -t upssched-cmd "UPS running on battery"
          ;;
       earlyshutdown)
          logger -t upssched-cmd "UPS on battery too long, early shutdown"
          /usr/sbin/upsmon -c fsd
          ;;
       shutdowncritical)
          logger -t upssched-cmd "UPS on battery critical, forced shutdown"
          /usr/sbin/upsmon -c fsd
          ;;
       upsgone)
          logger -t upssched-cmd "UPS has been gone too long, can't reach"
          ;;
       *)
          logger -t upssched-cmd "Unrecognized command: $1"
          ;;
 esac

I needed this udev Rule because otherwise the Server would not Boot up and dmesg would be full of USB Reconnects every 10 Seconds.

cat /etc/udev/rules.d/99-nut-ups.rule

SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end"

# Powerwalker
#  e.g. Powerwalker VI 2200 SHL UPS - usbhid-ups
ACTION=="add|change", SUBSYSTEM=="usb|usb_device", SUBSYSTEMS=="usb|usb_device", ATTR{idVendor}=="06da", ATTR{idProduct}=="ffff", MODE="664", GROUP="nut", RUN+="/sbin/upsdrvctl stop; /sbin/upsdrvctl start"

LABEL="nut-usbups_rules_end"

I hope someone can help me diagnose this problem so I can use my UPS reliably.

jimklimov commented 1 year ago

Odd, just realized that debian/rules does specify --prefix= (empty) and so --libdir=\${prefix}/lib/$(DEB_HOST_MULTIARCH) would resolve to /lib/... indeed.

Other than that, I tried to reproduce your situation with a freshly installed Proxmox 7.3-1 into a VM, with disabled "enterprise" repo I don't have access to:

root@pve:~# uname -a
Linux pve 5.15.74-1-pve #1 SMP PVE 5.15.74-1 (Mon, 14 Nov 2022 20:17:15 +0100) x86_64 GNU/Linux

root@pve:~# mv /etc/apt/sources.list.d/pve-enterprise.list{,.bak}

And added these packages following your posts above, which are a subset of suggestions in config-prereq.txt:

:; apt-get update
:; apt-get install ccache time git python perl curl make autoconf automake \
    libltdl-dev libtool-bin libtool valgrind cppcheck pkg-config gcc g++ clang \
    python3 python3.9 aspell-en asciidoc source-highlight python3-pygments dblatex \
    libgd-dev libsystemd-dev libcppunit-dev libssl-dev libnss3-dev augeas-tools \
    libaugeas-dev augeas-lenses libusb-dev libusb-1.0-0-dev libi2c-dev libmodbus-dev \
    libsnmp-dev 

Then I added

:; apt-get install lua5.1-dev bash dash ksh busybox # libneon27-dev

from your subsequent post. With their current offering, neither version of libneon27-dev or libneon27-gnutls-dev was installable due to conflict between available versions of comerr-dev/libcom-err2 which they pull in.

Finally I added a non-root user and ran the build+check command from your recent post (note: before installing any NUT packages for the first shot):

git clone https://github.com/networkupstools/nut
cd nut
./autogen.sh
./configure --enable-inplace-runtime --prefix= \
                         --sysconfdir=/etc/nut \
                         --includedir=/usr/include \
                 --mandir=/usr/share/man \
                 --libexecdir=/usr/libexec \
                         --with-statepath=/run/nut \
                         --with-altpidpath=/run/nut \
                         --with-drvpath=/lib/nut \
                         --with-cgipath=/usr/lib/cgi-bin/nut \
                         --with-htmlpath=/usr/share/nut/www \
                         --with-pidpath=/run/nut \
                         --datadir=/usr/share/nut \
                         --with-user=nut --with-group=nut \
                         --with-udev-dir=/lib/udev \
                 --with-systemdsystemunitdir=/lib/systemd/system \
                         --with-systemdshutdowndir=/lib/systemd/system-shutdown \
                 --with-systemdtmpfilesdir=/usr/lib/tmpfiles.d \
                         --with-ssl \
                         --with-cgi \
                         --with-pkgconfig-dir=/usr/lib/x86_64-linux-gnu/pkgconfig \
                         --libdir=/usr/lib/x86_64-linux-gnu
make -j 4 all check

...which gave this configuration:

NUT Configuration summary:
==========================

* configured version:   2.8.0.1 (v2.8.0-Windows-568-gf813c1404)
* build serial drivers: yes
* build USB drivers:    yes (libusb-1.0)
* build neon based XML driver:  no
* enable Avahi support: no
* build Powerman PDU client driver:     no
* build Modbus driver:  yes
* build IPMI driver:    no
* build Mac OS X meta-driver:   no
* build i2c based drivers:      yes
* enable SSL support:   yes (OpenSSL)
* enable libwrap (tcp-wrappers) support:        yes
* enable libltdl (Libtool dlopen abstraction) support:  yes
* build nut-scanner:    yes
* build CGI programs:   yes
* install NUT-Monitor desktop application:      no
* install PyNUT binding module: yes
* use default  Python  interpreter:     /usr/bin/python
* use specific Python2 interpreter:     /usr/bin/python2.7
* use specific Python3 interpreter:     /usr/bin/python3
* build and install documentation:      man=auto
* build specific documentation format(s):       yes  man
* build and install the development files:      no
* consider basic SMF support:   no
* consider basic systemd support:       yes
* build with tighter systemd support:   yes
* build C++11 codebase (client library, etc.):  yes
* build C++ tests with CPPUNIT: yes
* build SNMP drivers:   yes
* build SNMP drivers with statically linked lib(net)snmp:       no
* User to run as:       nut
* Group of user to run as:      nut

NUT Paths:
----------

* Default installation prefix path:
* State file path:      /run/nut
* Unprivileged PID file path:   /run/nut
* Privileged PID file path:     /run/nut
* Driver program path:  /lib/nut
* CGI program path:     /usr/lib/cgi-bin/nut
* HTML file path:       /usr/share/nut/www
* Config file path:     /etc/nut
* Data file path:       /usr/share/nut
* Tool program path:    /bin
* System program path:  /sbin
* System library path:  /usr/lib/x86_64-linux-gnu
* System exec-library path:     /usr/libexec

NUT Paths for third-party integrations:
---------------------------------------

* Default  Python  interpreter site-packages:   /usr/local/lib/python2.7/dist-packages
* Specific Python2 interpreter site-packages:   /usr/local/lib/python2.7/dist-packages
* Specific Python3 interpreter site-packages:   /usr/local/lib/python3.9/dist-packages
* pkg-config *.pc directory:    /usr/lib/x86_64-linux-gnu/pkgconfig => /usr/lib/x86_64-linux-gnu/pkgconfig
* Service units for systemd:    /lib/systemd/system
* Shutdown hooks for systemd:   /lib/systemd/system-shutdown
* Systemd-tmpfiles configs:     /usr/lib/tmpfiles.d
* Augeas lenses directory:      /usr/share/augeas/lenses/dist
* Udev rules directory: /lib/udev

NUT Build/Target system info:
-----------------------------

* Compact version of C compiler:        gcc (Debian 10.2.1-6) 10.2.1 20210110
* Compact version of C++ compiler:      g++ (Debian 10.2.1-6) 10.2.1 20210110
* Compact version of C preprocessor:    gcc (Debian 10.2.1-6) 10.2.1 20210110
* host env spec we run on:      x86_64-pc-linux-gnu
* host env spec we built on:    x86_64-pc-linux-gnu
* host env spec we built for:   x86_64-pc-linux-gnu
* host OS short spec we run on: x86_64-linux-gnu
* host OS short spec we built on:       x86_64-linux-gnu
* host OS short spec we built for:      x86_64-linux-gnu

NUT Compiler settings:
----------------------

* CC            : gcc
* CFLAGS        : -isystem /usr/local/include -g -O2 -Wno-reserved-identifier -Wno-unknown-warning-option -std=gnu99 -Wno-system-headers -Wall -Wextra -Wsign-compare -pedantic -Wno-error
* CXX           : g++
* CXXFLAGS      : -isystem /usr/local/include -g -O2 -Wno-reserved-identifier -Wno-unknown-warning-option -std=gnu++11 -Wno-system-headers -Wall -Wextra -Wno-error
* CPP           : gcc -E
* CPPFLAGS      :
* CONFIG_FLAGS  : --prefix= --sysconfdir=/etc/nut --includedir=/usr/include --mandir=/usr/share/man --libexecdir=/usr/libexec --with-statepath=/run/nut --with-altpidpath=/run/nut --with-drvpath=/lib/nut --with-cgipath=/usr/lib/cgi-bin/nut --with-htmlpath=/usr/share/nut/www --with-pidpath=/run/nut --datadir=/usr/share/nut --with-user=nut --with-group=nut --with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system --with-systemdshutdowndir=/lib/systemd/system-shutdown --with-systemdtmpfilesdir=/usr/lib/tmpfiles.d --with-ssl --with-cgi --with-pkgconfig-dir=/usr/lib/x86_64-linux-gnu/pkgconfig --libdir=/usr/lib/x86_64-linux-gnu --enable-inplace-runtime

...and "sort of" succeeded: no complaints posted in the end of log (gotta check the wall of text in more detail), but indeed make finished after all and with an exit-code 2 (Ctrl+C equivalent), without running the check part. Re-running the same make -j 4 all check line got it to check things. I suspect some issue either with the version of make which Proxmox (or Debian proper) ships, possibly with GNU Make itself (can't reproduce with BSD and Sun makes, for example), or autotools version that generates the makefiles, or potentially with our Makefile.am interactions (maybe some dependency needed for check to be scheduled properly either got broken with some recent iterations, and/or two copies of parallel make try to build and shuffle same files for two goals).

Either way, just running make -j 4 all succeeds, as does subsequent make -j 4 check. So for the time being, amend that part to make -j 4 all && make -j 4 check and I'll investigate the multi-goal behavior on Linux+GNUmake when I have time. I think CI builds each major target separately so such mis-behavior was not noticed anywhere before.

jimklimov commented 1 year ago

Now, trying to install NUT packages (I am not sure if you pulled the nut umbrella only, or additional packages, or just some of the core ones) to configure an "in-place" build later. Output of their packaging looks quirky out of the box:

:; apt-get install nut
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  freeipmi-common libavahi-core7 libdbus-1-dev libfreeipmi17 libipmimonitoring6 libpowerman0
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
  libnutscan1 libupsclient4 nut-client nut-server
Suggested packages:
  nut-monitor nut-cgi nut-ipmi nut-snmp nut-xml
The following NEW packages will be installed:
  libnutscan1 libupsclient4 nut nut-client nut-server
0 upgraded, 5 newly installed, 0 to remove and 23 not upgraded.
Need to get 1,759 kB of archives.
After this operation, 6,803 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.cz.debian.org/debian bullseye/main amd64 libupsclient4 amd64 2.7.4-13 [186 kB]
Get:2 http://ftp.cz.debian.org/debian bullseye/main amd64 nut-client amd64 2.7.4-13 [252 kB]
Get:3 http://ftp.cz.debian.org/debian bullseye/main amd64 libnutscan1 amd64 2.7.4-13 [192 kB]
Get:4 http://ftp.cz.debian.org/debian bullseye/main amd64 nut-server amd64 2.7.4-13 [881 kB]
Get:5 http://ftp.cz.debian.org/debian bullseye/main amd64 nut all 2.7.4-13 [247 kB]
Fetched 1,759 kB in 6s (283 kB/s)
Selecting previously unselected package libupsclient4:amd64.
(Reading database ... 121121 files and directories currently installed.)
Preparing to unpack .../libupsclient4_2.7.4-13_amd64.deb ...
Unpacking libupsclient4:amd64 (2.7.4-13) ...
Selecting previously unselected package nut-client.
Preparing to unpack .../nut-client_2.7.4-13_amd64.deb ...
Unpacking nut-client (2.7.4-13) ...
Selecting previously unselected package libnutscan1:amd64.
Preparing to unpack .../libnutscan1_2.7.4-13_amd64.deb ...
Unpacking libnutscan1:amd64 (2.7.4-13) ...
Selecting previously unselected package nut-server.
Preparing to unpack .../nut-server_2.7.4-13_amd64.deb ...
Unpacking nut-server (2.7.4-13) ...
Selecting previously unselected package nut.
Preparing to unpack .../archives/nut_2.7.4-13_all.deb ...
Unpacking nut (2.7.4-13) ...
Setting up libnutscan1:amd64 (2.7.4-13) ...
Setting up libupsclient4:amd64 (2.7.4-13) ...
Setting up nut-client (2.7.4-13) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nut-monitor.service → /lib/systemd/system/nut-monitor.service.
Job for nut-monitor.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status nut-monitor.service" and "journalctl -xe" for details.
Setting up nut-server (2.7.4-13) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nut-server.service → /lib/systemd/system/nut-server.service.
nut-driver.service is a disabled or a static unit, not starting it.
Setting up nut (2.7.4-13) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.31-13+deb11u5) ...

They suggest a nut-monitor package which does not exist: the nut-client takes its place to deliver the nut-monitor service for upsmon, which failed due to lack of configuration (kinda expected out of the box), so lots of scary letters validly:

...
Setting up nut-client (2.7.4-13) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nut-monitor.service → /lib/systemd/system/nut-monitor.service.
Job for nut-monitor.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status nut-monitor.service" and "journalctl -xe" for details.
...

:; systemctl status nut-monitor.service
* nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
     Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor preset: enabled)
     Active: failed (Result: protocol) since Mon 2023-02-27 01:02:46 CET; 2min 30s ago
        CPU: 849us

Feb 27 01:02:46 pve systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...
Feb 27 01:02:46 pve upsmon[160966]: upsmon disabled, please adjust the configuration to your needs
Feb 27 01:02:46 pve upsmon[160966]: Then set MODE to a suitable value in /etc/nut/nut.conf to enable it
Feb 27 01:02:46 pve systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: Operation not permitted
Feb 27 01:02:46 pve systemd[1]: nut-monitor.service: Failed with result 'protocol'.
Feb 27 01:02:46 pve systemd[1]: Failed to start Network UPS Tools - power device monitor and shutdown controller.

Results of make clean ; ./configure --enable-inplace-runtime on this system were indeed weird, and different for root and unprivileged users, so indeed I have homework to tend to.

MarvinMynx commented 1 year ago

(I am not sure if you pulled the nut umbrella only, or additional packages, or just some of the core ones)

I've installed nut with the Following two Lines:

apt install nut nut-client nut-server
apt install apache2 nut-cgi
MarvinMynx commented 1 year ago
  • docs for "pollonly"

See usbhid-ups manpage, e.g. https://github.com/networkupstools/nut/blob/master/docs/man/usbhid-ups.txt It is just a flag setting (nothing to equate to) in an ups.conf section for the device, e.g.

[ups]
    driver = usbhid-ups
    port = auto
    pollonly
    # other options

I'm trying this now.

But this seems to Work out. Since I added this to my Config, I didn't see Data Stale or any Relevant Errors so far anymore.

jimklimov commented 1 year ago

Sounds promising! And that's with 2.7.4 remaining the installed version?

MarvinMynx commented 1 year ago

Sounds promising! And that's with 2.7.4 remaining the installed version?

yes.

jimklimov commented 1 year ago

Regarding in-place builds, I hope PR #1865 will fix the deficiencies found while investigating this thread - thanks for bringing that up.

MarvinMynx commented 1 year ago

No Problem :)

jimklimov commented 1 year ago

Can this ticket be closed then - as far as the original scope was to monitor more reliably with what NUT you have deployed, it is achieved by pollonly?

Ideas to build a newer NUT that may be even more resilient became a new and separate issue of sorts, and ultimately not an unavoidable and required step to solution "here and now"?

MarvinMynx commented 1 year ago

Yes, this Ticket can be Closed. Thank you very much, for all your Support.