XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    [SOLVED] Just FYI: current update seams to break NUT dependancies

    Scheduled Pinned Locked Moved Solved XCP-ng
    40 Posts 11 Posters 10.0k Views 11 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FritzGerald @rzr
      last edited by

      @rzr Great. Thank you!

      rzrR 1 Reply Last reply
      Reply Quote 1
      • rzrR rzr referenced this topic on
      • rzrR
        rzr Vates 🪐 XCP-ng Team @FritzGerald
        last edited by

        Package landed in testing repo please check the related announcement:

        https://xcp-ng.org/forum/topic/9964/xcp-ng-8-3-updates-announcements-and-testing/432

        Then please confirm the issue is gone by editing post topic with "[SOLVED]" prefix

        1 Reply Last reply
        Reply Quote 1
        • C
          cobordism
          last edited by

          Just for the record, I get the same snmp errors with OpenIPMI instead of nut.

          # yum update --disablerepo=* --enablerepo=xcp-ng-base,xcp-ng-updates 
          Loaded plugins: fastestmirror
          Loading mirror speeds from cached hostfile
          Excluding mirror: updates.xcp-ng.org
           * xcp-ng-base: mirrors.xcp-ng.org
          Excluding mirror: updates.xcp-ng.org
           * xcp-ng-updates: mirrors.xcp-ng.org
          Resolving Dependencies
          --> Running transaction check
          ---> Package net-snmp.x86_64 1:5.7.2-52.1.xcpng8.3 will be updated
          ---> Package net-snmp.x86_64 1:5.9.3-8.1.xcpng8.3 will be an update
          ---> Package net-snmp-agent-libs.x86_64 1:5.7.2-52.1.xcpng8.3 will be updated
          ---> Package net-snmp-agent-libs.x86_64 1:5.9.3-8.1.xcpng8.3 will be an update
          ---> Package net-snmp-libs.x86_64 1:5.7.2-52.1.xcpng8.3 will be updated
          --> Processing Dependency: libnetsnmp.so.31()(64bit) for package: OpenIPMI-2.0.23-2.el7.x86_64
          ---> Package net-snmp-libs.x86_64 1:5.9.3-8.1.xcpng8.3 will be an update
          --> Finished Dependency Resolution
          Error: Package: OpenIPMI-2.0.23-2.el7.x86_64 (@xcp-ng-base)
                     Requires: libnetsnmp.so.31()(64bit)
                     Removing: 1:net-snmp-libs-5.7.2-52.1.xcpng8.3.x86_64 (@xcp-ng-updates)
                         libnetsnmp.so.31()(64bit)
                     Updated By: 1:net-snmp-libs-5.9.3-8.1.xcpng8.3.x86_64 (xcp-ng-updates)
                        ~libnetsnmp.so.40()(64bit)
                     Available: 1:net-snmp-libs-5.7.2-33.el7_5.2.x86_64 (xcp-ng-base)
                         libnetsnmp.so.31()(64bit)
                     Available: 1:net-snmp-libs-5.7.2-51.1.xcpng8.3.x86_64 (xcp-ng-base)
                         libnetsnmp.so.31()(64bit)
                     Available: 1:net-snmp-libs-5.7.2-51.2.xcpng8.3.x86_64 (xcp-ng-base)
                         libnetsnmp.so.31()(64bit)
                     Available: 1:net-snmp-libs-5.7.2-51.3.xcpng8.3.x86_64 (xcp-ng-base)
                         libnetsnmp.so.31()(64bit)
          
          rzrR 1 Reply Last reply
          Reply Quote 0
          • rzrR
            rzr Vates 🪐 XCP-ng Team @cobordism
            last edited by rzr

            @cobordism said:

            yum update --disablerepo=* --enablerepo=xcp-ng-base,xcp-ng-updates

            It's currently in testing and will move to updates if everything (not only nut) is ok:

            yum install --disablerepo=* \
               --enablerepo=xcp-ng-base,xcp-ng-updates,xcp-ng-testing  nut
            
            1 Reply Last reply
            Reply Quote 1
            • F
              FritzGerald
              last edited by

              Hi, I just wanted to comment that the provided packages work for all my server. Thank you!

              1 Reply Last reply
              Reply Quote 4
              • K
                Kajetan321 @FritzGerald
                last edited by

                @FritzGerald Thank you for taking the time to write up the install procedure. I was able to follow it on my end and it seems to be working. What commands do you use to set the three services to start up automatically at boot up? Right now if I reboot and run upsc apc@localhost it throws an error until I manually do:

                upsdrvctl start
                systemctl start nut-server.service
                systemctl start nut-monitor.service
                
                F 1 Reply Last reply
                Reply Quote 0
                • F
                  FritzGerald @Kajetan321
                  last edited by

                  @Kajetan321 Hi, sorry. I am away from office and I can't tell you that off the top of my head right now. I get back to you during the week.

                  F 1 Reply Last reply
                  Reply Quote 0
                  • F
                    FritzGerald @FritzGerald
                    last edited by FritzGerald

                    Hi @kajetan321, it has been a little while when setting this up. And I have to admit, that I am not sure weather the upcoming instructions are complete. So please take it as an indication:

                    #################################
                    Add Service for ups-driver
                    #################################

                    nano /etc/systemd/system/ups-driver.service
                    
                    [Unit]
                    Description=NUT UPS Driver
                    After=network-online.target
                    Wants=network-online.target
                    Before=nut-server.service
                    
                    [Service]
                    Type=oneshot
                    ExecStart=/usr/sbin/upsdrvctl start
                    ExecStop=/usr/sbin/upsdrvctl stop
                    RemainAfterExit=yes
                    
                    [Install]
                    WantedBy=multi-user.target
                    

                    ###################################
                    Add Requirement for nut-server
                    #################################

                    mkdir -p /etc/systemd/system/nut-server.service.d
                    nano /etc/systemd/system/nut-server.service.d/ups-driver.conf
                    
                    [Unit]
                    Requires=ups-driver.service
                    After=ups-driver.service
                    

                    ###################################
                    Add Requirement for nut monitor
                    #################################

                    mkdir -p /etc/systemd/system/nut-monitor.service.d
                    nano /etc/systemd/system/nut-monitor.service.d/nut-server.conf
                    
                    [Unit]
                    Requires=nut-server.service
                    After=nut-server.service
                    

                    ###################################
                    Enable services
                    ###################################

                    systemctl daemon-reload
                    systemctl enable ups-driver.service
                    systemctl enable nut-server.service
                    systemctl enable nut-monitor.service
                    
                    systemctl start nut-monitor.service
                    

                    ###################################
                    Anaylze tools
                    ###################################

                    systemctl list-dependencies nut-monitor.service
                    systemd-analyze critical-chain nut-monitor.service
                    systemctl show nut-monitor.service -p Requires -p Wants -p After
                    systemctl show nut-server.service -p Requires -p Wants -p After
                    

                    Please let me know if it works, since I then would update my documentation above

                    K 2 Replies Last reply
                    Reply Quote 0
                    • K
                      Kajetan321 @FritzGerald
                      last edited by

                      @FritzGerald Understood. Thanks for posting. I will get back to this as soon as I have some time.

                      1 Reply Last reply
                      Reply Quote 0
                      • K
                        Kajetan321 @FritzGerald
                        last edited by Kajetan321

                        @FritzGerald I followed the procedure outline above. I did not see any errors when following the procedure however when I rebooted and then ran "upsc apc@localhost" I got "Error: Connection failure: Cannot assign requested address"

                        When I run "sudo systemctl status nut-server" I get " Active: inactive (dead)"

                        Running

                        upsdrvctl start
                        systemctl start nut-server.service
                        systemctl start nut-monitor.service
                        

                        fixes the issue. It looks like nut-server still does not start automatically at boot. How would I troubleshoot this further? I'm not a Linux system admin 😞

                        Gemini suggested rebooting and running "journalctl -u nut-server.service -b 0" which resulted in "-- No entries --"

                        F 1 Reply Last reply
                        Reply Quote 0
                        • F
                          FritzGerald @Kajetan321
                          last edited by FritzGerald

                          @Kajetan321

                          I looked into my server and I think I forget some points.

                          First and foremost I have to say, modifying the systemd files can make you system unbootable! It should not happen, but there is chance since we are also modifying some "natively shipped files". So an update can break your working configuration again and that is not the fault of XCP-NG!!!

                          That said I assume that after a reboot (prior to any of any input of yours) if you enter:

                          systemctl status ups-driver.service nut-server.service nut-monitor.service
                          

                          you will see that "ups-driver.service" is loaded and active, but the 2 other services are not. If thats the case I think I can help you since it is related to a dependency problem during boot up. Please do the following:

                          Remove "nut-driver.target" dependency from "nut-server.service" by calling

                          nano /lib/systemd/system/nut-server.service
                          

                          and remove nut-driver.target from routine. I prefer to duplicate and comment the to be modified rows to keep the original code. It then should look like this. DO NOT COPY AND PASTE, read, compare and modify carefully!

                          
                          [Unit]
                          Description=Network UPS Tools - power devices information server
                          #After=local-fs.target network.target nut-driver.target
                          After=local-fs.target network.target
                          # We don't Require drivers to be successfully started! This would be
                          # a change of behavior compared to init SysV, and could prevent from
                          # accessing successfully started, at least to audit a system.
                          #Wants=nut-driver.target
                          Wants=
                          # The `upsd` is a networked service (even if bound to a `localhost`)
                          # so it requires that the OS has some notion of networking already.
                          # Extending the unit does not require *this* file to be edited, you
                          # can instead drop in an additional piece of configuration, e.g. add
                          # a `/etc/systemd/system/nut-server.service.d/network.conf` with:
                          #   [Unit]
                          #   Requires=network-online.target
                          #   After=network-online.target
                          Requires=network.target
                          Before=nut-monitor.service
                          PartOf=nut.target
                          
                          [Service]
                          EnvironmentFile=-/etc/ups/nut.conf
                          SyslogIdentifier=%N
                          # Note: foreground mode by default skips writing a PID file (and
                          # needs Type=simple); can use "-FF" here to create one anyway:
                          ExecStart=/usr/sbin/upsd -F
                          ExecReload=/usr/sbin/upsd -c reload -P $MAINPID
                          
                          [Install]
                          WantedBy=nut.target
                          

                          Afterwards enable nut.target:

                          systemctl enable nut.target
                          

                          Then call:

                          systemctl daemon-reload
                          systemctl start nut.target
                          systemctl start nut-monitor.service
                          

                          Now it should work even after reboot

                          K 1 Reply Last reply
                          Reply Quote 1
                          • poddingueP poddingue marked this topic as a question
                          • K
                            Kajetan321 @FritzGerald
                            last edited by

                            @FritzGerald Thank you for the follow up. It looks to me like none of the three services are running after a reboot.

                            Executing

                            systemctl status ups-driver.service nut-server.service nut-monitor.service
                            

                            Results in:

                            ● ups-driver.service - NUT UPS Driver
                               Loaded: loaded (/etc/systemd/system/ups-driver.service; disabled; vendor preset: disabled)
                               Active: inactive (dead)
                            
                            ● nut-server.service - Network UPS Tools - power devices information server
                               Loaded: loaded (/usr/lib/systemd/system/nut-server.service; enabled; vendor preset: disabled)
                              Drop-In: /etc/systemd/system/nut-server.service.d
                                       └─ups-driver.conf
                               Active: inactive (dead)
                            
                            ● nut-monitor.service - Network UPS Tools - power device monitor and shutdown controller
                               Loaded: loaded (/usr/lib/systemd/system/nut-monitor.service; enabled; vendor preset: disabled)
                              Drop-In: /etc/systemd/system/nut-monitor.service.d
                                       └─nut-server.conf
                               Active: inactive (dead)
                            
                            F 1 Reply Last reply
                            Reply Quote 1
                            • F
                              FritzGerald @Kajetan321
                              last edited by

                              @Kajetan321
                              I think you forgot

                              systemctl enable --now ups-driver.service
                              
                              K 1 Reply Last reply
                              Reply Quote 1
                              • K
                                Kajetan321 @FritzGerald
                                last edited by

                                @FritzGerald

                                Thanks! Running

                                systemctl enable --now ups-driver.service
                                

                                got ups-driver.service going, then following the instructions you provided earlier got the rest of the two services running, even after a reboot.

                                I'm now able to run upsc apc@localhost and get the correct output listing all the properties of the UPS even after a reboot.

                                F 1 Reply Last reply
                                Reply Quote 0
                                • olivierlambertO olivierlambert has marked this topic as solved
                                • F
                                  FritzGerald @Kajetan321
                                  last edited by

                                  @Kajetan321 Thank you for the feedback. I will update the sections above to ease installation for others

                                  1 Reply Last reply
                                  Reply Quote 0
                                  • F
                                    FritzGerald
                                    last edited by

                                    So, for everyone who wants to install NUT as a service follow these steps. Modifying the systemd files can make you system unbootable! It should not happen, but there is chance since we are also modifying some "natively shipped files". So an update can break your working configuration again and that is not the fault of XCP-NG!!!

                                    As prerequisite it requires the installation and testing of this step-by-step guide https://xcp-ng.org/forum/post/104253. Make sure everything runs before proceeding to the following steps! Now:

                                    #################################
                                    Remove "nut-driver.target" dependency
                                    #################################
                                    Remove "nut-driver.target" dependency from "nut-server.service" by calling

                                    nano /lib/systemd/system/nut-server.service
                                    

                                    and remove nut-driver.target from routine. I prefer to duplicate and comment to keep the modified rows in the original code. It then should look like this. DO NOT COPY AND PASTE, read, compare and modify carefully!

                                    [Unit]
                                    Description=Network UPS Tools - power devices information server
                                    #After=local-fs.target network.target nut-driver.target
                                    After=local-fs.target network.target
                                    # We don't Require drivers to be successfully started! This would be
                                    # a change of behavior compared to init SysV, and could prevent from
                                    # accessing successfully started, at least to audit a system.
                                    #Wants=nut-driver.target
                                    Wants=
                                    # The `upsd` is a networked service (even if bound to a `localhost`)
                                    # so it requires that the OS has some notion of networking already.
                                    # Extending the unit does not require *this* file to be edited, you
                                    # can instead drop in an additional piece of configuration, e.g. add
                                    # a `/etc/systemd/system/nut-server.service.d/network.conf` with:
                                    #   [Unit]
                                    #   Requires=network-online.target
                                    #   After=network-online.target
                                    Requires=network.target
                                    Before=nut-monitor.service
                                    PartOf=nut.target
                                    
                                    [Service]
                                    EnvironmentFile=-/etc/ups/nut.conf
                                    SyslogIdentifier=%N
                                    # Note: foreground mode by default skips writing a PID file (and
                                    # needs Type=simple); can use "-FF" here to create one anyway:
                                    ExecStart=/usr/sbin/upsd -F
                                    ExecReload=/usr/sbin/upsd -c reload -P $MAINPID
                                    
                                    [Install]
                                    WantedBy=nut.target
                                    

                                    #################################
                                    Add Service for ups-driver
                                    #################################

                                    nano /etc/systemd/system/ups-driver.service
                                    
                                    [Unit]
                                    Description=NUT UPS Driver
                                    After=network-online.target
                                    Wants=network-online.target
                                    Before=nut-server.service
                                    
                                    [Service]
                                    Type=oneshot
                                    ExecStart=/usr/sbin/upsdrvctl start
                                    ExecStop=/usr/sbin/upsdrvctl stop
                                    RemainAfterExit=yes
                                    
                                    [Install]
                                    WantedBy=multi-user.target
                                    

                                    ###################################
                                    Add Requirement for nut-server
                                    #################################

                                    mkdir -p /etc/systemd/system/nut-server.service.d
                                    nano /etc/systemd/system/nut-server.service.d/ups-driver.conf
                                    
                                    [Unit]
                                    Requires=ups-driver.service
                                    After=ups-driver.service
                                    

                                    ###################################
                                    Add Requirement for nut monitor
                                    #################################

                                    mkdir -p /etc/systemd/system/nut-monitor.service.d
                                    nano /etc/systemd/system/nut-monitor.service.d/nut-server.conf
                                    
                                    [Unit]
                                    Requires=nut-server.service
                                    After=nut-server.service
                                    

                                    ###################################
                                    Enable services
                                    ###################################

                                    systemctl daemon-reload
                                    systemctl enable ups-driver.service
                                    systemctl enable nut.target
                                    systemctl enable nut-server.service
                                    systemctl enable nut-monitor.service
                                    
                                    systemctl start nut-monitor.service
                                    

                                    ###################################
                                    Analyze & debugging commands
                                    ###################################

                                    systemctl list-dependencies nut-monitor.service
                                    systemd-analyze critical-chain nut-monitor.service
                                    systemctl show nut-monitor.service -p Requires -p Wants -p After
                                    systemctl show nut-server.service -p Requires -p Wants -p After
                                    
                                    1 Reply Last reply
                                    Reply Quote 0

                                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                    With your input, this post could be even better 💗

                                    Register Login
                                    • First post
                                      Last post