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
1.99k stars 349 forks source link

Modbus driver on Proxmox #2235

Open Madfox8 opened 10 months ago

Madfox8 commented 10 months ago

Hello,

I've followed this tutorial (https://www.kreaweb.be/diy-home-server-2021-software-proxmox-ups/) to install NUT server on my Proxmox machine running 8.1.3. However with this method UPS load is not reported. Load is reported if I use apcupsd modbus, but I would like to use the nut network for staggered shutdown.

My UPS is a ACP smart-ups 750 230v. It can report load over power via modbus, but not with the suggested driver in NUT-server. I found there is a modbus driver via: https://networkupstools.org/docs/man/apc_modbus.html

The server works without the load reporting when driver = usbhid-ups is set. However, if I want to use driver = usbhid-ups the following error is given: root@pve:/lib/nut# upsdrvctl start Network UPS Tools - UPS driver controller 2.8.0 Can't start /lib/nut/generic_modbus: No such file or directory

How can I get the right driver to load in proxmox?

jimklimov commented 10 months ago

Looks like either your setup or their packaging (inherited from Debian, CC @bigon ?) is mixed up: it may not have updated the recipes to install the drivers build against libmodbus, or you needed to request it as a package dependency.

Also, with driver=usbhid-ups (if the second mention is not a typo) it should not be loading a generic_modbus.

Anyhow, generic_modbus is not apc_modbus, which in turn is part of NUT since v2.8.1. However, for USB-capable builds you would currently need a custom build of libmodbus and then of NUT against it: https://github.com/networkupstools/nut/wiki/APC-UPS-with-Modbus-protocol

Madfox8 commented 10 months ago

I was testing various things, including the generic_modbus driver. my mistake. The resulting output however was the same. thanks for the instructions, i'm going to try this, maybe in a vm instead of proxmox then.

jimklimov commented 10 months ago

At some point I did test USB pass-through for UPS connections, it seemed to work :) You may have to ensure the host OS does not barge into it however (e.g. does not have its copy of NUT driver running).

Also note that it can help for testing; but for ultimate production use, with integration to turn off the UPS late in emergency shutdown, a VM might not be the right spot to send such a command - its host may need some more minutes to complete other shutdown rituals.

Madfox8 commented 10 months ago

ah thanks for pointing that out... in that case i'm going the route of another system altogether (I think a raspberry pi running raspbian lite). I'll check in sometime later when proxmox might have a more workable update available.

jimklimov commented 10 months ago

As a Linux, it is perfectly capable of building and running a custom NUT, got one such setup "dogfeeding" in the NUT CI farm with a master-branch build protecting the PVE host. It is not with a custom libmodbus though, but that would not be something "too magical" to do (you may want to configure it with custom installation paths, like --prefix=/usr/local to avoid conflicts with system-provided one unless you intend them like with the NUT build).