Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#962800: nut: NUT and systemd interacting poorly

156 views
Skip to first unread message

Christi Scarborough

unread,
Jun 14, 2020, 6:50:04 AM6/14/20
to
Package: nut-client
Version: 2.7.4-8
Severity: normal
File: nut

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

* What led up to the situation?

Installing of nut-client on the host system - I believe the problem is also present in a full NUT installation though.

* What exactly did you do (or not do) that was effective (or
ineffective)?

apt install nut-client
Basic configuration of NUT to act as a client to a UPS on a different machine on the network.

* What was the outcome of this action?

Errors present in syslog as follows:

Jun 14 11:29:51 yaga systemd[1]: /lib/systemd/system/nut-monitor.service:6: PIDFile= references path below legacy directory /var/run/, updating /var/run/nut/upsmon.pid → /run/nut/upsmon.pid; please update the unit file accordingly.
Jun 14 11:32:46 yaga systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...
Jun 14 11:32:46 yaga upsmon[34188]: fopen /var/run/nut/upsmon.pid: No such file or directory
Jun 14 11:32:46 yaga upsmon[34188]: UPS: <upsid> (slave) (power value 1)
Jun 14 11:32:46 yaga upsmon[34188]: Using power down flag file /etc/killpower
Jun 14 11:32:46 yaga systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: No such file or directory
Jun 14 11:32:46 yaga upsmon[34195]: Startup successful
Jun 14 11:32:46 yaga systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
Jun 14 11:32:46 yaga upsmon[34196]: Init SSL without certificate database

