<div dir="ltr"><div>Curious finding up there. I think this is due to `<span class="gmail-pl-c1">load_upsdconf</span>(<span class="gmail-pl-c1">0</span>);` being at <a href="https://github.com/networkupstools/nut/blob/master/server/upsd.c#L1776">https://github.com/networkupstools/nut/blob/master/server/upsd.c#L1776</a> being after the initial signal-probing for competitors (or sending a command to a running daemon), so using built-in PID/STATE paths, and notably that probing happens before the optional chrooting (and PID file is later recorded relative to the chroot).</div><div><br></div><div>For that initial probing, it would honor the NUT_ALTPIDPATH envvar (although still disregarding "relative to chroot" part if used), but not yet the know config file contents.<br></div><div><br></div><div>So it is messed up somewhat.</div><div><br></div><div>FWIW, last week I tried to track down current usage of various PATHs in the sources, see <a href="https://github.com/networkupstools/nut/issues/1712#issuecomment-1327627850">https://github.com/networkupstools/nut/issues/1712#issuecomment-1327627850</a> if interested :)</div><div><br></div><div>Hope this helps,<br></div><div>Jim Klimov<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 1, 2022 at 5:43 PM Bill Gee <<a href="mailto:bgee@campercaver.net">bgee@campercaver.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">My email client (Thunderbird) does not truncate, but it does wrap. The <br>
truncations come from the way systemctl runs its output through a pager. <br>
When I copy-paste from the bash session, it truncates at the right edge <br>
of the window. I need to use the --full and --no-pager options to get <br>
the full text, which will be wrapped as needed.<br>
<br>
Here is the output from upsd -DD:<br>
<br>
===================================<br>
[root@mythtv ~]# upsd -DD<br>
Network UPS Tools upsd 2.8.0<br>
0.000000 fopen /var/run/upsd.pid: No such file or directory<br>
0.000030 Could not find PID file '/var/run/upsd.pid' to see if <br>
previous upsd instance is already running!<br>
<br>
0.000250 [D1] debug level is '2'<br>
0.000335 listening on ::1 port 3493<br>
0.000375 listening on 127.0.0.1 port 3493<br>
0.001417 /var/run is world readable<br>
0.001557 Can't connect to UPS [cyberpower] <br>
(usbhid-ups-cyberpower): No such file or directory<br>
0.002315 Running as foreground process, not saving a PID file<br>
0.002337 [D1] mainloop: UPS [cyberpower] is not currently connected<br>
0.002377 [D1] mainloop: UPS [cyberpower] is now connected as FD -1<br>
0.002399 [D2] mainloop: polling 2 filedescriptors<br>
2.003794 [D2] mainloop: no data available<br>
2.003842 [D1] mainloop: UPS [cyberpower] is not currently connected<br>
2.003897 [D1] mainloop: UPS [cyberpower] is now connected as FD -1<br>
2.003917 [D2] mainloop: polling 2 filedescriptors<br>
4.005963 [D2] mainloop: no data available<br>
4.006009 [D1] mainloop: UPS [cyberpower] is not currently connected<br>
4.006054 [D1] mainloop: UPS [cyberpower] is now connected as FD -1<br>
4.006073 [D2] mainloop: polling 2 filedescriptors<br>
6.008122 [D2] mainloop: no data available<br>
==============================<br>
<br>
Just for grins, I edited /etc/ups/upsd.conf to uncomment the STATEPATH <br>
line. I set it to /run/nut. When I ran upsd -DD again, it was still <br>
looking at /var/run. However! It successfully connected to the <br>
cyberpower device. Upsc returns good information.<br>
<br>
<br>
=================================<br>
[root@mythtv ups]# upsd -DD<br>
Network UPS Tools upsd 2.8.0<br>
0.000000 fopen /var/run/upsd.pid: No such file or directory<br>
0.000037 Could not find PID file '/var/run/upsd.pid' to see if <br>
previous upsd instance is already running!<br>
<br>
0.000271 [D1] debug level is '2'<br>
0.000357 listening on ::1 port 3493<br>
0.000395 listening on 127.0.0.1 port 3493<br>
0.001550 Connected to UPS [cyberpower]: usbhid-ups-cyberpower<br>
0.002323 Running as foreground process, not saving a PID file<br>
0.002347 [D2] mainloop: polling 3 filedescriptors<br>
0.002423 [D2] mainloop: polling 3 filedescriptors<br>
0.002493 [D2] mainloop: polling 3 filedescriptors<br>
0.002570 [D2] mainloop: polling 3 filedescriptors<br>
0.002648 [D2] mainloop: polling 3 filedescriptors<br>
0.002701 [D2] mainloop: polling 3 filedescriptors<br>
2.004311 [D2] mainloop: no data available<br>
2.004352 [D2] mainloop: polling 3 filedescriptors<br>
4.006061 [D2] mainloop: no data available<br>
<br>
[root@mythtv ups]# systemctl --full --no-pager status nut-server<br>
● nut-server.service - Network UPS Tools - power devices information server<br>
Loaded: loaded (/usr/lib/systemd/system/nut-server.service; <br>
disabled; preset: disabled)<br>
Active: active (running) since Thu 2022-12-01 10:35:01 CST; 18s ago<br>
Main PID: 3445 (upsd)<br>
Tasks: 1 (limit: 9482)<br>
Memory: 732.0K<br>
CPU: 4ms<br>
CGroup: /system.slice/nut-server.service<br>
└─3445 /usr/sbin/upsd -F<br>
<br>
Dec 01 10:35:01 mythtv.billgee.local nut-server[3445]: fopen <br>
/var/run/upsd.pid: No such file or directory<br>
Dec 01 10:35:01 mythtv.billgee.local nut-server[3445]: Could not find <br>
PID file '/var/run/upsd.pid' to see if previous upsd instance is already <br>
running!<br>
Dec 01 10:35:01 mythtv.billgee.local nut-server[3445]: listening on ::1 <br>
port 3493<br>
Dec 01 10:35:01 mythtv.billgee.local nut-server[3445]: listening on <br>
127.0.0.1 port 3493<br>
Dec 01 10:35:01 mythtv.billgee.local upsd[3445]: listening on ::1 port 3493<br>
Dec 01 10:35:01 mythtv.billgee.local upsd[3445]: listening on 127.0.0.1 <br>
port 3493<br>
Dec 01 10:35:01 mythtv.billgee.local nut-server[3445]: Connected to UPS <br>
[cyberpower]: usbhid-ups-cyberpower<br>
Dec 01 10:35:01 mythtv.billgee.local upsd[3445]: Connected to UPS <br>
[cyberpower]: usbhid-ups-cyberpower<br>
Dec 01 10:35:01 mythtv.billgee.local upsd[3445]: Running as foreground <br>
process, not saving a PID file<br>
Dec 01 10:35:01 mythtv.billgee.local nut-server[3445]: Running as <br>
foreground process, not saving a PID file<br>
<br>
[root@mythtv ups]# upsc cyberpower@localhost<br>
battery.charge: 100<br>
battery.charge.low: 10<br>
battery.charge.warning: 20<br>
battery.mfr.date: CPS<br>
battery.runtime: 2100<br>
battery.runtime.low: 300<br>
battery.type: PbAcid<br>
battery.voltage: 13.3<br>
battery.voltage.nominal: 12<br>
device.mfr: CPS<br>
device.model: UPS CP1000AVRLCD<br>
device.type: ups<br>
<a href="http://driver.name" rel="noreferrer" target="_blank">driver.name</a>: usbhid-ups<br>
[-- snip --]<br>
<br>
<br>
===============<br>
Bill Gee<br>
<br>
On 12/1/22 06:41, Simon Wilson via Nut-upsuser wrote:<br>
> Hi Bill, well at least you now have a fully operating, starts-on-reboot <br>
> driver - so that is progress. One thing we need to know which I asked <br>
> but you've not answered:<br>
> "Did you need to add the environment drop-in file? At which step did it <br>
> work?" The answer to that may change next step.<br>
> <br>
> nut-server *should* just work if there is a driver available and running.<br>
> <br>
> OK, run:<br>
> <br>
> systemctl disable nut-server (stop it trying to run automatically)<br>
> upsd -DD<br>
> <br>
> And then Ctrl-C to stop it once you have got output to screen with <br>
> startup messages.<br>
> <br>
> Then copy back here the output from upsd -DD, preferably without <br>
> truncating lines which your mail client seems to do :(<br>
> <br>
> I'm pretty sure that nut-server is using /var/run as its STATEPATH. Can <br>
> you also include your upsd.conf, minus commented lines.<br>
> <br>
> Simon.<br>
> <br>
> ----- Message from Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>> ---------<br>
> Date: Thu, 1 Dec 2022 06:14:10 -0600<br>
> From: Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>><br>
> Subject: Re: [Nut-upsuser] NUT no longer works after 2.7 -> 2.8 upgrade<br>
> To: <a href="mailto:nut-upsuser@alioth-lists.debian.net" target="_blank">nut-upsuser@alioth-lists.debian.net</a><br>
> <br>
> <br>
>> Hi Simon -<br>
>><br>
>> I modified /usr/lib/tmpfiles.d/nut-client to use /run instead of <br>
>> /var/run. I checked the startup status of the nut services.<br>
>><br>
>> =================<br>
>> [root@mythtv ~]# systemctl list-unit-files | grep -i nut<br>
>> nut-driver-enumerator.path enabled disabled<br>
>> nut-driver-enumerator.service enabled disabled<br>
>> nut-driver@.service indirect disabled<br>
>> nut-monitor.service disabled disabled<br>
>> nut-server.service enabled disabled<br>
>> nut-driver.target disabled disabled<br>
>> nut.target disabled disabled<br>
>> ==========================<br>
>><br>
>> I did a shutdown/reboot on the system. The usbhid driver loaded <br>
>> without errors and did not complain about /var/run. /run/nut exists <br>
>> and contains the expected two files.<br>
>><br>
>> nut-server also started since it is set to "enabled", but failed to <br>
>> connect to the driver. It complains about "no such file or <br>
>> directory". What file is it looking for? I ran journalctl on it but <br>
>> got nothing more than what systemctl status reports.<br>
>><br>
>> ===========================<br>
>> [root@mythtv ~]# systemctl status nut-driver@cyberpower<br>
>> ● nut-driver@cyberpower.service - Network UPS Tools - device driver <br>
>> for NUT device 'cyberpower'<br>
>> Loaded: loaded (/usr/lib/systemd/system/nut-driver@.service; <br>
>> enabled; preset: disabled)<br>
>> Drop-In: /etc/systemd/system/nut-driver@.service.d<br>
>> └─environ.conf<br>
>> /etc/systemd/system/nut-driver@cyberpower.service.d<br>
>> └─nut-driver-enumerator-generated-checksum.conf, <br>
>> nut-driver-enumerator-generated.conf<br>
>> Active: active (running) since Thu 2022-12-01 05:56:04 CST; 9min ago<br>
>> Process: 712 ExecStartPre=/usr/bin/systemd-tmpfiles --create <br>
>> /usr/lib/tmpfiles.d/nut-client.conf (code=exited, stat><br>
>> Process: 719 ExecStart=/bin/sh -c <br>
>> NUTDEV="`/usr/libexec/nut-driver-enumerator.sh <br>
>> --get-device-for-service cyberpowe><br>
>> Main PID: 791 (usbhid-ups)<br>
>> Tasks: 1 (limit: 9482)<br>
>> Memory: 2.9M<br>
>> CPU: 113ms<br>
>> CGroup: <br>
>> /system.slice/system-nut\x2ddriver.slice/nut-driver@cyberpower.service<br>
>> └─791 /usr/sbin/usbhid-ups -a cyberpower<br>
>><br>
>> Dec 01 05:56:04 mythtv.billgee.local nut-driver@cyberpower[787]: Using <br>
>> subdriver: CyberPower HID 0.6<br>
>> Dec 01 05:56:04 mythtv.billgee.local nut-driver@cyberpower[787]: <br>
>> Network UPS Tools - Generic HID driver 0.47 (2.8.0)<br>
>> Dec 01 05:56:04 mythtv.billgee.local nut-driver@cyberpower[787]: USB <br>
>> communication driver (libusb 1.0) 0.43<br>
>> Dec 01 05:56:04 mythtv.billgee.local nut-driver@cyberpower[787]: <br>
>> cps_adjust_battery_scale: battery readings will be sca><br>
>> Dec 01 05:56:04 mythtv.billgee.local nut-driver@cyberpower[719]: <br>
>> Network UPS Tools - UPS driver controller 2.8.0<br>
>> Dec 01 05:56:04 mythtv.billgee.local usbhid-ups[791]: Startup successful<br>
>><br>
>> [root@mythtv ~]# systemctl status nut-server<br>
>> ● nut-server.service - Network UPS Tools - power devices information <br>
>> server<br>
>> Loaded: loaded (/usr/lib/systemd/system/nut-server.service; <br>
>> enabled; preset: disabled)<br>
>> Active: active (running) since Thu 2022-12-01 05:56:07 CST; 9min ago<br>
>> Main PID: 809 (upsd)<br>
>> Tasks: 1 (limit: 9482)<br>
>> Memory: 1000.0K<br>
>> CPU: 15ms<br>
>> CGroup: /system.slice/nut-server.service<br>
>> └─809 /usr/sbin/upsd -F<br>
>><br>
>> Dec 01 05:56:08 mythtv.billgee.local upsd[809]: listening on ::1 port <br>
>> 3493<br>
>> Dec 01 05:56:08 mythtv.billgee.local upsd[809]: listening on 127.0.0.1 <br>
>> port 3493<br>
>> Dec 01 05:56:08 mythtv.billgee.local nut-server[809]: /var/run is <br>
>> world readable<br>
>> Dec 01 05:56:08 mythtv.billgee.local nut-server[809]: Can't connect to <br>
>> UPS [cyberpower] (usbhid-ups-cyberpower): No suc><br>
>> Dec 01 05:56:08 mythtv.billgee.local upsd[809]: /var/run is world <br>
>> readable<br>
>> Dec 01 05:56:08 mythtv.billgee.local upsd[809]: Can't connect to UPS <br>
>> [cyberpower] (usbhid-ups-cyberpower): No such file><br>
>> Dec 01 05:56:10 mythtv.billgee.local nut-server[809]: Running as <br>
>> foreground process, not saving a PID file<br>
>> Dec 01 05:56:10 mythtv.billgee.local upsd[809]: Running as foreground <br>
>> process, not saving a PID file<br>
>> Dec 01 06:01:08 mythtv.billgee.local nut-server[809]: Can't connect to <br>
>> UPS [cyberpower] (usbhid-ups-cyberpower): No suc><br>
>> Dec 01 06:01:08 mythtv.billgee.local upsd[809]: Can't connect to UPS <br>
>> [cyberpower] (usbhid-ups-cyberpower): No such file><br>
>> ================================<br>
>><br>
>><br>
>><br>
>> ===============<br>
>> Bill Gee<br>
>><br>
>> On 11/30/22 21:14, Simon Wilson via Nut-upsuser wrote:<br>
>>> ----- Message from Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>> ---------<br>
>>> Date: Wed, 30 Nov 2022 19:26:46 -0600<br>
>>> From: Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>><br>
>>> Subject: Re: [Nut-upsuser] NUT no longer works after 2.7 -> 2.8 upgrade<br>
>>> To: <a href="mailto:nut-upsuser@alioth-lists.debian.net" target="_blank">nut-upsuser@alioth-lists.debian.net</a><br>
>>><br>
>>><br>
>>>> Hi Simon -<br>
>>>><br>
>>>> I ran through the steps you gave below. To quote Gilbert&Sullivan <br>
>>>> ... "Modified Rapture!" I suppose I should try a reboot to make <br>
>>>> sure everything starts properly.<br>
>>><br>
>>> Not yet with the reboot. Baby steps... :) you have a driver running <br>
>>> from the service file! Celebrations are in order.<br>
>>><br>
>>> Did you need to add the environment drop-in file? At which step did <br>
>>> it work?<br>
>>><br>
>>>> But first, there is a problem with upsc. Also nut-server complains <br>
>>>> that it cannot connect to the device.<br>
>>><br>
>>> Ok, that's next... your comments are wrong way around :) nut-server <br>
>>> not starting is why upsc doesn't give you anything.<br>
>>><br>
>>>><br>
>>>> /run/nut exists and contains two files.<br>
>>>><br>
>>>> Here are some outputs:<br>
>>>><br>
>>>> ======================================<br>
>>>> [root@mythtv ~]# journalctl -u nut-driver@cyberpower.service -f<br>
>>>> Nov 30 19:00:20 mythtv.billgee.local systemd[1]: Starting <br>
>>>> nut-driver@cyberpower.service - Network UPS Tools - device driver <br>
>>>> for NUT device 'cyberpower'...<br>
>>>> Nov 30 19:00:20 mythtv.billgee.local systemd-tmpfiles[28689]: <br>
>>>> /usr/lib/tmpfiles.d/nut-client.conf:2: Line references path below <br>
>>>> legacy directory /var/run/, updating /var/run/nut → /run/nut; please <br>
>>>> update the tmpfiles.d/ drop-in file accordingly.<br>
>>><br>
>>> That line is the "noise" error I mentioned. Edit <br>
>>> /usr/lib/tmpfiles.d/nut-client.conf to read /run/nut, not /var/run/nut<br>
>>><br>
>>>> Nov 30 19:00:20 mythtv.billgee.local systemd-tmpfiles[28689]: <br>
>>>> /usr/lib/tmpfiles.d/nut-client.conf:3: Line references path below <br>
>>>> legacy directory /var/run/, updating /var/run/nut → /run/nut; please <br>
>>>> update the tmpfiles.d/ drop-in file accordingly.<br>
>>><br>
>>> Ditto, although you probably don't need line 3 in the file anyway.<br>
>>><br>
>>>> Nov 30 19:00:21 mythtv.billgee.local nut-driver@cyberpower[28719]: <br>
>>>> Using subdriver: CyberPower HID 0.6<br>
>>>> Nov 30 19:00:21 mythtv.billgee.local nut-driver@cyberpower[28719]: <br>
>>>> Network UPS Tools - Generic HID driver 0.47 (2.8.0)<br>
>>>> Nov 30 19:00:21 mythtv.billgee.local nut-driver@cyberpower[28719]: <br>
>>>> USB communication driver (libusb 1.0) 0.43<br>
>>>> Nov 30 19:00:21 mythtv.billgee.local nut-driver@cyberpower[28719]: <br>
>>>> cps_adjust_battery_scale: battery readings will be scaled by 2/3<br>
>>>> Nov 30 19:00:21 mythtv.billgee.local usbhid-ups[28769]: Startup <br>
>>>> successful<br>
>>>> Nov 30 19:00:21 mythtv.billgee.local nut-driver@cyberpower[28691]: <br>
>>>> Network UPS Tools - UPS driver controller 2.8.0<br>
>>>> Nov 30 19:00:21 mythtv.billgee.local systemd[1]: Started <br>
>>>> nut-driver@cyberpower.service - Network UPS Tools - device driver <br>
>>>> for NUT device 'cyberpower'.<br>
>>>><br>
>>>> [root@mythtv ups]# ll /run/nut<br>
>>>> total 4<br>
>>>> srw-rw---- 1 nut nut 0 Nov 30 19:00 usbhid-ups-cyberpower<br>
>>>> -rw-r--r-- 1 nut nut 6 Nov 30 19:00 usbhid-ups-cyberpower.pid<br>
>>>><br>
>>>><br>
>>>> [root@mythtv ups]# systemctl --no-pager --full status nut-server<br>
>>>> ● nut-server.service - Network UPS Tools - power devices information <br>
>>>> server<br>
>>>> Loaded: loaded (/usr/lib/systemd/system/nut-server.service; <br>
>>>> enabled; preset: disabled)<br>
>>>> Active: active (running) since Wed 2022-11-30 19:06:53 CST; <br>
>>>> 13min ago<br>
>>>> Main PID: 28918 (upsd)<br>
>>>> Tasks: 1 (limit: 9482)<br>
>>>> Memory: 736.0K<br>
>>>> CPU: 20ms<br>
>>>> CGroup: /system.slice/nut-server.service<br>
>>>> └─28918 /usr/sbin/upsd -F<br>
>>>><br>
>>>> Nov 30 19:06:53 mythtv.billgee.local nut-server[28918]: /var/run is <br>
>>>> world readable<br>
>>>> Nov 30 19:06:53 mythtv.billgee.local upsd[28918]: /var/run is world <br>
>>>> readable<br>
>>>> Nov 30 19:06:53 mythtv.billgee.local upsd[28918]: Can't connect to <br>
>>>> UPS [cyberpower] (usbhid-ups-cyberpower): Connection refused<br>
>>>> Nov 30 19:06:53 mythtv.billgee.local nut-server[28918]: Can't <br>
>>>> connect to UPS [cyberpower] (usbhid-ups-cyberpower): Connection refused<br>
>>>> Nov 30 19:06:53 mythtv.billgee.local nut-server[28918]: Running as <br>
>>>> foreground process, not saving a PID file<br>
>>>> Nov 30 19:06:53 mythtv.billgee.local upsd[28918]: Running as <br>
>>>> foreground process, not saving a PID file<br>
>>>> Nov 30 19:11:53 mythtv.billgee.local nut-server[28918]: Can't <br>
>>>> connect to UPS [cyberpower] (usbhid-ups-cyberpower): Connection refused<br>
>>>> Nov 30 19:11:53 mythtv.billgee.local upsd[28918]: Can't connect to <br>
>>>> UPS [cyberpower] (usbhid-ups-cyberpower): Connection refused<br>
>>>> Nov 30 19:16:53 mythtv.billgee.local nut-server[28918]: Can't <br>
>>>> connect to UPS [cyberpower] (usbhid-ups-cyberpower): Connection refused<br>
>>>> Nov 30 19:16:53 mythtv.billgee.local upsd[28918]: Can't connect to <br>
>>>> UPS [cyberpower] (usbhid-ups-cyberpower): Connection refused<br>
>>>><br>
>>>> [root@mythtv ups]# ps ax | grep ups<br>
>>>> 768 ? Ss 0:00 /usr/sbin/cupsd -l<br>
>>>> 773 ? Ss 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of <br>
>>>> 10-100 startups<br>
>>>> 28769 ? Ss 0:00 /usr/sbin/usbhid-ups -a cyberpower<br>
>>>> 28918 ? Ss 0:00 /usr/sbin/upsd -F<br>
>>>> 28929 pts/1 S+ 0:00 grep --color=auto ups<br>
>>>><br>
>>>> [root@mythtv ups]# upsc cyberpower@localhost<br>
>>>> Error: Driver not connected<br>
>>><br>
>>> upsc won't work without nut-server running, so this is expected based <br>
>>> on the above failure to start nut-server.<br>
>>><br>
>>>><br>
>>>><br>
>>><br>
>>> So... next.<br>
>>><br>
>>> Fix nut-client.conf contents, and make sure that you can start / <br>
>>> restart the driver as needed with no errors. Set <br>
>>> nut-driver@cyberpower.service to enabled for autostart, so with ONLY <br>
>>> the enumerator services and nut-driver@cyberpower.service enabled, <br>
>>> you should see something like the following for 'systemctl <br>
>>> list-unit-files | grep -i nut':<br>
>>><br>
>>> [root@emp80 ups]# systemctl list-unit-files | grep -i nut<br>
>>> nut-driver-enumerator.path <br>
>>> enabled<br>
>>> nut-driver-enumerator.service <br>
>>> enabled<br>
>>> nut-driver@.service <br>
>>> indirect<br>
>>> nut-monitor.service <br>
>>> disabled<br>
>>> nut-server.service <br>
>>> disabled<br>
>>> nut-driver.target <br>
>>> disabled<br>
>>> nut.target <br>
>>> disabled<br>
>>><br>
>>> Stop any running nut processes, and reboot. On reboot the only thing <br>
>>> that should autostart is nut-driver@cyberpower.service (from the <br>
>>> 'indirect' call via nut-driver@.service). upsc will still not work.<br>
>>><br>
>>> Monitor the driver for a while 'journalctl -u <br>
>>> nut-driver@cyberpower.service -f' and make sure it is stable and <br>
>>> stays connected - google searches show some flakiness with some <br>
>>> cyberpower UPSs.<br>
>>><br>
>>> Once you are confident that the driver is reliable, starting OK and <br>
>>> staying up then move on to nut-server.<br>
>>><br>
>>> I'll check in this evening and we can do some more digging on that.<br>
>>><br>
>>> Simon<br>
>>><br>
>>>><br>
>>>> ===============<br>
>>>> Bill Gee<br>
>>>><br>
>>>> On 11/30/22 07:21, Simon Wilson via Nut-upsuser wrote:<br>
>>>>> Comments inline.<br>
>>>>><br>
>>>>> ----- Message from Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>> ---------<br>
>>>>> Date: Wed, 30 Nov 2022 06:04:14 -0600<br>
>>>>> From: Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>><br>
>>>>> Subject: Re: [Nut-upsuser] NUT no longer works after 2.7 -> 2.8 <br>
>>>>> upgrade<br>
>>>>> To: <a href="mailto:nut-upsuser@alioth-lists.debian.net" target="_blank">nut-upsuser@alioth-lists.debian.net</a><br>
>>>>><br>
>>>>><br>
>>>>>> Hi Simon --<br>
>>>>>><br>
>>>>>> Yes, I am pretty sure this is the RedHat packaging problem. I <br>
>>>>>> sure hope they get it squared away. I have only one system using <br>
>>>>>> nut and that is because all my other systems have APC battery <br>
>>>>>> backup and run apcupsd. Apcupsd may be old, grey and unmaintained, <br>
>>>>>> but it Just Works.<br>
>>>>>><br>
>>>>>> You mention that the STATEPATH line in upsd.conf will override <br>
>>>>>> other settings. It does not appear to be the case for me. The <br>
>>>>>> only way I could get the driver to run was by setting <br>
>>>>>> NUT_STATEPATH on the command line. Perhaps that is an issue with <br>
>>>>>> the driver and not nut-server?<br>
>>>>>><br>
>>>>>> In answer to your questions:<br>
>>>>>><br>
>>>>>> 1) /usr/lib/systemd/system/nut-driver@.service exists. I have <br>
>>>>>> made no changes to it so far. Here are the contents, <br>
>>>>>> unfortunately line-wrapped by Thunderbird.<br>
>>>>>><br>
>>>>>> ================================<br>
>>>>>> [root@mythtv system]# grep -v '^#' nut-driver@.service<br>
>>>>>> [Unit]<br>
>>>>>> Description=Network UPS Tools - device driver for %I<br>
>>>>>> After=local-fs.target<br>
>>>>>><br>
>>>>>><br>
>>>>>> PartOf=nut-driver.target<br>
>>>>>><br>
>>>>>><br>
>>>>>> [Service]<br>
>>>>>> EnvironmentFile=-/etc/ups/nut.conf<br>
>>>>>> SyslogIdentifier=%N<br>
>>>>>> ExecStartPre=-/usr/bin/systemd-tmpfiles --create <br>
>>>>>> /usr/lib/tmpfiles.d/nut-client.conf<br>
>>>>>> ExecStart=/bin/sh -c <br>
>>>>>> 'NUTDEV="`/usr/libexec/nut-driver-enumerator.sh <br>
>>>>>> --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo <br>
>>>>>> "FATAL: Could not find a NUT device section for service unit %i" <br>
>>>>>> >&2 ; exit 1 ; } ; /usr/sbin/upsdrvctl start "$NUTDEV"'<br>
>>>>>> ExecStop=/bin/sh -c <br>
>>>>>> 'NUTDEV="`/usr/libexec/nut-driver-enumerator.sh <br>
>>>>>> --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo <br>
>>>>>> "FATAL: Could not find a NUT device section for service unit %i" <br>
>>>>>> >&2 ; exit 1 ; } ; /usr/sbin/upsdrvctl stop "$NUTDEV"'<br>
>>>>>> StartLimitInterval=0<br>
>>>>>> Restart=always<br>
>>>>>> RestartSec=15s<br>
>>>>>> Type=forking<br>
>>>>>><br>
>>>>>> [Install]<br>
>>>>>> WantedBy=nut-driver.target<br>
>>>>>> ===================================<br>
>>>>><br>
>>>>> OK, so that's the same as mine. It's ExecStartPre task is to create <br>
>>>>> the pid folder from your answer to the third (unasked) question :) <br>
>>>>> which is that outlined in /usr/lib/tmpfiles.d/nut-client.conf<br>
>>>>><br>
>>>>> You have /var/run/nut 0770 root nut - so systemd should ensure that <br>
>>>>> exists.<br>
>>>>><br>
>>>>> By the way, having it with "/var/run/nut" will trigger a 'noise' <br>
>>>>> error about the "/var" path - change it to just be /run/nut in <br>
>>>>> nut-client.conf.<br>
>>>>><br>
>>>>> As a test, what happens if you:<br>
>>>>><br>
>>>>> - make sure nut.conf has MODE=standalone<br>
>>>>> - make sure ALL nut services are stopped, i.e. 'ps -ax | grep ups' <br>
>>>>> should give you only the grep process as an answer<br>
>>>>> - delete /run/nut folder (it will get re-created automatically)<br>
>>>>> - take /etc/ups/upsd.conf back to have commented out STATEPATH as <br>
>>>>> distributed in the package<br>
>>>>> - run "systemctl enable nut-driver-enumerator.path <br>
>>>>> nut-driver-enumerator.service --now" - this will enable and start <br>
>>>>> the services that monitor ups.conf for changes and then write the <br>
>>>>> actual driver service file; the second one also runs early in boot <br>
>>>>> and ensures that the service file exists and is correct.<br>
>>>>> - run 'nut-scanner -U' and copy its output into ups.conf instead of <br>
>>>>> your current definition with name heading [cyberpower], save and <br>
>>>>> exit: this will trigger the above enumerators to run and re-do the <br>
>>>>> nut-driver@cyberpower.service file<br>
>>>>><br>
>>>>> Based on an out of the box install, you have at this point done <br>
>>>>> enough that the driver should run (*should*!!!!)<br>
>>>>><br>
>>>>> - run "journalctl -u nut-driver@cyberpower.service -f" in one <br>
>>>>> terminal while you run "systemctl start <br>
>>>>> nut-driver@cyberpower.service" in another - what does journalctl <br>
>>>>> output?<br>
>>>>><br>
>>>>> Assuming it does not start (based on what you have said below), <br>
>>>>> show the messages.<br>
>>>>><br>
>>>>> If it still does not start as configured above, but you \can/ run <br>
>>>>> /usr/sbin/usbhid-ups with your environment variables specified like <br>
>>>>> you had done before, and it *does* run, then do the following steps <br>
>>>>> to create a systemd drop-in file for the variable, but make the <br>
>>>>> steps use /run/nut instead of /var/run/nut: <br>
>>>>> <a href="https://bugzilla.redhat.com/show_bug.cgi?id=2127269#c8" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/show_bug.cgi?id=2127269#c8</a> (comment 8, <br>
>>>>> formatted for ease of reading). You want to get back to the <br>
>>>>> RH/Fedora default of using /run/nut, not /var/state/ups<br>
>>>>><br>
>>>>> 1. uncomment the "STATEPATH /var/run/nut" as already mentioned<br>
>>>>> 2. create: /etc/systemd/system/nut-driver@.service.d/environ.conf<br>
>>>>> with these two lines:<br>
>>>>><br>
>>>>> [Service]<br>
>>>>> Environment=NUT_STATEPATH=/var/run/nut<br>
>>>>><br>
>>>>> 3. and finally do: systemctl daemon-reload<br>
>>>>><br>
>>>>> ...then try and run systemctl start nut-driver@cyberpower.service <br>
>>>>> again, while monitoring journalctl.<br>
>>>>><br>
>>>>><br>
>>>>> If that does not work - then I'm out of ideas at this point lol... :-D<br>
>>>>><br>
>>>>> 'set' has nothing BTW on my working system related to nut.<br>
>>>>><br>
>>>>>><br>
>>>>>> 2) In /etc/ups/upsd.conf, the original STATEPATH line is<br>
>>>>>><br>
>>>>>> STATEPATH /var/run/nut<br>
>>>>>><br>
>>>>>> Right now the original line is commented and I added another line <br>
>>>>>> to point at /var/state/ups.<br>
>>>>>><br>
>>>>>> 3) You only asked two questions, but I sense a third might be <br>
>>>>>> important. Originally the system had <br>
>>>>>> /usr/lib/tmpfiles.d/nut-common.conf. I have modified that file <br>
>>>>>> and no longer have the original. I copied that file to <br>
>>>>>> nut-client.conf, and both have the same contents:<br>
>>>>>><br>
>>>>>> =======================<br>
>>>>>> # State file (e.g. upsd to driver) and pidfile location for NUT:<br>
>>>>>> D /var/run/nut 0770 root nut - -<br>
>>>>>> X /var/run/nut<br>
>>>>>> ========================<br>
>>>>>><br>
>>>>>> 4) And one more unasked question! :-) When I look at the <br>
>>>>>> environment variables on the system, I see this:<br>
>>>>>><br>
>>>>>> ========================<br>
>>>>>> [root@mythtv tmpfiles.d]# set | grep -i nut<br>
>>>>>> _=/etc/ups/nut.conf<br>
>>>>>> ========================<br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>>>>> Bill Gee<br>
>>>>>><br>
>>>>>> On 11/30/22 01:20, Simon Wilson via Nut-upsuser wrote:<br>
>>>>>>> ----- Message from Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>> ---------<br>
>>>>>>> Date: Tue, 29 Nov 2022 19:25:19 -0600<br>
>>>>>>> From: Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>><br>
>>>>>>> Subject: Re: [Nut-upsuser] NUT no longer works after 2.7 -> 2.8 <br>
>>>>>>> upgrade<br>
>>>>>>> To: Jim Klimov <<a href="mailto:jimklimov%2Bnut@gmail.com" target="_blank">jimklimov+nut@gmail.com</a>><br>
>>>>>>> Cc: Arnaud Quette via Nut-upsuser <br>
>>>>>>> <<a href="mailto:nut-upsuser@alioth-lists.debian.net" target="_blank">nut-upsuser@alioth-lists.debian.net</a>><br>
>>>>>>><br>
>>>>>>><br>
>>>>>>>> I got it to run, but what a mess ...<br>
>>>>>>>><br>
>>>>>>>> Yes, I am running systemctl daemon-reload and systemctl restart <br>
>>>>>>>> nut-server after each change I make.<br>
>>>>>>>><br>
>>>>>>><br>
>>>>>>> Hi Bill,<br>
>>>>>>><br>
>>>>>>> Drivers and upsd share defaults (see 'man nutupsdrv').<br>
>>>>>>><br>
>>>>>>> Your original error message ("writepid: fopen <br>
>>>>>>> /var/run/usbhid-ups-cyberpower.pid: Permission denied") would <br>
>>>>>>> seem to indicate, same as the Red Hat bug, that your driver's <br>
>>>>>>> default pid path is /var/run.<br>
>>>>>>><br>
>>>>>>> The driver by default uses STATEPATH (which can be over-ridden in <br>
>>>>>>> upsd.conf) to store pid files. The driver .service file is <br>
>>>>>>> supposed to make sure that path exists by running the <br>
>>>>>>> ExecStartPre line, which gets its instructions from the <br>
>>>>>>> referenced ".conf" file from /usr/lib/tmpfiles.d. The .service <br>
>>>>>>> file then calls 'upsdrvctl start' to start your usbhid-ups <br>
>>>>>>> driver, as defined in ups.conf. Those all need to align...<br>
>>>>>>><br>
>>>>>>> 2 x questions:<br>
>>>>>>><br>
>>>>>>> 1. Without its comments, what are the active lines (as installed, <br>
>>>>>>> without any changes) in <br>
>>>>>>> /usr/lib/systemd/system/nut-driver@.service (or wherever that <br>
>>>>>>> service file is located on your system)?<br>
>>>>>>> 2. in your upsd.conf (also as installed, without any changes), <br>
>>>>>>> what is the commented out STATEPATH you later mention uncommenting?<br>
>>>>>>><br>
>>>>>>>> I created /usr/lib/tmpfiles.d/nut-client.conf The owner is <br>
>>>>>>>> root:root and permissions are 0644. The contents are<br>
>>>>>>>><br>
>>>>>>>> # State file (e.g. upsd to driver) and pidfile location for NUT:<br>
>>>>>>>> D /var/run/nut 0770 root nut - -<br>
>>>>>>>> X /var/run/nut<br>
>>>>>>>><br>
>>>>>>>> I uncommented the STATEPATH line in /etc/ups/upsd.conf.<br>
>>>>>>>><br>
>>>>>>>> I created a directory /var/state/ups, set to 777 permissions. <br>
>>>>>>>> Changed the STATEPATH line in upsd.conf. No success.<br>
>>>>>>>><br>
>>>>>>>> I looked at /usr/lib/systemd/system/nut-driver@.service but <br>
>>>>>>>> could not see any changes to be made. The bug report at RedHat <br>
>>>>>>>> mentions that a file identified in ExecStartPre does not exist, <br>
>>>>>>>> but I could not duplicate.<br>
>>>>>>>><br>
>>>>>>>> I tried running this as root:<br>
>>>>>>>><br>
>>>>>>>> NUT_STATEPATH=/var/state/ups NUT_ALTPIDPATH=/var/state/ups <br>
>>>>>>>> /usr/sbin/usbhid-ups -u nut -g nut -s cyberpower -x port=auto<br>
>>>>>>>><br>
>>>>>>>> And it works. I tried it with only one or the other of the two <br>
>>>>>>>> environment variables, but did not work. It has to have both.<br>
>>>>>>>><br>
>>>>>>>> ===============<br>
>>>>>>>> Bill Gee<br>
>>>>>>>><br>
>>>>>><br>
>>>>>> _______________________________________________<br>
>>>>>> Nut-upsuser mailing list<br>
>>>>>> <a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
>>>>>> <a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
>>>>><br>
>>>>><br>
>>>>> ----- End message from Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>> -----<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Nut-upsuser mailing list<br>
>>>> <a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
>>>> <a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
>>><br>
>>><br>
>>> ----- End message from Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>> -----<br>
>>><br>
>>><br>
>>><br>
>><br>
>> _______________________________________________<br>
>> Nut-upsuser mailing list<br>
>> <a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
>> <a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
> <br>
> <br>
> ----- End message from Bill Gee <<a href="mailto:bgee@campercaver.net" target="_blank">bgee@campercaver.net</a>> -----<br>
> <br>
> <br>
> <br>
<br>
_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@alioth-lists.debian.net" target="_blank">Nut-upsuser@alioth-lists.debian.net</a><br>
<a href="https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser</a><br>
</blockquote></div>