[Nut-upsuser] NUT no longer works after 2.7 -> 2.8 upgrade
Bill Gee
bgee at campercaver.net
Fri Dec 2 12:07:20 GMT 2022
Test 1 - I moved the environ.conf file to /tmp. I ran systemctl
daemon-reload, then restarted nut-driver at cyberpower.service. Results:
=====================================
[root at mythtv nut-driver at .service.d]# systemctl restart
nut-driver at cyberpower.service
Job for nut-driver at cyberpower.service failed because the control process
exited with error code.
See "systemctl status nut-driver at cyberpower.service" and "journalctl
-xeu nut-driver at cyberpower.service" for details.
[root at mythtv nut-driver at .service.d]# systemctl --full --no-pager status
nut-driver at cyberpower.service
● nut-driver at cyberpower.service - Network UPS Tools - device driver for
NUT device 'cyberpower'
Loaded: loaded (/usr/lib/systemd/system/nut-driver at .service;
enabled; preset: disabled)
Drop-In: /etc/systemd/system/nut-driver at cyberpower.service.d
└─nut-driver-enumerator-generated-checksum.conf,
nut-driver-enumerator-generated.conf
Active: activating (auto-restart) (Result: exit-code) since Fri
2022-12-02 05:54:03 CST; 2s ago
Process: 10732 ExecStartPre=/usr/bin/systemd-tmpfiles --create
/usr/lib/tmpfiles.d/nut-client.conf (code=exited, status=0/SUCCESS)
Process: 10733 ExecStart=/bin/sh -c
NUTDEV="`/usr/libexec/nut-driver-enumerator.sh --get-device-for-service
cyberpower`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT
device section for service unit cyberpower" >&2 ; exit 1 ; } ;
/usr/sbin/upsdrvctl start "$NUTDEV" (code=exited, status=1/FAILURE)
CPU: 80ms
=========================================
It seems that the nut device driver requires environ.conf to be present.
Test 2 - I moved environ.conf back to the correct place. I edited the
file to use "Environment=NUT_STATEPATH=/run/nut". I did a daemon-reload
then started the nut-driver. It worked - no errors.
Test 3 - I modified /etc/ups/upsd.conf to comment out the STATEPATH
line. I restarted nut-server.service. It failed.
================================
[root at mythtv ups]# systemctl --full --no-pager status nut-server
● nut-server.service - Network UPS Tools - power devices information server
Loaded: loaded (/usr/lib/systemd/system/nut-server.service;
enabled; preset: disabled)
Active: active (running) since Fri 2022-12-02 06:00:54 CST; 13s ago
Main PID: 11452 (upsd)
Tasks: 1 (limit: 9482)
Memory: 728.0K
CPU: 5ms
CGroup: /system.slice/nut-server.service
└─11452 /usr/sbin/upsd -F
Dec 02 06:00:54 mythtv.billgee.local nut-server[11452]: listening on ::1
port 3493
Dec 02 06:00:54 mythtv.billgee.local nut-server[11452]: listening on
127.0.0.1 port 3493
Dec 02 06:00:54 mythtv.billgee.local upsd[11452]: listening on ::1 port 3493
Dec 02 06:00:54 mythtv.billgee.local upsd[11452]: listening on 127.0.0.1
port 3493
Dec 02 06:00:54 mythtv.billgee.local nut-server[11452]: /var/run is
world readable
Dec 02 06:00:54 mythtv.billgee.local upsd[11452]: /var/run is world readable
Dec 02 06:00:54 mythtv.billgee.local upsd[11452]: Can't connect to UPS
[cyberpower] (usbhid-ups-cyberpower): No such file or directory
Dec 02 06:00:54 mythtv.billgee.local nut-server[11452]: Can't connect to
UPS [cyberpower] (usbhid-ups-cyberpower): No such file or directory
Dec 02 06:00:54 mythtv.billgee.local nut-server[11452]: Running as
foreground process, not saving a PID file
Dec 02 06:00:54 mythtv.billgee.local upsd[11452]: Running as foreground
process, not saving a PID file
===================================
Test 4 - I uncommented the STATEPATH line in upsd.conf. It points to
/run/nut. I restarted nut-server. Success.
===============
Bill Gee
On 12/1/22 18:35, Simon Wilson via Nut-upsuser wrote:
> Resending as original was too big for list acceptance.
>
> Hi Bill,
>
> /etc/systemd/system/nut-driver at .service.d/environ.conf sets the
> nut-driver service's environment variable, such that it sees a workable
> NUT_STATEPATH of /var/run/nut when upsdrvctl is run by the service,
> regardless of what is set in upsd.conf, and explains why the driver
> worked yesterday but upsd didn't.
>
> Tests which may be interesting:
>
> 1. First test:- move nut-driver's environ.conf file to somewhere else
> temporarily; leave upsd.conf STATEPATH uncommented saying /run/nut;
> restart nut-driver at cyberpower.service; and see if it runs. This tests to
> see if it *needs* the drop-in service file *or* will work with only
> STATEPATH explicitly set in upsd.conf to /run/nut. If this prevents the
> driver from working, put the environ.conf file back (but edit it, it
> should say /run/nut, not /var/run/nut)
>
> 2. Second test:- copy the edited
> /etc/systemd/system/nut-driver at .service.d/environ.conf to
> /etc/systemd/system/nut-server.service.d/environ.conf. So you should at
> that point have both locations with a file saying
> [Service]
> Environment=NUT_STATEPATH=/run/nut
> Then comment out STATEPATH line (back to default) in upsd.conf and
> restart nut-server - does it still start, and does it still pop a "Could
> not find PID file '/var/run/upsd.pid'" message? That tests whether the
> drop-in file is a better, more consistent fix for now (until the
> packages are resolved). Calling the nut-server process with that
> variable set for upsd *even before it reads upsd.conf* may remove the
> first error 'Could not find PID file '/var/run/upsd.pid''
>
> And definitely document any changes you make to your setup as subsequent
> package releases will likely change all of this :)
>
> Couple more comments inline below.
>
> Simon
>
>
> ----- Message from Bill Gee <bgee at campercaver.net> ---------
> Date: Thu, 1 Dec 2022 16:49:14 -0600
> From: Bill Gee <bgee at campercaver.net>
> Subject: Re: [Nut-upsuser] NUT no longer works after 2.7 -> 2.8 upgrade
> To: nut-upsuser at alioth-lists.debian.net
>
>> Checking now - There is a file called
>> /etc/systemd/system/nut-driver at .service.d/environ.conf. Its contents are
>>
>> ==========================
>> [root at mythtv nut-driver at .service.d]# ll
>> total 8
>> -rw-r--r-- 1 root root 49 Nov 29 18:14 environ.conf
>> -rw-r--r-- 1 root root 81 Nov 30 18:58
>> nut-driver-enumerator-generated-checksum.conf
>>
>> [root at mythtv nut-driver at .service.d]# cat environ.conf
>> [Service]
[snip]
More information about the Nut-upsuser
mailing list