Looking at my system, I find that /usr/lib/tmpfiles.d/nut-client.conf already exists. Its contents are

============  begin paste
# State file (e.g. upsd to driver) and pidfile location for NUT:
D /run/nut 0770 root nut - -
X /run/nut
===========  end paste

The directory /run/nut exists with permissions 0770. The owner and group are root:dialout, which seems odd. The system has a group called "nut" and also a group called "dialout" which has as one of its members the user named "nut". /run/nut contains several files:

===========  begin paste
[root@mythtv log]# ll /run/nut
total 4
drwxrwx--- 2 nut dialout 40 Jul 28 16:24 upssched
srw-rw---- 1 nut nut      0 Jul 28 16:26 usbhid-ups-cyberpower
-rw-r--r-- 1 nut nut      5 Jul 28 16:26 usbhid-ups-cyberpower.pid
==============  end paste

Looking through the system log file /var/log/messages, I see this issued during startup:

===========  begin paste
Jul 28 16:03:38 mythtv systemd-tmpfiles[520178]: /usr/lib/tmpfiles.d/nut-common-tmpfiles.conf:8: Duplicate line for path "/run/nut", ignoring.
Jul 28 16:06:49 mythtv nut-server[8759]: mainloop: Interrupted system call
Jul 28 16:06:49 mythtv nut-server[8759]: Signal 15: exiting
===========  end paste

A successful start gives these entries in /var/log/messages:

===========  begin paste
Jul 28 16:07:58 mythtv systemd-tmpfiles[733]: /usr/lib/tmpfiles.d/nut-common-tmpfiles.conf:8: Duplicate line for path "/run/nut", ignoring. Jul 28 16:09:58 mythtv systemd[1]: Created slice system-nut\x2ddriver.slice - Slice /system/nut-driver. Jul 28 16:09:58 mythtv udevadm[1663]: systemd-udev-settle.service is deprecated. Please fix [email protected] not to pull it in. Jul 28 16:09:58 mythtv systemd[1]: Starting [email protected] - Network UPS Tools - device driver for NUT device 'cyberpower'... Jul 28 16:09:58 mythtv nut-driver@cyberpower[1696]: Using subdriver: CyberPower HID 0.80 Jul 28 16:09:58 mythtv nut-driver@cyberpower[1696]: Network UPS Tools - Generic HID driver 0.53 (2.8.2) Jul 28 16:09:58 mythtv nut-driver@cyberpower[1696]: USB communication driver (libusb 1.0) 0.47 Jul 28 16:09:58 mythtv nut-driver@cyberpower[1696]: cps_adjust_battery_scale: battery readings will be scaled by 2/3 Jul 28 16:09:58 mythtv nut-driver@cyberpower[1667]: Network UPS Tools - UPS driver controller 2.8.2 Jul 28 16:09:58 mythtv systemd[1]: Started [email protected] - Network UPS Tools - device driver for NUT device 'cyberpower'. Jul 28 16:09:58 mythtv systemd[1]: Reached target nut-driver.target - Network UPS Tools - target for power device drivers on this system. Jul 28 16:09:58 mythtv systemd[1]: Starting nut-server.service - Network UPS Tools - power devices information server... Jul 28 16:09:58 mythtv nut-server[1706]: Limit Soft Limit Hard Limit Units Jul 28 16:09:58 mythtv nut-server[1706]: Max open files 1048576 1048576 files Jul 28 16:09:58 mythtv systemd[1]: Started nut-server.service - Network UPS Tools - power devices information server. Jul 28 16:09:59 mythtv nut-server[1705]: fopen /run/nut/upsd.pid: No such file or directory Jul 28 16:09:59 mythtv nut-server[1705]: Could not find PID file '/run/nut/upsd.pid' to see if previous upsd instance is already running!
Jul 28 16:09:59 mythtv nut-server[1705]: listening on ::1 port 3493
Jul 28 16:09:59 mythtv nut-server[1705]: listening on 127.0.0.1 port 3493
Jul 28 16:09:59 mythtv nut-server[1705]: Connected to UPS [cyberpower]: usbhid-ups-cyberpower
Jul 28 16:09:59 mythtv nut-server[1705]: Found 1 UPS defined in ups.conf
Jul 28 16:09:59 mythtv nut-server[1705]: Running as foreground process, not saving a PID file Jul 28 16:09:59 mythtv nut-server[1705]: upsnotify: failed to notify about state 2: no notification tech defined, will not spam more about it
============  end paste


===============
Bill Gee

On 7/28/24 17:44, Simon Wilson via Nut-upsuser wrote:
I've had fun with nut on RH systems, these are my notes to get it working:

/Create /usr/lib/tmpfiles.d/nut-client.conf:/

/D    /run/nut 0770 root nut - /

/...the file did not exist, and so the PID folder/file was not getting generated. Then the driver would start./

/Also had to setup enabled services (still not 100% confident that this is totally correct):/

