-
-
Notifications
You must be signed in to change notification settings - Fork 395
Description
Hi to all
I've been trying to figure out for a few days what I'm doing wrong with the installation and subsequent setup of version 2.8.0. The result is the same every time.
At first, I even thought that the problem was in the riello_usb driver, that it had no parameters: bus, device, and so on. Even created a post about it - #1744. But then I found out that the package can work without them.
I believe that this post will be relevant to many people, because many problems that I have had to deal with, have not been written about anywhere. I used the search, but I did not find the answer, only by the method of my mistakes and reading the logs, I discovered the necessary actions to prevent problems with the NUT.
I have several UPSs connected to a Raspberry Pi4 4GB via USB. The installation was performed on a clean system by Buster. The only thing that I immediately changed for my needs was the Shell (tcsh), but I also used the default (bash). The behavior is as follows when I start it for the first time - everything works as it should: it finds both devices, drivers are connected, all services are started. But it is enough to reboot only once, as the struggle for the USB port immediately begins. Below I will show all the necessary data.
Immediately the question:
- Am I doing everything right when installing the package?
- Am I setting it up correctly to run NUT?
- Why does each driver "search" for the same port after system reboot?
First about the system.
cat /sys/firmware/devicetree/base/model
Raspberry Pi 4 Model B Rev 1.1
uname -a
Linux rasp4 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l GNU/Linux
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 04b4:5500 Cypress Semiconductor Corp. HID->COM RS232 Adapter
Bus 001 Device 003: ID 04b4:5500 Cypress Semiconductor Corp. HID->COM RS232 Adapter
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Models of my UPSs.
Name: Riello Sentinel Pro 1000 ER
Firmware: SWM073-01-00 & SWM073-01-01
ProductID: 5500
VendorID: 04b4
Next, I want to show step by step how I install and configure NUT. The type of instruction is similar to what is written in the Wiki, but a little easier (although I tried to install it as it was proposed).
1. Install packages:
apt-get update && apt-get install -y build-essential autoconf gettext libusb-dev libtool libgd-dev
2. Get 'nut-master':
wget https://github.com/networkupstools/nut/archive/refs/heads/master.zip
unzip master.zip
cd nut-master
3. Create new group 'nut':
groupadd --system nut
4. Create new user 'ups':
useradd --system --gid=nut --home-dir=/var/lib/nut --shell=/sbin/nologin ups
5. Configure and make source:
./autogen.sh
./configure --prefix=/ --includedir=/usr/include --mandir=/usr/share/man \
--infodir=/usr/share/info --sysconfdir=/etc/nut --localstatedir=/var \
--libexecdir=/usr/lib/nut --srcdir=. --enable-maintainer-mode \
--disable-silent-rules --libdir=/usr/lib/`gcc -print-multiarch` \
--with-cgi --enable-static --with-statepath=/var/run/nut \
--with-altpidpath=/var/run/nut --with-drvpath=/lib/nut \
--with-cgipath=/usr/lib/cgi-bin/nut --with-htmlpath=/usr/share/nut/www \
--with-pidpath=/var/run/nut --datadir=/usr/share/nut \
--with-pkgconfig-dir=/usr/lib/`gcc -print-multiarch`/pkgconfig \
--with-user=ups --with-group=nut --with-udev-dir=/lib/udev \
--with-systemdsystemunitdir=/lib/systemd/system
make
make install
6. Setup NUT.
6.1 Setup each file in '/etc/nut/*':
cp -p /etc/nut/nut.conf.sample /etc/nut/nut.conf
nano /etc/nut/nut.conf
MODE=netserver
cp -p /etc/nut/ups.conf.sample /etc/nut/ups.conf
nano /etc/nut/ups.conf
maxretry = 3
[riello1000]
driver = riello_usb
port = auto
desc = "Riello SEP 1000 ER"
pollinterval = 15
[rps1000]
driver = riello_usb
port = auto
desc = "Riello SEP 1000 ER NP"
pollinterval = 15
cp -p /etc/nut/upsd.conf.sample /etc/nut/upsd.conf
nano /etc/nut/upsd.conf
MAXAGE 25
STATEPATH /var/run/nut
LISTEN 127.0.0.1 3493
cp -p /etc/nut/upsd.users.sample /etc/nut/upsd.users
nano /etc/nut/upsd.users
[admin]
password = *******
actions = SET
instcmds = ALL
[monitor]
password = *****
upsmon master
cp -p /etc/nut/upsmon.conf.sample /etc/nut/upsmon.conf
nano /etc/nut/upsmon.conf
RUN_AS_USER ups
MONITOR riello1000@localhost 1 monitor ***** primary
MONITOR rps1000@localhost 2 monitor ***** secondary
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h +0"
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+EXEC
NOTIFYFLAG ONBATT SYSLOG+EXEC
NOTIFYFLAG COMMOK SYSLOG
NOTIFYFLAG COMMBAD SYSLOG
NOTIFYFLAG REPLBATT SYSLOG+WALL
NOTIFYFLAG SHUTDOWN SYSLOG+WALL
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5
6.2 Change filename for auto create folder 'nut' in '/var/run/':
mv /usr/lib/tmpfiles.d/nut-common.tmpfiles /usr/lib/tmpfiles.d/nut-common.conf
6.3 Enable all systemd services:
systemctl enable nut.target
systemctl enable nut-driver.target
systemctl enable nut-driver@riello1000.service
systemctl enable nut-driver@rps1000.service
- Restart system:
shutdown -r now
List of folder '/var/run/nut/':
ls -la /var/run/nut/
srw-rw---- 1 ups nut 0 Jan 2 14:19 riello_usb-riello1000=
-rw-r--r-- 1 ups nut 4 Jan 2 14:19 riello_usb-riello1000.pid
srw-rw---- 1 ups nut 0 Jan 2 14:19 riello_usb-rps1000=
-rw-r--r-- 1 ups nut 4 Jan 2 14:19 riello_usb-rps1000.pid
-rw-r--r-- 1 ups nut 4 Jan 2 14:19 upsd.pid
-rw-r--r-- 1 root root 4 Jan 2 14:19 upsmon.pid
This is what is written in the logs at the first start of the system with the newly installed NUT package
Jan 2 14:19:40 rasp4 systemd-tmpfiles[156]: [/usr/lib/tmpfiles.d/nut-common.conf:2] Line references path below legacy directory /var/run/, updating /var/run/nut → /run/nut; please update t
he tmpfiles.d/ drop-in file accordingly.
Jan 2 14:19:40 rasp4 systemd-tmpfiles[156]: [/usr/lib/tmpfiles.d/nut-common.conf:3] Line references path below legacy directory /var/run/, updating /var/run/nut → /run/nut; please update t
he tmpfiles.d/ drop-in file accordingly.
Jan 2 14:19:40 rasp4 nut-driver@rps1000[375]: Network UPS Tools - Riello USB driver 0.07 (2.8.0.1)
Jan 2 14:19:40 rasp4 nut-driver@rps1000[375]: Warning: This is an experimental driver.
Jan 2 14:19:40 rasp4 nut-driver@rps1000[375]: Some features may not function correctly.
Jan 2 14:19:40 rasp4 kernel: [ 8.147104] usb 1-1.4: usbfs: process 470 (riello_usb) did not claim interface 0 before use
Jan 2 14:19:40 rasp4 nut-driver@riello1000[347]: Network UPS Tools - Riello USB driver 0.07 (2.8.0.1)
Jan 2 14:19:40 rasp4 nut-driver@riello1000[347]: Warning: This is an experimental driver.
Jan 2 14:19:40 rasp4 nut-driver@riello1000[347]: Some features may not function correctly.
Jan 2 14:19:43 rasp4 nut-driver@rps1000[375]: Network UPS Tools - UPS driver controller 2.8.0.1
Jan 2 14:19:43 rasp4 riello_usb[620]: Startup successful
Jan 2 14:19:43 rasp4 systemd[1]: Started Network UPS Tools - device driver for rps1000.
Jan 2 14:19:43 rasp4 nut-driver@riello1000[347]: Network UPS Tools - UPS driver controller 2.8.0.1
Jan 2 14:19:43 rasp4 riello_usb[621]: Startup successful
Jan 2 14:19:43 rasp4 systemd[1]: Started Network UPS Tools - device driver for riello1000.
Jan 2 14:19:43 rasp4 systemd[1]: Reached target Network UPS Tools - target for power device drivers on this system.
Jan 2 14:19:43 rasp4 systemd[1]: Started Network UPS Tools - power devices information server.
Jan 2 14:19:43 rasp4 systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
Jan 2 14:19:43 rasp4 nut-server[622]: fopen /var/run/nut/upsd.pid: No such file or directory
Jan 2 14:19:43 rasp4 nut-server[622]: Could not find PID file '/var/run/nut/upsd.pid' to see if previous upsd instance is already running!
Jan 2 14:19:43 rasp4 upsd[622]: /etc/nut/upsd.conf is world readable
Jan 2 14:19:43 rasp4 nut-server[622]: /etc/nut/upsd.conf is world readable
Jan 2 14:19:43 rasp4 nut-server[622]: listening on 127.0.0.1 port 3493
Jan 2 14:19:43 rasp4 systemd[1]: Reached target Network UPS Tools - target for power device drivers, data server and monitoring client (if enabled) on this system.
Jan 2 14:19:43 rasp4 upsd[622]: listening on 127.0.0.1 port 3493
Jan 2 14:19:43 rasp4 nut-server[622]: Connected to UPS [rps1000]: riello_usb-rps1000
Jan 2 14:19:43 rasp4 nut-server[622]: Connected to UPS [riello1000]: riello_usb-riello1000
Jan 2 14:19:43 rasp4 nut-server[622]: Found 2 UPS defined in ups.conf
Jan 2 14:19:43 rasp4 upsd[622]: Connected to UPS [rps1000]: riello_usb-rps1000
Jan 2 14:19:43 rasp4 upsd[622]: Connected to UPS [riello1000]: riello_usb-riello1000
Jan 2 14:19:43 rasp4 upsd[622]: Found 2 UPS defined in ups.conf
Jan 2 14:19:43 rasp4 nut-monitor[623]: fopen /var/run/nut/upsmon.pid: No such file or directory
Jan 2 14:19:43 rasp4 nut-monitor[623]: Could not find PID file to see if previous upsmon instance is already running!
Jan 2 14:19:43 rasp4 nut-server[622]: /etc/nut/upsd.users is world readable
Jan 2 14:19:43 rasp4 upsd[622]: /etc/nut/upsd.users is world readable
Jan 2 14:19:43 rasp4 nut-monitor[623]: UPS: riello1000@localhost (primary) (power value 1)
Jan 2 14:19:43 rasp4 nut-monitor[623]: Using power down flag file /etc/killpower
Jan 2 14:19:43 rasp4 upsd[622]: Running as foreground process, not saving a PID file
Jan 2 14:19:43 rasp4 nut-server[622]: Running as foreground process, not saving a PID file
Jan 2 14:19:43 rasp4 nut-monitor[623]: upscli_init called but SSL wasn't compiled in
Jan 2 14:19:43 rasp4 systemd[1]: systemd-rfkill.service: Succeeded.
Jan 2 14:19:44 rasp4 riello_usb[620]: sock_connect: enabling asynchronous mode (auto)
Jan 2 14:19:44 rasp4 riello_usb[621]: sock_connect: enabling asynchronous mode (auto)
For run command 'upsc -l' need some change in file '/etc/hosts'
nano /etc/hosts
was -> ::1 localhost ip6-localhost ip6-loopback
became -> ::1 ip6-localhost ip6-loopback
The data is correctly read from each device
upsc riello1000@127.0.0.1
battery.capacity: 100
battery.charge: 100
battery.runtime: 88200
battery.voltage: 40.8
battery.voltage.nominal: 36
device.mfr: RPS S.p.a.
device.model: UOD2
device.serial:
device.type: ups
driver.name: riello_usb
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: auto
driver.version: 2.8.0.1
driver.version.internal: 0.07
input.bypass.frequency: 50.00
input.bypass.voltage: 221
input.frequency: 50.00
input.voltage: 221
output.frequency: 50.00
output.frequency.nominal: 50.0
output.L1.current: 0
output.L1.power: 0
output.L1.realpower: 0
output.L2.current: 0
output.L2.power: 0
output.L2.realpower: 0
output.L3.current: 0
output.L3.power: 0
output.L3.realpower: 0
output.power.percent: 6
output.voltage: 221
output.voltage.nominal: 220
ups.delay.reboot: 5
ups.delay.shutdown: 5
ups.firmware: SWM073-01-00
ups.load: 6
ups.mfr: RPS S.p.a.
ups.model: UOD2
ups.power.nominal: 1000
ups.productid: 5500
ups.realpower.nominal: 900
ups.serial:
ups.status: OL BYPASS CHRG
ups.temperature: 35
ups.vendorid: 04b4
upsc rps1000@127.0.0.1
battery.capacity: 100
battery.charge: 100
battery.runtime: 118800
battery.voltage: 40.8
battery.voltage.nominal: 36
device.mfr: RPS S.p.a.
device.model: UOD2
device.serial: AA35VOD20016622
device.type: ups
driver.name: riello_usb
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: auto
driver.version: 2.8.0.1
driver.version.internal: 0.07
input.bypass.frequency: 50.00
input.bypass.voltage: 222
input.frequency: 50.00
input.voltage: 222
output.frequency: 50.00
output.frequency.nominal: 50.0
output.L1.current: 0
output.L1.power: 0
output.L1.realpower: 0
output.L2.current: 0
output.L2.power: 0
output.L2.realpower: 0
output.L3.current: 0
output.L3.power: 0
output.L3.realpower: 0
output.power.percent: 1
output.voltage: 221
output.voltage.nominal: 220
ups.delay.reboot: 5
ups.delay.shutdown: 5
ups.firmware: SWM073-01-01
ups.load: 1
ups.mfr: RPS S.p.a.
ups.model: UOD2
ups.power.nominal: 1000
ups.productid: 5500
ups.realpower.nominal: 900
ups.serial: AA35VOD20016622
ups.status: OL BYPASS CHRG
ups.temperature: 38
ups.vendorid: 04b4
Next, a normal system reboot and this is what the system log shows
Jan 2 14:28:34 rasp4 nut-driver@rps1000[340]: Network UPS Tools - Riello USB driver 0.07 (2.8.0.1)
Jan 2 14:28:34 rasp4 nut-driver@rps1000[340]: Warning: This is an experimental driver.
Jan 2 14:28:34 rasp4 nut-driver@rps1000[340]: Some features may not function correctly.
Jan 2 14:28:34 rasp4 nut-driver@riello1000[389]: Network UPS Tools - Riello USB driver 0.07 (2.8.0.1)
Jan 2 14:28:34 rasp4 nut-driver@riello1000[389]: Warning: This is an experimental driver.
Jan 2 14:28:34 rasp4 nut-driver@riello1000[389]: Some features may not function correctly.
Jan 2 14:28:34 rasp4 nut-driver@rps1000[340]: Got disconnected by another driver: Device or resource busy
Jan 2 14:28:34 rasp4 riello_usb[450]: Got disconnected by another driver: Device or resource busy
Jan 2 14:28:34 rasp4 nut-driver@rps1000[340]: Driver failed to start (exit status=1)
Jan 2 14:28:37 rasp4 nut-driver@riello1000[389]: Network UPS Tools - UPS driver controller 2.8.0.1
Jan 2 14:28:37 rasp4 riello_usb[622]: Startup successful
Jan 2 14:28:37 rasp4 systemd[1]: Started Network UPS Tools - device driver for riello1000.
Jan 2 14:28:40 rasp4 nut-driver@rps1000[340]: Network UPS Tools - Riello USB driver 0.07 (2.8.0.1)
Jan 2 14:28:40 rasp4 nut-driver@rps1000[340]: Warning: This is an experimental driver.
Jan 2 14:28:40 rasp4 nut-driver@rps1000[340]: Some features may not function correctly.
Jan 2 14:28:40 rasp4 riello_usb[622]: Got disconnected by another driver: Device or resource busy
Jan 2 14:28:40 rasp4 systemd[1]: nut-driver@riello1000.service: Main process exited, code=exited, status=1/FAILURE
Jan 2 14:28:40 rasp4 systemd[1]: nut-driver@riello1000.service: Failed with result 'exit-code'.
Jan 2 14:28:42 rasp4 nut-driver@rps1000[340]: Network UPS Tools - UPS driver controller 2.8.0.1
Jan 2 14:28:42 rasp4 riello_usb[646]: Startup successful
Jan 2 14:28:42 rasp4 systemd[1]: Started Network UPS Tools - device driver for rps1000.
Jan 2 14:28:42 rasp4 systemd[1]: Reached target Network UPS Tools - target for power device drivers on this system.
Jan 2 14:28:42 rasp4 systemd[1]: Started Network UPS Tools - power devices information server.
Jan 2 14:28:42 rasp4 systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
Jan 2 14:28:42 rasp4 systemd[1]: Reached target Network UPS Tools - target for power device drivers, data server and monitoring client (if enabled) on this system.
Jan 2 14:28:42 rasp4 nut-server[647]: fopen /var/run/nut/upsd.pid: No such file or directory
Jan 2 14:28:42 rasp4 nut-server[647]: Could not find PID file '/var/run/nut/upsd.pid' to see if previous upsd instance is already running!
Jan 2 14:28:42 rasp4 nut-server[647]: /etc/nut/upsd.conf is world readable
Jan 2 14:28:42 rasp4 upsd[647]: /etc/nut/upsd.conf is world readable
Jan 2 14:28:42 rasp4 nut-server[647]: listening on 127.0.0.1 port 3493
Jan 2 14:28:42 rasp4 upsd[647]: listening on 127.0.0.1 port 3493
Jan 2 14:28:42 rasp4 nut-server[647]: Connected to UPS [rps1000]: riello_usb-rps1000
Jan 2 14:28:42 rasp4 nut-server[647]: Can't connect to UPS [riello1000] (riello_usb-riello1000): No such file or directory
Jan 2 14:28:42 rasp4 nut-server[647]: Found 2 UPS defined in ups.conf
Jan 2 14:28:42 rasp4 upsd[647]: Connected to UPS [rps1000]: riello_usb-rps1000
Jan 2 14:28:42 rasp4 upsd[647]: Can't connect to UPS [riello1000] (riello_usb-riello1000): No such file or directory
Jan 2 14:28:42 rasp4 upsd[647]: Found 2 UPS defined in ups.conf
Jan 2 14:28:42 rasp4 nut-monitor[648]: fopen /var/run/nut/upsmon.pid: No such file or directory
Jan 2 14:28:42 rasp4 nut-monitor[648]: Could not find PID file to see if previous upsmon instance is already running!
Jan 2 14:28:42 rasp4 nut-monitor[648]: UPS: riello1000@localhost (primary) (power value 1)
Jan 2 14:28:42 rasp4 nut-monitor[648]: Using power down flag file /etc/killpower
Jan 2 14:28:42 rasp4 nut-server[647]: /etc/nut/upsd.users is world readable
Jan 2 14:28:42 rasp4 upsd[647]: /etc/nut/upsd.users is world readable
Jan 2 14:28:42 rasp4 nut-monitor[648]: upscli_init called but SSL wasn't compiled in
Jan 2 14:28:42 rasp4 nut-server[647]: Running as foreground process, not saving a PID file
Jan 2 14:28:42 rasp4 nut-server[647]: User monitor@127.0.0.1 logged into UPS [riello1000]
Jan 2 14:28:42 rasp4 upsd[647]: Running as foreground process, not saving a PID file
Jan 2 14:28:42 rasp4 upsd[647]: User monitor@127.0.0.1 logged into UPS [riello1000]
Jan 2 14:28:42 rasp4 nut-monitor[648]: Poll UPS [riello1000@localhost] failed - Driver not connected
Jan 2 14:28:42 rasp4 nut-monitor[648]: Communications with UPS riello1000@localhost lost
Jan 2 14:28:42 rasp4 nut-monitor[648]: Network UPS Tools upsmon 2.8.0.1
Jan 2 14:28:42 rasp4 systemd[1]: systemd-update-utmp-runlevel.service: Succeeded.
Jan 2 14:28:42 rasp4 systemd[1]: Started Update UTMP about System Runlevel Changes.
Jan 2 14:28:42 rasp4 systemd[1]: Startup finished in 2.220s (kernel) + 14.033s (userspace) = 16.254s.
Jan 2 14:28:43 rasp4 riello_usb[646]: sock_connect: enabling asynchronous mode (auto)
Jan 2 14:28:47 rasp4 nut-monitor[648]: Poll UPS [riello1000@localhost] failed - Driver not connected
Jan 2 14:28:47 rasp4 nut-monitor[648]: UPS riello1000@localhost is unavailable
Jan 2 14:28:47 rasp4 nut-monitor[648]: wall: cannot get tty name: Not applicable to this device ioctl
Jan 2 14:28:47 rasp4 nut-monitor[648]: Network UPS Tools upsmon 2.8.0.1
Jan 2 14:28:52 rasp4 nut-monitor[648]: Poll UPS [riello1000@localhost] failed - Driver not connected
Jan 2 14:28:55 rasp4 systemd[1]: nut-driver@riello1000.service: Service RestartSec=15s expired, scheduling restart.
Jan 2 14:28:55 rasp4 systemd[1]: nut-driver@riello1000.service: Scheduled restart job, restart counter is at 1.
Jan 2 14:28:55 rasp4 systemd[1]: Stopped Network UPS Tools - device driver for riello1000.
Jan 2 14:28:55 rasp4 systemd[1]: Starting Network UPS Tools - device driver for riello1000...
Please, I'm really begging for someone's feedback, I'm just stuck and don't know how to proceed. Any information I can provide.
Thanks for paying attention, everyone