OK, looking at this on my RH8 test image . . .

The first thing that I note, is that the *only* thing that needed to be set to "enabled" in systemctl (IE "systemctl enable ....") is the nut.target entry.

All else here are disabled, and "drug along" by nut.target which ensures that they come up in sequence.

In nut.target I added to the "After" and "Wants" lines thus to force it to wait until network startup is complete:

After=local-fs.target nut-driver.target nut-server.service nut-monitor.service network.target network-online.target Wants=local-fs.target nut-driver.target nut-server.service nut-monitor.service network.target network-online.target

This should cause nut.target to not run until the network is up, and it will start the other nut modules accordingly.

If the other nut modules (driver, etc) are set to "enabled" they will autostart independently of nut.target, and you will have a mess on your hands.

So far, no errors testing here . . .

- Tim

On 7/28/24 17:52, Tim Dawson 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

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

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

--
Tim Dawson

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

Reply via email to