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

    NUT package (2.8.0 and below)

    UPS Tools
    128
    1.2k
    4.0m
    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

      The repo issue has been fixed. The package version has been updated to 2.7.4_2.

      1 Reply Last reply Reply Quote 0
      • J
        justmie
        last edited by

        I can confirm it's working with apcupsd as a remote host. Thanks Dennypage !

        1 Reply Last reply Reply Quote 0
        • A
          AR15USR
          last edited by

          Confirmed here as well. Thanks!


          2.6.0-RELEASE

          1 Reply Last reply Reply Quote 0
          • L
            lemonkey
            last edited by

            Confirmed working, thanks.

            1 Reply Last reply Reply Quote 0
            • T
              th3r3isnospoon
              last edited by

              @dennypage:

              The repo issue has been fixed. The package version has been updated to 2.7.4_2.

              Thank you for the fix!  Looks good!

              -th3r3isnospoon

              1 Reply Last reply Reply Quote 0
              • L
                lemonkey
                last edited by

                I have a new APC UPS (BN1080G) which only has a serial data port on the back but it came with a serial-to-USB cable. I already tried to use the default USB driver via the UPS service settings but it couldn't connect to the UPS. From what I read (http://www.freebsddiary.org/apcupsd.php) in order for the serial-to-USB connection to typically work you'll need to also be running the apcupsd daemon. "apcupsd" is listed as a remote connection option in the UPS services settings, but I would like to run it local to the firewall if possible.

                There isn't a PFSense plugin for this yet but there is a BSD port for it (https://www.freshports.org/sysutils/apcupsd/).

                Unfortunately it doesn't appear to be listed as an available package in the latest stable PFSense release's core package repository.

                2.3.2-RELEASE (amd64)
                built on Tue Jul 19 12:44:43 CDT 2016
                FreeBSD 10.3-RELEASE-p5

                I have another FreeBSD machine internally that I can probably run apcupsd on and then have its port available for PFSense to use in the meantime.

                Any advice?

                Thanks

                1 Reply Last reply Reply Quote 0
                • ?
                  A Former User
                  last edited by

                  First, I want to thank the developers for their work in this open source project  :)
                  I can confirm that the new package works with EATON Protection Station 800.  But the E-mails notification option does not work, I have this error in the system log:

                  php-cgi: nut_email.php: Could not send the message to email@example.com -- Error: could not start TLS connection encryption protocol
                  

                  .
                  The E-mail notifications works well if I Test SMTP Settings under System -> Advanced -> Notifications.
                  Thanks (and sorry for my bad English).

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

                    @lemonkey:

                    I have a new APC UPS (BN1080G) which only has a serial data port on the back but it came with a serial-to-USB cable.

                    According to APC documentation it's a USB port. A new model UPS with a real serial port is pretty rare these days.

                    According to the NUT HCL, the default values should support this UPS. Use "Local USB" for UPS Type and "usbhid" for the driver.

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

                      @afa:

                      But the E-mails notification option does not work, I have this error in the system log:

                      php-cgi: nut_email.php: Could not send the message to email@example.com -- Error: could not start TLS connection encryption protocol
                      

                      .
                      The E-mail notifications works well if I Test SMTP Settings under System -> Advanced -> Notifications.

                      NUT invokes a script to send the email. Unfortunately, SSL is not available when PHP is invoked from a script. This is a known issue with pfSense. It's considered a bug, but no one has tracked it down yet.

                      It's on my list when time permits.

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

                        @dennypage:

                        @afa:

                        But the E-mails notification option does not work, I have this error in the system log:

                        php-cgi: nut_email.php: Could not send the message to email@example.com -- Error: could not start TLS connection encryption protocol
                        

                        .
                        The E-mail notifications works well if I Test SMTP Settings under System -> Advanced -> Notifications.

                        NUT invokes a script to send the email. Unfortunately, SSL is not available when PHP is invoked from a script. This is a known issue with pfSense. It's considered a bug, but no one has tracked it down yet.

                        I had a brief moment to take a look at this. I've narrowed it to an issue with PHP scripts invoked by users other than root. By default, upsmon runs as uucp, so it isn't able to initialize the secure connection. It's not clear what the long term solution will be, but you can work around the issue by adding the following line to upsmon.conf in the Advanced section:

                        RUN_AS_USER root

                        This will keep upsmon as root and allow secure connections from PHP.

                        As a security best practice it is generally recommended to run upsmon as a user other than root. However, given the closed environment nature of the firewall, I don't see an obvious security issue running upsmon as root.

                        1 Reply Last reply Reply Quote 0
                        • ?
                          A Former User
                          last edited by

                          @dennypage:

                          I had a brief moment to take a look at this. I've narrowed it to an issue with PHP scripts invoked by users other than root. By default, upsmon runs as uucp, so it isn't able to initialize the secure connection. It's not clear what the long term solution will be, but you can work around the issue by adding the following line to upsmon.conf in the Advanced section:

                          RUN_AS_USER root

                          The solution works correctly, thanks dennypage!

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

                            You're welcome. Glad it works for you.

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

                              @dennypage:

                              I had a brief moment to take a look at this. I've narrowed it to an issue with PHP scripts invoked by users other than root. By default, upsmon runs as uucp, so it isn't able to initialize the secure connection. It's not clear what the long term solution will be, but you can work around the issue by adding the following line to upsmon.conf in the Advanced section:

                              RUN_AS_USER root

                              This will keep upsmon as root and allow secure connections from PHP.

                              As a security best practice it is generally recommended to run upsmon as a user other than root. However, given the closed environment nature of the firewall, I don't see an obvious security issue running upsmon as root.

                              The core issue turns out to be an file permission issue with one of the php ini files, /usr/local/etc/php/extenstions.ini. The file is owned by root and created with permissions 600, which prevents it from being read by the user upsmon runs as (uucp).

                              This file is being removed in pfSense 2.4, so the issue should be resolved then. If you want to correct the issue in the interim, you can apply the following patch:

                              *** /etc/rc.php_ini_setup.org	Thu Jul 14 18:14:42 2016
                              --- /etc/rc.php_ini_setup	Tue Aug  9 11:58:33 2016
                              ***************
                              *** 102,107 ****
                              --- 102,108 ----
                                fi
                              
                                /usr/bin/sort -u -o /usr/local/etc/php/extensions.ini /usr/local/etc/php/extensions.ini
                              + chmod 644 /usr/local/etc/php/extensions.ini
                              
                                # Set upload directory
                                if [ "$PLATFORM" = "nanobsd" ]; then
                              
                              

                              Note that you cannot just change the permissions on /usr/local/etc/php/extensions.ini because it is recreated at every boot.

                              1 Reply Last reply Reply Quote 0
                              • R
                                runjmc
                                last edited by

                                I just did the upgrade and it isn't working.. Was working with the previous version of NUT.

                                The service looks to be running.

                                It is on version 2.7.4_2

                                This is a APC Back UP NS 1250 LCD using USB

                                I noticed in the log
                                Aug 12 19:14:09 upsmon 23829 Poll UPS [APC] failed - Driver not connected
                                Aug 12 19:14:14 upsmon 23829 Poll UPS [APC] failed - Driver not connected
                                Aug 12 19:14:19 upsmon 23829 Poll UPS [APC] failed - Driver not connected
                                Aug 12 19:14:24 upsmon 23829 Poll UPS [APC] failed - Driver not connected
                                Aug 12 19:14:29 upsmon 23829 Poll UPS [APC] failed - Driver not connected
                                Aug 12 19:14:31 upsd 24571 Can't connect to UPS [APC] (usbhid-ups-APC): No such file or directory

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

                                  The driver itself has failed. You should see things in the log for the driver. Please post all the log entries for ups* from the point of service start. Also, can you provide detail on your configuration please?

                                  1 Reply Last reply Reply Quote 0
                                  • R
                                    runjmc
                                    last edited by

                                    Im running pfsense 2.3.2  I was running 2.2.x before. Started at 2.0

                                    This is a vm on a vmware server.

                                    This ups was working with the version of NUT before the upgrade to this version.

                                    Here are the logs from the start of the service

                                    Aug 12 20:42:12 upsmon 31925 Startup successful
                                    Aug 12 20:42:13 upsd 38757 listening on ::1 port 3493
                                    Aug 12 20:42:13 upsd 38757 listening on 127.0.0.1 port 3493
                                    Aug 12 20:42:13 upsd 38757 Can't connect to UPS [APC] (usbhid-ups-APC): No such file or directory
                                    Aug 12 20:42:13 upsd 39055 Startup successful
                                    Aug 12 20:42:15 upsd 39055 User monuser@::1 logged into UPS [APC]
                                    Aug 12 20:42:15 upsmon 32928 Poll UPS [APC] failed - Driver not connected
                                    Aug 12 20:42:15 upsmon 32928 Communications with UPS APC lost
                                    Aug 12 20:42:20 upsmon 32928 Poll UPS [APC] failed - Driver not connected
                                    Aug 12 20:42:20 upsmon 32928 UPS APC is unavailable

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

                                      The configuration I am looking for is the NUT configuration: What type, what driver, any extra args etc. The best place for this is in your configuration file. Look for something that looks like this:

                                      
                                                      <nut><config><type>local_usb</type>
                                                                      <name>ups</name>
                                                                      <email>yes</email>
                                                                      <usb_driver>usbhid-ups</usb_driver>
                                                                      <upsmon_conf><extra_args></extra_args></upsmon_conf></config></nut> 
                                      
                                      

                                      It would also be very helpful to see the NUT configuration from before you upgraded.

                                      For logs, go to Status / System Logs / System / General. Select the funnel icon, and put "ups" in the Message field and then Apply Filter. You should see all the ups logs, including the kernel identification of the UPS at boot assuming that it's connected via USB.

                                      1 Reply Last reply Reply Quote 0
                                      • R
                                        runjmc
                                        last edited by

                                        I rebooted the server since I wanted to get you fresh logs since I cleared out my logs and now its working. So not sure what the reboot did.

                                        Here is what my nut config if your curious.

                                        I guess like with everything.. if it doesn't work..reboot it once first. =)

                                        before

                                        <nut><config><monitor>local</monitor>
                                        <powerdown>on</powerdown>
                                        <custom_upsconf><custom_upsdconf><custom_upsdusers><custom_upsmonconf><allowaddr><allowuser>monuser</allowuser>
                                        <allowpass>pass</allowpass>
                                        <name>APC</name>
                                        <driver>usbhid-ups00</driver>
                                        <port>auto</port>
                                        <upstype><cable><snmpname><snmpaddr><snmpcommunity><snmpversion>v2c</snmpversion>
                                        <snmpmib>ietf</snmpmib>
                                        <snmpfreq><snmpdisabletransfer><remotename><remoteaddr><remoteuser><remotepass></remotepass></remoteuser></remoteaddr></remotename></snmpdisabletransfer></snmpfreq></snmpcommunity></snmpaddr></snmpname></cable></upstype></allowaddr></custom_upsmonconf></custom_upsdusers></custom_upsdconf></custom_upsconf></config>

                                        after

                                        <nut><config><type>local_usb</type>
                                        <name>APC</name>
                                        <email></email>
                                        <usb_driver>usbhid-ups</usb_driver>
                                        <upsmon_conf><extra_args></extra_args></upsmon_conf></config></nut></nut>

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

                                          Thank you for following up. Glad that it's working now.

                                          The reboot really shouldn't have been required unless there was an issue with connecting to the USB device. I would keep an eye on it for a while, and if it happens again try

                                          usbconfig dump_device_desc

                                          to see if the kernel sees the UPS device as connected.

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

                                            Notes on Power Off vs Halt

                                            When shutdown time arrives, the NUT package uses the following shutdown command:

                                            SHUTDOWNCMD "/sbin/shutdown -p +0"

                                            This command will power off the pfSense system. This is generally appropriate for systems such as firewalls that are configured to always turn on when power is applied. If there is a power setting in the BIOS this is generally referred to as “always on”.

                                            If you have a system that does not support the always on mode, and instead always returns to the prior (last) state when power is applied, then you probably want to override the shutdown command so that the system is halted but not powered off.

                                            You can do this by placing the following in upsmon.conf section of the advanced settings:

                                            SHUTDOWNCMD "/sbin/shutdown -h +0"

                                            If you have an option, the default "always on" approach is preferable.

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