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.0m 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.
    • N
      Nuggets 0 @dennypage
      last edited by

      @dennypage said in NUT package:

      @Nuggets-0

      Do

      chown nut /var/db/nut
      

      and restart the service.

      So naturally, my previous steps didn't fix it.

      Running chown as requested didn't fix it as /var/db/nut was already owned by nut.

      However, with the dev usbhid-ups, I set user=nut in ups.conf and it came up. For the record, user=root worked too but I wanted to get it working with the nut user instead of root. Not sure why user=nut works. The daemon is supposed to start as the user nut and nut has all the right properties (owner and 750). But at least it's working on the dev usbhid-ups now.

      I'll monitor for a bit and come back.

      I 1 Reply Last reply Reply Quote 0
      • I
        incith @Nuggets 0
        last edited by

        @Nuggets-0 it's a local daemon just run it as root why complicate things

        N 1 Reply Last reply Reply Quote 0
        • N
          Nuggets 0 @incith
          last edited by Nuggets 0

          @incith said in NUT package:

          @Nuggets-0 it's a local daemon just run it as root why complicate things

          Both user=root and user=nut worked both the same. I merely tested using user=nut on a whim and it worked.

          I have my upsd hosting the NUT server so it's available to other servers running on the same UPS. I want pfsense to be the last server running should everything else need to go down, so it makes sense to host it on pfsense. I have rules in place as well as a user/password to prevent from unfettered access. So having it run as root is a potential risk to me, not so much others.

          What I don't understand is WHY it works when using user=nut. usbhid-ups is supposed to start as the nut user anyways. Here usbhid-ups running on the original file:
          79502 nut 1 20 0 13M 3420K select 0 0:00 0.01% usbhid-ups

          Using user=nut The nut user is the owner and has full access to associated files. user=nut is telling the nut user to act like itself. Of course, this could all be my confusion with what is getting started with nut vs root.

          Edit: Forgot to mention, it had been running fine under user=nut for at least 12 hours. Telegram bots had an outage yesterday so it did some funky stuff in pfsense with my notifications, so I restarted the NUT service so it would initiate monitoring again. Will update probably tomorrow to give it more time to run into any issues.

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

            @Nuggets-0 The old version wanted to be "uucp" and the new version wants to be "nut", so now there is a disagreement between the NUT executable and the pfSense NUT package.

            1 Reply Last reply Reply Quote 0
            • S
              Samlink
              last edited by

              Hello, I recently re-activated the SMTP notifications after 1 year of using only telegram (because of https://redmine.pfsense.org/issues/14031), but I no longer receive NUT notifications on email, only telegram.

              On nut settings, the Enable notifications is checked.
              I'm running 2.8.0_2.

              Am I missing something?

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

                @Samlink Unfortunately, the fix for the Redmine issue you referred to broke the smtp notification mechanism for non root processes. I am hoping this gets fixed in the next release set.

                In the interim, you should be able to work around the issue by adding

                RUN_AS_USER root
                

                in the "Additional configuration lines for upsmon.conf" section.

                1 Reply Last reply Reply Quote 1
                • D
                  daplumber
                  last edited by daplumber

                  So here's another data point:

                  Finally got around to buying a new UPS for my pfsense box (A 4 core i5-6500 Dell Optiplex)
                  pfsense 23.05.1-RELEASE and nut 2.8.0_2
                  CyberPower CST135UC2 $120 from Costco - I really should have known better, but I'd used CPS UPS' with pfsense NUT before with no issues. Sigh.

                  After much futzing and the dreaded CPS disconnect yo-yo and much searching I finally found this thread.

                  So I now have a stable UPS, yay.

                  All it took was adding the "user=root" to ups.conf
                  AND
                  "interruptonly" to driver arguments.

                  I see far fewer parameters, but I can live with the workarounds. For grins and giggles they are:

                  Variable	Value
                  battery.charge	100
                  battery.runtime	16525
                  battery.runtime.low	300
                  device.mfr	CPS
                  device.model	CST135UC2
                  device.serial	CDZNP7001732
                  device.type	ups
                  driver.flag.interruptonly	enabled
                  driver.name	usbhid-ups
                  driver.parameter.pollfreq	30
                  driver.parameter.pollinterval	2
                  driver.parameter.port	auto
                  driver.parameter.synchronous	auto
                  driver.version	2.8.0
                  driver.version.data	CyberPower HID 0.6
                  driver.version.internal	0.47
                  driver.version.usb	libusb-1.0.0 (API: 0x1000102)
                  ups.beeper.status	disabled
                  ups.mfr	CPS
                  ups.model	CST135UC2
                  ups.productid	0601
                  ups.serial	CDZNP7001732
                  ups.status	OL
                  ups.vendorid	0764
                  
                  

                  and here's the "usbconfig -v -d ugen0.5 show_ifdrv" output:

                  ugen0.5: <CPS CST135UC2> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
                  
                    bLength = 0x0012 
                    bDescriptorType = 0x0001 
                    bcdUSB = 0x0200 
                    bDeviceClass = 0x0000  <Probed by interface class>
                    bDeviceSubClass = 0x0000 
                    bDeviceProtocol = 0x0000 
                    bMaxPacketSize0 = 0x0040 
                    idVendor = 0x0764 
                    idProduct = 0x0601 
                    bcdDevice = 0x0200 
                    iManufacturer = 0x0003  <retrieving string failed>
                    iProduct = 0x0001  <CST135UC2>
                    iSerialNumber = 0x0002  <CDZNP7001732>
                    bNumConfigurations = 0x0001 
                  
                  
                   Configuration index 0
                  
                      bLength = 0x0009 
                      bDescriptorType = 0x0002 
                      wTotalLength = 0x0029 
                      bNumInterfaces = 0x0001 
                      bConfigurationValue = 0x0001 
                      iConfiguration = 0x0000  <no string>
                      bmAttributes = 0x00c0 
                      bMaxPower = 0x0032 
                  
                      Interface 0
                        bLength = 0x0009 
                        bDescriptorType = 0x0004 
                        bInterfaceNumber = 0x0000 
                        bAlternateSetting = 0x0000 
                        bNumEndpoints = 0x0002 
                        bInterfaceClass = 0x0003  <HID device>
                        bInterfaceSubClass = 0x0000 
                        bInterfaceProtocol = 0x0000 
                        iInterface = 0x0000  <no string>
                  
                        Additional Descriptor
                  
                        bLength = 0x09
                        bDescriptorType = 0x21
                        bDescriptorSubType = 0x11
                         RAW dump: 
                         0x00 | 0x09, 0x21, 0x11, 0x01, 0x21, 0x01, 0x22, 0xd6, 
                         0x08 | 0x02
                  
                       Endpoint 0
                          bLength = 0x0007 
                          bDescriptorType = 0x0005 
                          bEndpointAddress = 0x0081  <IN>
                          bmAttributes = 0x0003  <INTERRUPT>
                          wMaxPacketSize = 0x0040 
                          bInterval = 0x0020 
                          bRefresh = 0x0000 
                          bSynchAddress = 0x0000 
                  
                       Endpoint 1
                          bLength = 0x0007 
                          bDescriptorType = 0x0005 
                          bEndpointAddress = 0x0002  <OUT>
                          bmAttributes = 0x0003  <INTERRUPT>
                          wMaxPacketSize = 0x0040 
                          bInterval = 0x0020 
                          bRefresh = 0x0000 
                          bSynchAddress = 0x0000 
                  
                  

                  The really weird part is the id wasn't recognized on some of the ports, which considering they're all ugen0 was a little freaky.

                  So that's what I get for being lazy and cheap. Sigh again.

                  Now I just have to remember to remove everything when the nut package eventually gets updated.

                  Thank you for all the hard work here, and I volunteer as guinea pig for testing patched code if needed. Since the Optiplex is Intel i5, 4 cores, 8GB of RAM and about half a TB of SSD free it's not exactly a constrained test platform. Happy to set up a user for ssh or VPN remote access during test periods My home fiber is 1G/1G uncapped so slinging large files around isn't much of an issue either.

                  –--------
                  This user has been carbon dated to the 8-bit era...

                  keyserK 1 Reply Last reply Reply Quote 0
                  • keyserK
                    keyser Rebel Alliance @daplumber
                    last edited by

                    @daplumber I would just like to add, that while there are “bad” UPS’s out there, I think the BSD crowd should take a long breath and have a look in its own backyard. I have suffered the disconnect issues on two different pfSenses (x64 and Arm) with two different UPS’s (Eaton and CyperPower), and the only stable solution was to connect the UPSes to my Windows Server or my Linux Raspberry Pi. None of those platforms suffered the disconnect issue and both UPS’s were perfectly stable there.
                    So I would still argue your issue is just as likely with the USB implementation in BSD.

                    Love the no fuss of using the official appliances :-)

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

                      @keyser The disconnect issue with CyberPower UPSs is fairly well known. It happens on Linux and Windows as well. Usually it is not a real issue because the reconnect logic covers it. The issue which exposes it here is that we are using the 2.8.0 release of NUT, which has some significant USB library issues. Almost all other distributions have abandoned 2.8.0 and moved to the dev version.

                      I've been patiently waiting for 2.8.1, but it keeps getting pushed out so I've started working on moving to dev. I remain utterly convinced that 2.8.1 will be released the day after I complete the move to dev. 😧

                      D 1 Reply Last reply Reply Quote 1
                      • D
                        daplumber @dennypage
                        last edited by daplumber

                        @dennypage said in NUT package:

                        I've been patiently waiting for 2.8.1, but it keeps getting pushed out so I've started working on moving to dev. I remain utterly convinced that 2.8.1 will be released the day after I complete the move to dev. 😧

                        Hah, a fellow believer in Saint Murphy the patron saint of software development! (Amongst many other things.)

                        Of course if you DON’T move to dev, nut 2.8.1 will never see the light of day. Sigh.

                        Oh, and USB is a crazy collection of not-particularly-well-defined-standards where weird… stuff happens on a regular basis. It’s the worst possible interface… except for all the others. Shrug.

                        –--------
                        This user has been carbon dated to the 8-bit era...

                        1 Reply Last reply Reply Quote 0
                        • A
                          abs0new Rebel Alliance
                          last edited by

                          Hi folks

                          hope you're doing well

                          I got big issues with nut on multiple sites.

                          see : https://redmine.pfsense.org/issues/14795

                          Correct me if i'm wrong i need to use the devel package instead of the 2.8.0 port right ?

                          I need a little hint on how i can install the devel package which presumably correct the problem.

                          i tried make the package :

                          git clone https://github.com/pfsense/FreeBSD-ports.git
                          cd sysutils/nut-devel/
                          make package
                          

                          i got :

                          make: "/usr/share/mk/bsd.port.mk" line 32: Cannot open /usr/ports/Mk/bsd.port.mk
                          make: "/root/nut-devel/Makefile" line 149: Malformed conditional (${PORT_OPTIONS:MUSB})
                          make: "/root/nut-devel/Makefile" line 156: Malformed conditional (${PORT_OPTIONS:MBASH})
                          make: "/root/nut-devel/Makefile" line 160: Malformed conditional (${PORT_OPTIONS:MDOCS})
                          make: "/usr/share/mk/bsd.port.mk" line 32: Cannot open /usr/ports/Mk/bsd.port.mk
                          make: Fatal errors encountered -- cannot continue
                          make: stopped in /root/nut-devel
                          

                          so i tried with gmake :

                          gmake package
                          

                          i got this :

                          Makefile:137: *** missing separator.  Stop.
                          

                          Can someone give me some hint here ?

                          Thank you ;)

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

                            @abs0new farther back in this thread you will find dev build executables that have been shared.

                            A 1 Reply Last reply Reply Quote 1
                            • zeemaffinZ
                              zeemaffin
                              last edited by

                              Hi!

                              I came across this problem and I can't seem to find the answer in the thread.
                              I have a PFsense 6100 MAX , its on 23.05.1-Release at the moment.

                              Installed NUT services and connected my Lenovo UPS (55942KX) via USB to the firewall.
                              I am using an SRS232 to USB cable.

                              The summary says its failed to retrieve status.
                              Logs:
                              Oct 11 12:04:43 upsmon 54986 Poll UPS [Lenovo_UPS] failed - Driver not connected
                              Oct 11 12:04:45 upsd 56388 Can't connect to UPS [Lenovo_UPS] (usbhid-ups-Lenovo_UPS): No such file or directory
                              Oct 11 12:04:53 upsmon 54986 Poll UPS [Lenovo_UPS] failed - Driver not connected
                              Oct 11 12:04:58 upsmon 54986 Poll UPS [Lenovo_UPS] failed - Driver not connected
                              Oct 11 12:05:03 upsmon 54986 Poll UPS [Lenovo_UPS] failed - Driver not connected
                              Oct 11 12:05:08 upsmon 54986 Poll UPS [Lenovo_UPS] failed - Driver not connected
                              Oct 11 12:05:08 upsmon 54986 UPS Lenovo_UPS is unavailable

                              I have tried with all of the drivers from the drop-down menu without success.
                              I am sure I am missing something from the configuration, but I am technically stuck at this point. Maybe I am just dumb to even try to use the USB option, but unfortunatly I don't have other solutions for this UPS.

                              Can you guys show me a path where should I start poking around?
                              Kind regards,
                              Zee Muffin man,

                              M dennypageD 2 Replies Last reply Reply Quote 0
                              • M
                                Maltz @zeemaffin
                                last edited by

                                @zeemaffin

                                That should probably be using a serial driver, not USB. The serial port is connected via USB, but the UPS is connected via serial. I.e., the UPS isn't going to show up as a USB device for the USB driver to communicate with.

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

                                  @zeemaffin said in NUT package:

                                  Installed NUT services and connected my Lenovo UPS (55942KX) via USB to the firewall.
                                  I am using an SRS232 to USB cable.

                                  Does the UPS have a direct USB interface? If so, you absolutely should use that interface instead of a USB to serial cable.

                                  Now, assuming that it does not have a native USB interface and that you have no choice other than to use a USB serial emulator cable...

                                  If the emulator chip in the cable is supported by FreeBSD, the device will show up as a serial port in /dev when you connect the USB cable to the pfSense system. If it doesn't, you're out of luck.

                                  To use a serial port emulator, in the NUT configuration you would select "Local Serial" as the UPS Type, and then select the correct port in the Serial port drop-down list (Hint: on the 6100, it's not cuau0 or cuau1).

                                  Now comes the hard part. You will have to select the correct driver, and it's a long list to choose from. Without knowing who actually made the UPS that Lenovo rebranded, you have to guess and test. My best guess would be mge-shut, but that is only a guess.

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

                                    Did the USB Cyber Power connection drop issue ever get resolved? I noticed they closed that redline....

                                    Make sure to upvote

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

                                      @JonathanLee The new NUT version is still pending. I'm switching from nut (8.0) to nut-devel (pre 8.1), which unfortunately has required some fixes in the upstream BSD Port. The fixes are completed, but now have to flow down to pfSense. I don't know how long that will take.

                                      1 Reply Last reply Reply Quote 1
                                      • A
                                        abs0new Rebel Alliance @dennypage
                                        last edited by

                                        @dennypage Thank you for your suggestion.

                                        Do i need to search through 1212 posts to find the executable ?

                                        GertjanG dennypageD 2 Replies Last reply Reply Quote 1
                                        • GertjanG
                                          Gertjan @abs0new
                                          last edited by

                                          @abs0new

                                          When its ready, you see it here, signaled as "an update has arrived" :

                                          b8756bce-0332-444d-be05-bec97dbd7f3f-image.png

                                          There will be a yellow sign after the "i".

                                          No "help me" PM's please. Use the forum, the community will thank you.
                                          Edit : and where are the logs ??

                                          1 Reply Last reply Reply Quote 0
                                          • zeemaffinZ
                                            zeemaffin @dennypage
                                            last edited by

                                            @dennypage Hi!

                                            Thank you for the tips, I am going through the serial drivers.
                                            In the UPS settings page the serial port is a drop down menu and /dev/cuau0 and /dev/cuau1 is the 2 option, theres nothing else.
                                            SO this case can't understand your hint regarding the 6100.

                                            Sofar I had no luck... Would you suggest and USB-B to USB-A cable? ( the UPS has the usb port similiar to printers do)

                                            Kind regards,

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