Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    NUT package (2.8.0 and below)

    Scheduled Pinned Locked Moved UPS Tools
    1.2k Posts 128 Posters 4.8m Views
    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.
    • dennypageD
      dennypage
      last edited by

      @stompro said in NUT package:

      Are you sure about this? It seems like a better method than to hope and assume that the shutdown delay is set to a correct length of time to allow a machine to shut down before the power gets cut. Modern file systems are better, but there are tons of pfSense systems using UFS which is known to handle power cuts poorly.

      Yes. The default kill delay of 20 seconds covers most non NAS systems. The delay is usually controllable so you can adjust it if needed. See the description of variable offdelay in usbhid-ups.

      UFS is an example of why the approach recommended in that FAQ entry is generally a bad idea because it requires that the UFS file system still be mounted when the power is cut. UFS is somewhat fragile and even if quiesced does not appreciate unclean shutdowns.

      Regardless, the quiesce shutdown approach is not something that pfSense supports, let alone the pfSense NUT package. Even if it did, it still wouldn't be a good idea...

      If you are using a UPS that will not obey the kill command if mains returns, it is still much better approach to use a safe complete shut down that requires manual intervention to recover rather than an unsafe shut down that may result in damage to the root file system.

      Let's put some numbers to this. Let's say we have a UPS with a 10 minute run-time before low battery, a 20 second delay on the kill command, and power events that last 0-4 hours with an even distribution.

      4% of the time will be no issue because mains will be restored before shutdown begins. 0.1% of the time, mains will be restored during the kill command delay, and the system will continue the shut down and require external intervention to reboot. However if the system does not use a complete shut down, 96% of the time, the system will still be running when power is cut, exposing the root file system to potential corruption. Even if we say that there is only a 1 in 100 chance (~1%) that the file system will experience corruption, it's still nearly a 10:1 win to use the full and complete shutdown approach.

      Now let's look at the associated costs for those failure cases. In the 0.1% case, the cost of manual intervention is flipping a switch which a lay person can do. In the 1% case, the cost of manual intervention is an experienced system administrator spending significant time on the console fixing file system corruption or performing a complete re-install along with the associated data loss. When you look at the entire picture, it's a very clear and easy choice.

      One last log to throw on the fire... with a dumb UPS and the quiesce and reboot approach, there is a significant exposure if there is a second power event shortly after the system decides to reboot. There is something like a 45 second window during which UPS will likely power off before the system even gets to the point of starting NUT, let alone completing another shutdown. With UFS, the chance of corruption in this case is much higher than 1 in 100. Yes, I know... see variable ondelay in usbhid-ups.

      Ha, I have a brand new Tripp Lite SMART750RM1U that does seem to have this problem.

      Well, that is unfortunate. I can't speak to your specific model, but I used baby Tripp Lites for several years and did not have that problem. I still have a leftover ECO model under my desk for my workstation.

      My "main" UPS have generally been APCs, and they have obeyed power kill with mains live. On one occasion I really wished that they didn't because I was doing NUT testing without sufficient precaution and accidentally took out all my servers at once. Yes, I know... really stupid.

      1 Reply Last reply Reply Quote 0
      • dennypageD dennypage referenced this topic on
      • M mcury referenced this topic on
      • M mcury referenced this topic on
      • JonathanLeeJ
        JonathanLee
        last edited by

        Was the Cyberpower usb issue resolved in 23.05??

        Make sure to upvote

        dennypageD J 2 Replies Last reply Reply Quote 0
        • dennypageD
          dennypage @JonathanLee
          last edited by

          @jonathanlee said in NUT package:

          Was the Cyberpower usb issue resolved in 23.05??

          Not at this time. While there is a new release of NUT available, it hasn't been marked as stable in FreeBSD upstream. I'll reach out to the maintainer.

          JonathanLeeJ dennypageD 2 Replies Last reply Reply Quote 3
          • dennypageD dennypage referenced this topic on
          • R renegade referenced this topic on
          • JonathanLeeJ
            JonathanLee @dennypage
            last edited by

            @dennypage thanks

            Make sure to upvote

            1 Reply Last reply Reply Quote 0
            • provelsP provels referenced this topic on
            • J
              jwfox5150 @JonathanLee
              last edited by

              @dennypage said in NUT package:

              @jonathanlee said in NUT package:

              Was the Cyberpower usb issue resolved in 23.05??

              Not at this time. While there is a new release of NUT available, it hasn't been marked as stable in FreeBSD upstream. I'll reach out to the maintainer.

              Can confirm. Had to replace usbhid-ups with the above version from @dennypage again. It's worth noting that in 23.01 I did not have to modify ups.conf, but with 23.05, I did need to add user=root to ups.conf.

              1 Reply Last reply Reply Quote 1
              • JonathanLeeJ
                JonathanLee
                last edited by

                Just to confirm with all the extra setting changes with Nut installed in PfSense 23.05 example, timers and "user=root," the system again lost connection after a couple hours.

                Make sure to upvote

                1 Reply Last reply Reply Quote 1
                • dennypageD
                  dennypage @dennypage
                  last edited by

                  @dennypage said in NUT package:

                  Not at this time. While there is a new release of NUT available, it hasn't been marked as stable in FreeBSD upstream. I'll reach out to the maintainer.

                  My bad. I jumped the gun a bit. While there is a new release version pending, it has not actually been tagged yet and still has a few blockers. Sorry about that.

                  1 Reply Last reply Reply Quote 2
                  • O
                    OffstageRoller
                    last edited by

                    I forgot about this issue and it returned after upgrading from pfSense Plus 23.01 to pfSense Plus 23.05. It took me a bit of time to track this down and find the file in this thread that fixes it.

                    Because of that, I decided to put this in an Ansible playbook so the fix is in code and I don't need to worry about it in the future.

                    I put a gist up on GitHub of my playbook in case anyone finds it helpful:
                    pfSense NUT Package Fix Through Ansible

                    1 Reply Last reply Reply Quote 2
                    • G
                      ghound
                      last edited by

                      I recently setup a new Tripp Lite ECO850LCD UPS for my Netgate SG-1100 (23.05). I installed the Nut Package (2.8.0_2). Other than adding user=root to ups.conf section of advanced settings, it's a clean install (as far as I know).

                      usbhid-ups seems to start up and upsmon is getting updates.
                      Screenshot 2023-06-04 at 2.53.13 PM.png
                      Screenshot 2023-06-04 at 2.54.36  PM_Redacted.png

                      Problem is: ups.status changes from OL to OB and back to OL also indicating discharging and charging state, but there is never a LOW BATT status.
                      Messages are sent to console and syslog showing UPS is online and on battery, but no low battery notifications.
                      That means PfSense never does shutdown and the UPS never turns off load.

                      UPS runs down to battery.charge=0 and battery.runtime=30, SG-1100 is still powered (I don't know how much longer it would go since I went back on mains at that point.)

                      Sorry to be such a noob, but what do I need to do to get the UPS to notify low battery or work around this problem?

                      Don't know if it is significant but I note that battery.charge.low is not reported by upsc also battery.charge.low can not be set using upsrw.

                      Any help appreciated.

                      dennypageD 1 Reply Last reply Reply Quote 0
                      • dennypageD
                        dennypage @ghound
                        last edited by

                        @ghound said in NUT package:

                        Problem is: ups.status changes from OL to OB and back to OL also indicating discharging and charging state, but there is never a LOW BATT status.
                        Messages are sent to console and syslog showing UPS is online and on battery, but no low battery notifications.
                        That means PfSense never does shutdown and the UPS never turns off load.

                        UPS runs down to battery.charge=0 and battery.runtime=30, SG-1100 is still powered (I don't know how much longer it would go since I went back on mains at that point.)

                        I have used an ECO Tripp Lite in the past, and don't recall it having that issue. That said, to address the situation you can add the following in the Extra Arguments to driver section on the UPS Settings page:

                        ignorelb
                        override.battery.charge.low = 10
                        override.battery.runtime.low = 120
                        

                        For more information, see the UPS FIELDS section in the ups.conf documentation.

                        G 1 Reply Last reply Reply Quote 1
                        • G
                          ghound @dennypage
                          last edited by

                          @dennypage
                          Thank you Denny. Those changes did the trick!
                          NUT shutdown PfSense and UPS disconnected shortly afterward.
                          Everything started normally after reconnected to mains.

                          I noticed new syslog entries by usbhid-ups for:
                          using 'battery.charge' to set battery low state
                          using 'battery.runtime' to set battery low state

                          Also, new entries appeared from upsc for:
                          battery.charge.low: 10
                          battery.runtime.low: 120
                          driver.flag.ignorelb: enabled

                          I thought I had tried those changes before without success; I suspect I didn't do a good job of isolating what I was trying.

                          Appreciate your help.

                          1 Reply Last reply Reply Quote 0
                          • M
                            Maltz @dennypage
                            last edited by

                            @dennypage said in NUT package:

                            I've received several requests for the dev build of usbhid-ups, so I thought I would upload the file here.

                            usbhid-ups.gz

                            For reference, the shasum and sha256sum checksums of the unzipped file are:

                            49ce9131502bfb8b789ee97b7fb3fc81fc9f8fff  usbhid-ups
                            999a2653559dbc50ecc8ba592a67587b1e307a1495f6e8ebbd3d8e90e3967133  usbhid-ups
                            

                            If you use the file, please post and let me know if it resolves an issue for you.

                            I'm assuming this is an Intel build, since it (unsurprisingly) didn't work at all on my Netgate 2100. lol Do you have any idea what the ETA is for an update to the NUT package that would include this patch? If not, or if it's still going to be a while, would it be possible for you to post an ARM build of the patched driver?

                            dennypageD 1 Reply Last reply Reply Quote 0
                            • dennypageD
                              dennypage @Maltz
                              last edited by

                              @Maltz said in NUT package:

                              I'm assuming this is an Intel build, since it (unsurprisingly) didn't work at all on my Netgate 2100.

                              Yes, it's an intel build. I don't have an ARM system. I have some free time coming up, and will look at building a cross compile environment.

                              M 1 Reply Last reply Reply Quote 0
                              • M
                                Maltz @dennypage
                                last edited by

                                @dennypage said in NUT package:

                                @Maltz said in NUT package:

                                I'm assuming this is an Intel build, since it (unsurprisingly) didn't work at all on my Netgate 2100.

                                Yes, it's an intel build. I don't have an ARM system. I have some free time coming up, and will look at building a cross compile environment.

                                I've got an RPi 4 running Ubuntu, if that'll work. I tried a few times to build it, but my Netgate didn't care for the results, so far. I'm probably configuring the build wrong somehow. If you have a ./configure command, I'd be happy to build 2.8.0 myself and post the result here.

                                dennypageD 1 Reply Last reply Reply Quote 0
                                • dennypageD
                                  dennypage @Maltz
                                  last edited by

                                  @Maltz said in NUT package:

                                  I've got an RPi 4 running Ubuntu, if that'll work. I tried a few times to build it, but my Netgate didn't care for the results, so far. I'm probably configuring the build wrong somehow. If you have a ./configure command, I'd be happy to build 2.8.0 myself and post the result here.

                                  A Pi running Ubuntu will not work. pfSense is based on FreeBSD rather than Linux. You need to be running FreeBSD to build from the FreeBSD Ports collection.

                                  The cross compile situation I was referring to was building FreeBSD ARM from a FreeBSD Intel system.

                                  M 1 Reply Last reply Reply Quote 1
                                  • M
                                    Maltz @dennypage
                                    last edited by

                                    @dennypage said in NUT package:

                                    A Pi running Ubuntu will not work. pfSense is based on FreeBSD rather than Linux. You need to be running FreeBSD to build from the FreeBSD Ports collection.

                                    The cross compile situation I was referring to was building FreeBSD ARM from a FreeBSD Intel system.

                                    I figured Linux vs FreeBSD was the other likely reason it didn't work. I'm quite unfamiliar with FreeBSD and it's package/ports system, but that post gave me enough info to google my way through compiling 2.8.0 on FreeBSD on my spare Pi4. (Interestingly, the RPi version of FreeBSD doesn't have nut in its package repository, I DID have to compile it from ports.) The replacement USB driver is running fine so far on my Netgate 2100. I'll post the binary here later today.

                                    Thanks so much for sussing out the various issues in this thread - it's certainly helped me tremendously, and I'm sure many others as well!

                                    dennypageD 1 Reply Last reply Reply Quote 1
                                    • dennypageD
                                      dennypage @Maltz
                                      last edited by

                                      @Maltz said in NUT package:

                                      The replacement USB driver is running fine so far on my Netgate 2100. I'll post the binary here later today.

                                      Thank you for this.

                                      1 Reply Last reply Reply Quote 0
                                      • M
                                        Maltz
                                        last edited by

                                        This post is deleted!
                                        1 Reply Last reply Reply Quote 1
                                        • M
                                          Maltz
                                          last edited by

                                          I have realized that all I did was re-compile the problematic v2.8.0 instead of the devel version. Oops. Here's the ARM verson of usbhid-ups from nut-devel-2023.06.06

                                          usbhid-ups.gz

                                          sha256sum of uncompressed file:
                                          cdeb8d4400e0c721c878c0af084f48356323c29b7f9ef4fc526b4d9a3ff339a5 usbhid-ups

                                          keyserK 1 Reply Last reply Reply Quote 1
                                          • I
                                            incith
                                            last edited by incith

                                            Since upgrading to 2.7 nut keeps telling me "UPS is unavailable" and connection lost/unable to communicate. It's a cyberpower 1500pfclcd. It worked absolutely perfectly on 2.6. Not sure what might have changed? Using snmp to connect to the power panel software on a windows machine that hosts the UPS.

                                            I've tried everything I can think of, removing, reinstalling, redoing config etc. It still pulls the stats so I know it's not actually a connection issue, the snmp portion and driver appear to be working properly.

                                            I tried changing pollinterval to 12 and 15 and it still happened.

                                            Edit: I am also noticing the "summary status" is blank. I think it used to say "online" and might explain what's going on

                                            I dennypageD D 3 Replies Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.