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.1m 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.
    • M
      mrsunfire @dennypage
      last edited by

      @dennypage I changed the name to „UPS“. Still the same error. I don‘t see any logs from usbhid-ups.

      [UPS]
      driver=usbhid-ups
      port=auto
      
      
      #!/bin/sh
      # This file was automatically generated
      # by the pfSense service handler.
      
      rc_start() {
      	echo starting NUT
      	/usr/bin/killall -q -9 upsmon
      	/usr/bin/killall -q -9 upsd
      	/usr/bin/killall -q -9 upsdrvctl
      	/usr/bin/killall -q -9 usbhid-ups
      	/usr/local/sbin/upsmon
      	/usr/local/sbin/upsdrvctl start &
      	sleep 1
      	/usr/local/sbin/upsd -u root
      	return 0
      }
      
      rc_stop() {
      	echo stopping NUT
      	/usr/bin/killall -q upsmon
      	/usr/bin/killall -q upsd
      	/usr/bin/killall -q upsdrvctl
      	/usr/bin/killall -q usbhid-ups
      	return 0
      }
      
      case $1 in
      	start)
      		rc_start
      		;;
      	stop)
      		rc_stop
      		;;
      	restart)
      		rc_stop
      		rc_start
      		;;
      esac
      
      
      

      Netgate 6100 MAX

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

        OK I got it to work by also using the apcusbd package and setup the NUT package to USB type „Remote apcusbd“. Now I got the widget working!

        Netgate 6100 MAX

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

          @mrsunfire Please try starting the script by hand using the command:

          /usr/local/etc/rc.d/nut.sh start
          

          and post the output.

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

            @mrsunfire Uh... you aren't trying to run apcupsd and nut at the same time are you?

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

              No I was not. But now I am and it works flawless.

              Netgate 6100 MAX

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

                @mrsunfire You cannot use apcupsd and nut at the same time. They cannot both manage system shutdown.

                If you want help to understand the issue with nut, I will help you but you need to disable or delete apcupsd before proceeding.

                Otherwise, if you are happy with using apcupsd, you should delete the nut package.

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

                  Why? I just want the widget and nothing else. This works only with NUT and NUT only works with apcupsd right now :)
                  But yes, I want to find out what the problem is. I will do this tomorrow guided by your help.
                  Thanks in advance!

                  Netgate 6100 MAX

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

                    @mrsunfire Because you cannot have two processes trying to manage system and ups shutdown/restart.

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

                      I don't want to shutdown. I only want the widget. Is there a way to disable the shutdown completely?

                      Netgate 6100 MAX

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

                        @mrsunfire Okay. When you are ready...

                        1. Remove the apcupsd package using the package manager (System / Package Manager / Installed Packages).
                        2. Go to the UPS configuration page (Services / UPS / Settings) and change the nut configuration to be:
                        • UPS Type - Local USB
                        • UPS Name - ups
                        • Driver - usbhid
                        • All other settings blank (empty).
                        1. Save the configuration.

                        2. Wait two minutes. Don't skip this step.

                        3. Check to confirm the service is not functioning by going to the UPS status page (Services / UPS / Status) and refreshing the browser. Assuming that the status page says that the ups requires attention...

                        4. Log into the system and run the nut startup script by hand:

                          /usr/local/etc/rc.d/nut.sh start
                          
                        5. Post the output produced by the script, and the output from the system log when you ran the script. You can get the system log output with the following command:

                          clog /var/log/system.log | tail -25
                          

                        which will display the last 25 lines of the system log.

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

                          @dennypage said in NUT package:

                          OK, I've made all these steps:

                          Apr 18 21:51:54 pfsense upsmon[56145]: Startup successful
                          Apr 18 21:51:55 pfsense upsd[57066]: listening on ::1 port 3493
                          Apr 18 21:51:55 pfsense upsd[57066]: listening on 127.0.0.1 port 3493
                          Apr 18 21:51:55 pfsense upsd[57066]: Can't connect to UPS [UPS] (apcupsd-ups-UPS): No such file or directory
                          Apr 18 21:51:55 pfsense upsd[57261]: Startup successful
                          Apr 18 21:51:57 pfsense upsd[57261]: User local-monitor@::1 logged into UPS [UPS]
                          Apr 18 21:51:57 pfsense upsmon[56657]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:51:57 pfsense upsmon[56657]: Communications with UPS UPS lost
                          Apr 18 21:52:02 pfsense upsmon[56657]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:52:02 pfsense upsmon[56657]: UPS UPS is unavailable
                          Apr 18 21:52:07 pfsense upsmon[56657]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:52:12 pfsense upsmon[56657]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:52:13 pfsense login: login on ttyu0 as root
                          Apr 18 21:52:17 pfsense upsmon[56657]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:52:22 pfsense upsmon[56657]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:52:26 pfsense upsmon[19650]: Startup successful
                          Apr 18 21:52:27 pfsense upsd[20303]: listening on ::1 port 3493
                          Apr 18 21:52:27 pfsense upsd[20303]: listening on 127.0.0.1 port 3493
                          Apr 18 21:52:27 pfsense upsd[20303]: Can't connect to UPS [UPS] (apcupsd-ups-UPS): No such file or directory
                          Apr 18 21:52:27 pfsense upsd[20394]: Startup successful
                          Apr 18 21:52:29 pfsense upsd[20394]: User local-monitor@::1 logged into UPS [UPS]
                          Apr 18 21:52:29 pfsense upsmon[20188]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:52:29 pfsense upsmon[20188]: Communications with UPS UPS lost
                          Apr 18 21:52:34 pfsense upsmon[20188]: Poll UPS [UPS] failed - Driver not connected
                          Apr 18 21:52:34 pfsense upsmon[20188]: UPS UPS is unavailable
                          
                          
                          

                          Netgate 6100 MAX

                          dennypageD 1 Reply Last reply Reply Quote 0
                          • M
                            mrsunfire
                            last edited by mrsunfire

                            OK strange, now I again uninstalled NUT and reinstalled it as previous but now it works!

                            
                            Apr 18 21:56:36	upsd	71931	User local-monitor@::1 logged into UPS [UPS]
                            Apr 18 21:56:34	upsd	71931	Startup successful
                            Apr 18 21:56:34	upsd	71905	Connected to UPS [UPS]: usbhid-ups-UPS
                            Apr 18 21:56:34	upsd	71905	listening on 127.0.0.1 port 3493
                            Apr 18 21:56:34	upsd	71905	listening on ::1 port 3493
                            Apr 18 21:56:33	usbhid-ups	71892	Startup successful
                            Apr 18 21:56:33	upsmon	70877	Startup successful
                            Apr 18 21:56:33	php-fpm	30015	/nut_settings.php: Starting service nut
                            

                            Without setting anything in the advanced options is there now a shutdown active?

                            Netgate 6100 MAX

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

                              @mrsunfire Thank you for the system log output. Can you post the output from the script itself as well please?

                              Looking for something like this:

                              [2.4.4-RELEASE][root@fw]/root: sh -x /usr/local/etc/rc.d/nut.sh start
                              + rc_start
                              + echo starting NUT
                              starting NUT
                              + /usr/bin/killall -q -9 upsmon
                              + /usr/bin/killall -q -9 upsd
                              + /usr/bin/killall -q -9 upsdrvctl
                              + /usr/bin/killall -q -9 usbhid-ups
                              + /usr/local/sbin/upsmon
                              Network UPS Tools upsmon 2.7.4
                              kill: No such process
                              UPS: ups (master) (power value 1)
                              Using power down flag file /etc/killpower
                              + sleep 1
                              + /usr/local/sbin/upsdrvctl start
                              Network UPS Tools - UPS driver controller 2.7.4
                              Network UPS Tools - Generic HID driver 0.41 (2.7.4)
                              USB communication driver 0.33
                              kill: No such process
                              Using subdriver: TrippLite HID 0.82
                              + /usr/local/sbin/upsd -u root
                              Network UPS Tools upsd 2.7.4
                              kill: No such process
                              listening on ::1 port 3493
                              listening on 127.0.0.1 port 3493
                              Connected to UPS [ups]: usbhid-ups-ups
                              + return 0
                              [2.4.4-RELEASE][root@fw]/root:
                              

                              Alternatively, you could just start the driver:

                              [2.4.4-RELEASE][root@fw.cococafe.com]/root: /usr/local/sbin/upsdrvctl start
                              Network UPS Tools - UPS driver controller 2.7.4
                              Network UPS Tools - Generic HID driver 0.41 (2.7.4)
                              USB communication driver 0.33
                              Using subdriver: TrippLite HID 0.82
                              [2.4.4-RELEASE][root@fw.cococafe.com]/root: 
                              
                              1 Reply Last reply Reply Quote 0
                              • dennypageD
                                dennypage @mrsunfire
                                last edited by

                                @mrsunfire said in NUT package:

                                OK strange, now I again uninstalled NUT and reinstalled it as previous but now it works!

                                Strange. Only thing I can think of here is that when nut is first installed, there are rules set up for ownership of the usb device so that nut can access it. These rules do have effect until the system is rebooted or the device is unplugged/replugged.

                                Without setting anything in the advanced options is there now a shutdown active?

                                Yes, if nut is running correctly you should be protected against the ups running out of battery.

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

                                  Where can I see the time when the system shutdown? Where to disable?

                                  Netgate 6100 MAX

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

                                    @mrsunfire said in NUT package:

                                    Where can I see the time when the system shutdown? Where to disable?

                                    By default, nut initiates a shutdown when your ups declares a low battery situation. When this occurs varies from vendor to vendor and from ups to ups, usually based on battery size.
                                    Note that you can generally override the ups defaults and have nut initiate the shutdown when X percentage of battery remains, or Y minutes of runtime remains.

                                    Why do you want to disable shutdown? Managing shutdown is what nut exists for. Without it, you risk data corruption when the battery is exhausted. Also, the further you deplete the batter the higher the impact on long term battery health.

                                    There is no "clean" way to disable shutdown. There are various tricks you can try, but they can leave either nut or the entire system inoperable without manual/physical intervention. And of course there is the risk of data corruption when power is lost.

                                    Unless you have a super good reason to be trying to avoid shutdown, it's much better to let it do its thing.

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

                                      My board only auto boots after power lost. If the system shutdown, it doesn‘t boot after power is back.
                                      Where can I set the battery low limit? With the apcupsd package this was possible.

                                      Netgate 6100 MAX

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

                                        @mrsunfire said in NUT package:

                                        My board only auto boots after power lost. If the system shutdown, it doesn‘t boot after power is back.

                                        Your BIOS has power restore set to "Last State". Ideally for something like a firewall, the BIOS should be set for "Always On". If for some reason the BIOS doesn't have this ability, you can work around this with nut. Go to Advanced settings in the UPS configuration, and add the following line to the Additional configuration lines for upsmon.conf section:

                                        SHUTDOWNCMD "/sbin/shutdown -h +0"
                                        

                                        With this, nut will shut the system down but will not call for the system to power itself off. This will leave the system quiesced and data safe. Shortly thereafter (usually 20 seconds or so), the ups will kill the power. When the mains return, the ups will restore power and the system will automatically boot.

                                        Where can I set the battery low limit? With the apcupsd package this was possible.

                                        There are several discussions about affecting the low battery settings earlier in this thread. Look for override.battery.charge You can also see the ups.conf manual page. Use caution when changing these values. Unless you are trying to shorten run-time in order to preserve battery life, you are probably just fine with the default settings your ups provides.

                                        1 Reply Last reply Reply Quote 1
                                        • M
                                          mrsunfire
                                          last edited by

                                          Thank you mate, you're awesome! Tomorrow I will replace my UPS. I use this as a test if the shutdown works as I want it and let you know if I'm happy with it.

                                          Netgate 6100 MAX

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

                                            @dennypage said in NUT package:

                                            clog /var/log/system.log | tail -25

                                            OK, shutdown works perfect! The system also auto boots after power is back.

                                            But after replacing the UPS with the same model and also installed the pfSense as UEFI new (restored backup) I again doesn't get connection to UPS.

                                            I followed your steps. Here is the log:

                                            Apr 20 14:36:50 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:36:55 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:00 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:05 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:10 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:15 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:20 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:25 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:30 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:35 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:41 pfsense upsmon[92951]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:41 pfsense upsmon[5675]: Startup successful
                                            Apr 20 14:37:42 pfsense upsd[10577]: listening on ::1 port 3493
                                            Apr 20 14:37:42 pfsense upsd[10577]: listening on 127.0.0.1 port 3493
                                            Apr 20 14:37:42 pfsense upsd[10577]: Can't connect to UPS [UPS] (usbhid-ups-UPS): No such file or directory
                                            Apr 20 14:37:42 pfsense upsd[10889]: Startup successful
                                            Apr 20 14:37:44 pfsense upsd[10889]: User local-monitor@::1 logged into UPS [UPS]
                                            Apr 20 14:37:44 pfsense upsmon[5937]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:44 pfsense upsmon[5937]: Communications with UPS UPS lost
                                            Apr 20 14:37:49 pfsense upsmon[5937]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:49 pfsense upsmon[5937]: UPS UPS is unavailable
                                            Apr 20 14:37:54 pfsense upsmon[5937]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:37:59 pfsense upsmon[5937]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:38:04 pfsense upsmon[5937]: Poll UPS [UPS] failed - Driver not connected
                                            Apr 20 14:38:09 pfsense upsmon[5937]: Poll UPS [UPS] failed - Driver not connected
                                            

                                            Netgate 6100 MAX

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