/[root@emp80 ups]# systemctl list-unit-files | grep -i nut nut-driver-enumerator.path  disabled nut-driver-enumerator.service           disabled [email protected]                   disabled nut-monitor.service                           disabled nut-server.service                                    disabled nut-driver.target                                             enabled nut.target                                                    enabled/

I made no changes to unit files. Result:

[root@emp90 ~]# systemctl list-units | grep nut
 [email protected]                                      loaded active running   Network UPS Tools - device driver for eaton5sx  nut-monitor.service                                      loaded active running   Network UPS Tools - power device monitor and shutdown controller  nut-server.service                                     loaded active running   Network UPS Tools - power devices information server  system-nut\x2ddriver.slice                                     loaded active active    Slice /system/nut-driver  nut-driver.target                                      loaded active active    Network UPS Tools - target for power device drivers on this system  nut.target                                     loaded active active    Network UPS Tools - target for power device drivers, data server and monitoring client (if enabled) on this system

Simon


On Monday, July 29, 2024 07:52 AEST, Tim Dawson <[email protected]> wrote:

Look in the startup logs and see where itnis starting. I'm not at a RH system at the moment, but at work, I have had to do this, so can look there,mor perhaps put Nut on the test RH8 VM I spun up for other rrasons on Friday and work out the syntax. Not sure if the systemd file you are using came in the RPM or not, but if it did, it's almost a crime that this critical detail was overlooked.



On July 28, 2024 5:33:25 PM EDT, Bill Gee <[email protected]> wrote:

    No luck.  I modified both /usr/lib/systemd/system/nut.target and
    /usr/lib/systemd/nut-server.target  The behavior did not change.

    Looking at it a bit more, I noticed a comment in
    /usr/lib/systemd/system/nut-server.service to the effect that the
    network does not need to be running - merely present - when nut
    starts. If a running network is wanted, then a new file needs to
    be added.

    I created /etc/systemd/system/nut-server.service.d/network.conf
    with these three lines:

    [Unit]
    Requires=network-online.target
    After=network-online.target

    I ran "systemctl daemon-reload" and rebooted.  Still no luck.
    nut-server did not start during the boot.  It starts with no
    problems when run from a command line:
    ------------------------------------------------------------------------
    [root@mythtv ~]# systemctl 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)
        Drop-In: /usr/lib/systemd/system/service.d
                 └─10-timeout-abort.conf
                 /etc/systemd/system/nut-server.service.d
                 └─environ.conf, network.conf
         Active: inactive (dead)
    [root@mythtv ~]# systemctl start nut-server
    [root@mythtv ~]# systemctl 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)
        Drop-In: /usr/lib/systemd/system/service.d
                 └─10-timeout-abort.conf
                 /etc/systemd/system/nut-server.service.d
                 └─environ.conf, network.conf
         Active: active (running) since Sun 2024-07-28 16:26:42 CDT;
    2s ago
        Process: 1703 ExecStartPre=/usr/bin/systemd-tmpfiles --create
    /usr/lib/tmpfiles.d/nut-common-tmpfiles.conf (code=ex>
        Process: 1706 ExecStartPost=/bin/grep -E Units|Max open files
    /proc/${MAINPID}/limits (code=exited, status=0/SUCCES>
       Main PID: 1705 (upsd)
          Tasks: 1 (limit: 9460)
         Memory: 944.0K (peak: 2.9M)
            CPU: 27ms
         CGroup: /system.slice/nut-server.service
                 └─1705 /usr/sbin/upsd -F
    ------------------------------------------------------------------------
    Bill Gee

    On 7/28/24 13:53, Tim Dawson wrote:

        Wants=network.target network-online.target
        After=network.target network-online.target

        Seems to be the case on RedHat8, and other RedHat based
        distros should match.


        On July 28, 2024 1:56:49 PM EDT, Bill Gee
        <[email protected]> wrote:

            These files came from the distro package. I did not change
        anything
            myself. Systemd newbie here ...

            So the detailed question is - Exactly what change is
        needed to add
            the network-target dependency? I suspect it is not enough
        to simply
            remove the comment symbol on those two lines.
        ------------------------------------------------------------------------
           Bill Gee

            On 7/28/24 10:10, Tim Dawson wrote:

                Seems like you would also want the "network-target"
        dependency,
                since nut will likelynfail without networking being
        up. (This
                would also explwin why the sysctl start ... works
        after boot,
                but not during . . .


                On July 28, 2024 10:37:15 AM EDT, Bill Gee
                <[email protected]> wrote:

                I have also been having this problem. Checking a few
        of the files

    ------------------------------------------------------------------------
    Nut-upsuser mailing list
    [email protected]
    https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser 
<https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser>

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.


--

Simon Wilson
M: 0400 121 116

_______________________________________________
Nut-upsuser mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

_______________________________________________
Nut-upsuser mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to