Although the app is working, both errors (the first and 6th lines above are of concern, as I am uncertain whether they will cause unpredictable behaviour.

Thank you,

Christi

*** End of the template - remove these template lines ***


-- System Information:
Debian Release: 10.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.4.41-1-pve (SMP w/32 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages nut-client depends on:
ii adduser 3.118
ii libc6 2.28-10
ii libupsclient4 2.7.4-8
ii lsb-base 10.2019051400

Versions of packages nut-client recommends:
ii bash-completion 1:2.8-6

Versions of packages nut-client suggests:
pn nut-monitor <none>

-- Configuration Files:
/etc/nut/nut.conf changed [not included]
/etc/nut/upsmon.conf changed [not included]
/etc/nut/upssched.conf changed [not included]

-- no debconf information

Trent W. Buck

unread,
Dec 21, 2021, 9:50:03 PM12/21/21
to
Christi Scarborough wrote:
> Jun 14 11:29:51 yaga systemd[1]: /lib/systemd/system/nut-monitor.service:6: PIDFile= references path below legacy directory /var/run/, updating /var/run/nut/upsmon.pid → /run/nut/upsmon.pid; please update the unit file accordingly.
> Jun 14 11:32:46 yaga systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...
> Jun 14 11:32:46 yaga upsmon[34188]: fopen /var/run/nut/upsmon.pid: No such file or directory
> Jun 14 11:32:46 yaga upsmon[34188]: UPS: <upsid> (slave) (power value 1)
> Jun 14 11:32:46 yaga upsmon[34188]: Using power down flag file /etc/killpower
> Jun 14 11:32:46 yaga systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: No such file or directory
> Jun 14 11:32:46 yaga upsmon[34195]: Startup successful
> Jun 14 11:32:46 yaga systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
> Jun 14 11:32:46 yaga upsmon[34196]: Init SSL without certificate database
>
> Although the app is working, both errors (the first and 6th lines above are of concern, as I am uncertain whether they will cause unpredictable behaviour.

I see this also, on a Debian 11 host with nut-client installed.
The nut server is on a different host.
I tried a couple of variations of this, but it didn't help:

# /etc/systemd/system/nut-monitor.service.d/override.conf

# Trying to fix these warnings:
# nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: Operation not permitted
# nut-monitor.service: Supervising process 1287240 which is not our child. We'll most likely not notice when it exits.
[Service]
RuntimeDirectory=nut
# Because /run/nut is shared by several nut units,
# do not erase it when THIS one ends.
# This might not be necessary, but
# I cannot easily tell, because
# I only run nut-monitor on this host!
RuntimeDirectoryPreserve=true
# Sigh, because upsmon starts as root then drops privs,
# it still fails to write to root:root /run/nut?
# Start upsmon as root:nut and make /run/nut root:nut.
# Maybe that will be enough to make thus STFU?
Group=nut

Trent W. Buck

unread,
Dec 21, 2021, 10:10:03 PM12/21/21
to
This is working to remove both warnings.
I'm 99% sure the real problem is that upsmon is trying to do things that are now systemd's job.
You can see the "kill" log even there which suggests upsmon remains derp.

# Trying to fix these warnings:
# nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: Operation not permitted
# nut-monitor.service: Supervising process 1287240 which is not our child. We'll most likely not notice when it exits.
[Service]
RuntimeDirectory=nut
# Because /run/nut is shared by several nut units,
# do not erase it when THIS one ends.
# This might not be necessary, but
# I cannot easily tell, because
# I only run nut-monitor on this host!
RuntimeDirectoryPreserve=true
# Sigh, because upsmon starts as root then drops privs,
# it still fails to write to root:root /run/nut?
# Start upsmon as root:nut and make /run/nut root:nut.
# Maybe that will be enough to make thus STFU?
Group=nut
# <damjan> twb just remove PIDFile=
PIDFile=


cyber@light:~$ systemctl status nut-monitor
● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
Loaded: loaded (/lib/systemd/system/nut-monitor.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/nut-monitor.service.d
└─override.conf
Active: active (running) since Wed 2021-12-22 13:56:11 AEDT; 6min ago
Process: 1303859 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS)
Main PID: 1303860 (upsmon)
Tasks: 2 (limit: 4653)
Memory: 896.0K
CPU: 17ms
CGroup: /system.slice/nut-monitor.service
├─1303860 /lib/nut/upsmon
└─1303861 /lib/nut/upsmon

Dec 22 13:56:11 light systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...
Dec 22 13:56:11 light upsmon[1303859]: kill: No such process
Dec 22 13:56:11 light upsmon[1303859]: UPS: up...@omega.cyber.com.au (slave) (power value 1)
Dec 22 13:56:11 light upsmon[1303859]: Using power down flag file /etc/killpower
Dec 22 13:56:11 light upsmon[1303860]: Startup successful
Dec 22 13:56:11 light systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
Dec 22 13:56:11 light upsmon[1303861]: Init SSL without certificate database

Robert E Wooden

unread,
Sep 26, 2023, 8:40:05 AM9/26/23
to
Setting up nut-client on a RPi 3B+ and a RPi 4B. 

admin@nut-clientns1080:~ $ upsc nut-clientns1080@localhost
Error: Connection failure: Connection refused
admin@nut-clientns1080:~ $ upsc nut-se...@192.168.xxx.xxx

Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
##############################
#######  snipped for brevity #######
##############################
ups.model: Back-UPS ES 550
ups.productid: 0002
ups.serial: 3B0743X46110  
ups.status: OL
ups.timer.reboot: 0
ups.timer.shutdown: -1
ups.vendorid: 051d
admin@nut-clientns1080:~ $ sudo systemctl status nut-client

● 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: active (running) since Mon 2023-09-25 08:25:22 EDT; 23h ago
    Process: 899 ExecStart=/sbin/upsmon (code=exited, status=0/SUCCESS)
   Main PID: 901 (upsmon)
      Tasks: 2 (limit: 1599)
        CPU: 9.925s
     CGroup: /system.slice/nut-monitor.service
             ├─900 /lib/nut/upsmon
             └─901 /lib/nut/upsmon

Sep 25 08:25:22 nut-clientns1080 systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...
Sep 25 08:25:22 nut-clientns1080 upsmon[899]: fopen /run/nut/upsmon.pid: No such file or directory
Sep 25 08:25:22 nut-clientns1080 upsmon[899]: UPS: nut-se...@192.168.xxx.xxx (slave) (power value 1)
Sep 25 08:25:22 nut-clientns1080 upsmon[899]: Using power down flag file /etc/killpower
Sep 25 08:25:22 nut-clientns1080 upsmon[900]: Startup successful
Sep 25 08:25:22 nut-clientns1080 systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: Operation not permitted
Sep 25 08:25:22 nut-clientns1080 systemd[1]: nut-monitor.service: Supervising process 901 which is not our child. We'll most likely not notice when it exits.
Sep 25 08:25:22 nut-clientns1080 upsmon[901]: Init SSL without certificate database
Sep 25 08:25:22 nut-clientns1080 systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.
Sep 25 08:25:22 nut-clientns1080 upsmon[901]: Login on UPS [nut-se...@192.168.xxx.xxx] failed - got [ERR ACCESS-DENIED]

Output of /var/log/syslog

Sep 26 07:51:41 nut-clientns1080 upsmon[901]: Signal 15: exiting

Sep 26 07:51:41 nut-clientns1080 systemd[1]: Stopping Network UPS Tools - power device monitor and shutdown controller...

Sep 26 07:51:41 nut-clientns1080 systemd[1]: nut-monitor.service: Succeeded.

Sep 26 07:51:41 nut-clientns1080 systemd[1]: Stopped Network UPS Tools - power device monitor and shutdown controller.

Sep 26 07:51:41 nut-clientns1080 systemd[1]: nut-monitor.service: Consumed 10.030s CPU time.

Sep 26 07:51:41 nut-clientns1080 systemd[1]: Starting Network UPS Tools - power device monitor and shutdown controller...

Sep 26 07:51:41 nut-clientns1080 upsmon[12471]: fopen /run/nut/upsmon.pid: No such file or directory

Sep 26 07:51:41 nut-clientns1080 upsmon[12471]: UPS: nut-se...@192.168.xxx.xxx (slave) (power value 1)

Sep 26 07:51:41 nut-clientns1080 upsmon[12471]: Using power down flag file /etc/killpower

Sep 26 07:51:41 nut-clientns1080 upsmon[12473]: Startup successful

Sep 26 07:51:41 nut-clientns1080 systemd[1]: nut-monitor.service: Can't open PID file /run/nut/upsmon.pid (yet?) after start: Operation not permitted

Sep 26 07:51:41 nut-clientns1080 systemd[1]: nut-monitor.service: Supervising process 12474 which is not our child. We'll most likely not notice when it exits.

Sep 26 07:51:41 nut-clientns1080 systemd[1]: Started Network UPS Tools - power device monitor and shutdown controller.

Sep 26 07:51:41 nut-clientns1080 upsmon[12474]: Init SSL without certificate database

Sep 26 07:51:41 nut-clientns1080 upsmon[12474]: Login on UPS [nut-se...@192.168.xxx.xxx] failed - got [ERR ACCESS-DENIED]


Hardware in use:
RPi 4B configuration:
admin@nut-clientns1080:~ $ pinout
Revision           : b03112
SoC                : BCM2711
RAM                : 2GB
Storage            : MicroSD
RPi 3B+ configuration:
admin@nut-clientes550:~ $ pinout
Revision           : a020d3
SoC                : BCM2837
RAM                : 1GB
Storage            : MicroSD
Both RPi's are running Raspbian 11 Lite 64-bit OS with current version of NUT.
admin@nut-client550:~ $ sudo apt list nut
Listing... Done
nut/oldstable,oldstable,now 2.7.4-13 all [installed]

While searching web for a solution I found Debian bug #962800.

Is there a workaround available?

--
---
Bob Wooden
0 new messages