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

    New package Apcupsd is available.

    Scheduled Pinned Locked Moved pfSense Packages
    57 Posts 13 Posters 25.5k 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.
    • F Offline
      flu
      last edited by

      Are  there plans to make Apcupsd available for PfSense 2.3.x ?

      Sorry, forget my question above. I overlooked that you are already working on that. Great!

      Greetings
      flu

      1 Reply Last reply Reply Quote 0
      • N Offline
        Napsterbater
        last edited by

        Just posting to show interest.. Used this on a older install, immediately went to look for it on this new install and was sad when I didn't see it..

        Appreciate your work on this.

        1 Reply Last reply Reply Quote 0
        • R Offline
          Reanimator77
          last edited by

          How to install apcupsd on pfSense 2.3.2 ???
          This package is not available in the "Package Manager"  :-[

          1 Reply Last reply Reply Quote 0
          • D Offline
            dbaio
            last edited by

            @Reanimator77:

            How to install apcupsd on pfSense 2.3.2 ???
            This package is not available in the "Package Manager"  :-[
            [/quote]

            I think it will be available soon.
            A developer was assigned to the PR:
            https://github.com/pfsense/FreeBSD-ports/pull/128

            –
            Danilo G. Baio (dbaio)

            1 Reply Last reply Reply Quote 0
            • L Offline
              LucaTo
              last edited by

              But… should be "merged it only for 2.3.3-snapshots"? (https://github.com/pfsense/FreeBSD-ports/pull/128)
              I'm on 2.3.3 but apcupsd isn't listed on packages page.
              There is a way to get the pkg…?

              1 Reply Last reply Reply Quote 0
              • D Offline
                dbaio
                last edited by

                @LucaTo:

                But… should be "merged it only for 2.3.3-snapshots"? (https://github.com/pfsense/FreeBSD-ports/pull/128)
                I'm on 2.3.3 but apcupsd isn't listed on packages page.
                There is a way to get the pkg…?

                I've sent a message to the devs about this.
                I think it will be available very soon.

                –
                Danilo G. Baio (dbaio)

                1 Reply Last reply Reply Quote 0
                • L Offline
                  LucaTo
                  last edited by

                  apcupsd is now published!  :)
                  Service starts and on "Status information" I can see UPS parameters.
                  But in system logs:

                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                  Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided 
                  

                  My system:
                  pfsense 2.3.3-DEVELOPMENT (amd64) built on Tue Aug 09 21:57:46 CDT 2016
                  ups APC sua1000i controlled via network card AP9630

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    dbaio
                    last edited by

                    @dbaio:

                    @LucaTo:

                    But… should be "merged it only for 2.3.3-snapshots"? (https://github.com/pfsense/FreeBSD-ports/pull/128)
                    I'm on 2.3.3 but apcupsd isn't listed on packages page.
                    There is a way to get the pkg…?

                    I've sent a message to the devs about this.
                    I think it will be available very soon.

                    And it is available now.  ;D

                    –
                    Danilo G. Baio (dbaio)

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      dbaio
                      last edited by

                      @LucaTo:

                      [snip]

                      Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                      [snip]
                      Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                      Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                      Aug 10 09:35:18 	apcupsd 	58288 	apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided 
                      

                      My system:
                      pfsense 2.3.3-DEVELOPMENT (amd64) built on Tue Aug 09 21:57:46 CDT 2016
                      ups APC sua1000i controlled via network card AP9630

                      On the Status Information page, are you seeing the information through apcaccess -h 0.0.0.0:3551 ? or did you used the ip address of your network card ?
                      Could you show it ?

                      Are you using "pcnet" or "net" on UPS Type ?

                      See this information about pcnet:
                      https://forum.pfsense.org/index.php?topic=85083.msg497267#msg497267

                      Also, if you have another apcupsd running on your network, try to use "net" and the ip address of that machine for testing.

                      Best Regards.

                      –
                      Danilo G. Baio (dbaio)

                      1 Reply Last reply Reply Quote 0
                      • L Offline
                        LucaTo
                        last edited by

                        Hi Danilo,
                        in my configuration there isn't apcupsd or apc powercute host,
                        apc ups monitoring  is through an AP9630 card connetted in the same lan with pfsense.
                        So I must use pcnet protocol.
                        On apcupsd configuration NIS IP is 0.0.0.0 as shown in the status page:

                        Running: apcaccess -h 0.0.0.0:3551 
                        

                        I also tried to change ip to lan interface address but gives the same errors in pfsense log.
                        Thank for your support  :)
                        Luca

                        EDIT: error appears in pfsense log on reboot, no error after starting/stopping/restarting the apcupsd daemon on pfsense.
                        EDIT2: mmmh  :-\ seems that status data doesn't refresh (Poll Time 60)
                        EDIT3: UPS status data don't update (even forcing an "execute" on status page) but seems that apcupsd daemon is listening: if I detach ethernet cable from the UPS card after few seconds I receive an email notification from apcupsd "apcupsd - Communications with UPS lost"

                        1 Reply Last reply Reply Quote 0
                        • L Offline
                          LucaTo
                          last edited by

                          I've done others tests using a new, clean, installation of pfsense.
                          Now seems it works,
                          ups parameters on the status page are received and refreshed (only an issue: "DATE" field, on the top, it doesn't refresh, but this issue is identical using apcusd on windows and pcnet driver…)

                          But still... on every reboot the log registry is filled by hundred of:

                          apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                          

                          Someone are using apcupsd with an apc pcn network management card?

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            dbaio
                            last edited by

                            @LucaTo:

                            I've done others tests using a new, clean, installation of pfsense.
                            Now seems it works,
                            ups parameters on the status page are received and refreshed (only an issue: "DATE" field, on the top, it doesn't refresh, but this issue is identical using apcusd on windows and pcnet driver…)

                            But still... on every reboot the log registry is filled by hundred of:

                            apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
                            

                            Someone are using apcupsd with an apc pcn network management card?

                            Hi @LucaTo, just to be clear.
                            It is working, the problem is on the logs, right ?

                            I have one here but I am using through snmp

                            UPS type = snmp
                            DEVICE = X.X.X.X:161:APC:private

                            I will test with pcnet today.

                            –
                            Danilo G. Baio (dbaio)

                            1 Reply Last reply Reply Quote 0
                            • L Offline
                              LucaTo
                              last edited by

                              Hi,
                              yes, it's working  :)
                              also email notification works.
                              Problem is on the logs

                              Thanks Danilo!

                              1 Reply Last reply Reply Quote 0
                              • D Offline
                                dbaio
                                last edited by

                                @LucaTo:

                                Hi,
                                yes, it's working  :)
                                also email notification works.
                                Problem is on the logs

                                Thanks Danilo!

                                Thank you!

                                Same here. :(
                                If I put a wrong username or passphrase, that message appears forever.

                                UPS Type: pcnet
                                DEVICE: X.X.X.X:wronguser:mysecurepassword:3052

                                Mutex lock failure. ERR=Resource deadlock avoided
                                2016-08-11 11:05:03 -0300  apcupsd FATAL ERROR in newups.c at line 103
                                Mutex lock failure. ERR=Resource deadlock avoided
                                2016-08-11 11:05:03 -0300  apcupsd FATAL ERROR in newups.c at line 103
                                Mutex lock failure. ERR=Resource deadlock avoided
                                2016-08-11 11:05:03 -0300  apcupsd FATAL ERROR in newups.c at line 103
                                Mutex lock failure. ERR=Resource deadlock avoided
                                2016-08-11 11:05:03 -0300  apcupsd FATAL ERROR in newups.c at line 103

                                If i put the right information, it works. After a reboot the message appears and is gone after a few seconds.

                                UPS Type: pcnet
                                DEVICE: X.X.X.X:apc:mysecurepassword:3052

                                It is very annoying and need be investigated.

                                For the moment, try using it with SNMP.

                                Regards.

                                –
                                Danilo G. Baio (dbaio)

                                1 Reply Last reply Reply Quote 0
                                • L Offline
                                  LucaTo
                                  last edited by

                                  I think is definitely related to pcnet protocol implementation.
                                  No error using SNMP.
                                  I hope will be resolved,
                                  APC "powerchute" protocol is useful to centrally manage shutdown bidirectionally (UPS to pfsense and vice versa) in a controlled mode, unlike the SNMP implementation.

                                  Thank you again Danilo!

                                  1 Reply Last reply Reply Quote 0
                                  • D Offline
                                    dbaio
                                    last edited by

                                    @LucaTo:

                                    I think is definitely related to pcnet protocol implementation.
                                    No error using SNMP.
                                    I hope will be resolved,
                                    APC "powerchute" protocol is useful to centrally manage shutdown bidirectionally (UPS to pfsense and vice versa) in a controlled mode, unlike the SNMP implementation.

                                    Thank you again Danilo!

                                    I've found the error.

                                    apcupsd.trace:

                                    0.000 apcupsd: apcupsd.c:156 Options parsed.
                                    0.000 apcupsd: apcupsd.c:156 Options parsed.
                                    0.000 apcupsd: apcupsd.c:179 Config file /usr/local/etc/apcupsd/apcupsd.conf processed.
                                    0.000 apcupsd: apcupsd.c:179 Config file /usr/local/etc/apcupsd/apcupsd.conf processed.
                                    0.000 apcupsd: drivers.c:146 Attached to driver: pcnet
                                    0.000 apcupsd: drivers.c:146 Attached to driver: pcnet
                                    0.008 apcupsd: apcupsd.c:251 NIS thread started.
                                    0.011 apcupsd: apcupsd.c:251 NIS thread started.
                                    apcupsd FATAL ERROR in pcnet.c at line 669
                                    Cannot bind socket (48)
                                    apcupsd FATAL ERROR in newups.c at line 103
                                    Mutex lock failure. ERR=Resource deadlock avoided
                                    

                                    It's starting apcupsd twice on booting.

                                    I will send a PR for fix this.

                                    Thank you @LucaTo

                                    –
                                    Danilo G. Baio (dbaio)

                                    1 Reply Last reply Reply Quote 0
                                    • L Offline
                                      LucaTo
                                      last edited by

                                      Just see here: https://github.com/pfsense/FreeBSD-ports/pull/169

                                      I'm testing now the changes in /usr/local/pkg/apcupsd.inc
                                      seems it works like a charms, zero errors on reboot!  :)

                                      Aug 12 22:36:50 	sshlockout 	69588 	sshlockout/webConfigurator v3.0 starting up
                                      Aug 12 22:36:50 	login 		login on ttyu0 as root
                                      Aug 12 22:36:50 	login 		login on ttyv0 as root
                                      Aug 12 22:36:49 	kernel 		done.
                                      Aug 12 22:36:48 	apcupsd 	55611 	NIS server startup succeeded
                                      Aug 12 22:36:48 	apcupsd 	55611 	apcupsd 3.14.13 (02 February 2015) freebsd startup succeeded
                                      Aug 12 22:36:48 	xinetd 	25528 	Reconfigured: new=0 old=1 dropped=0 (services)
                                      Aug 12 22:36:48 	xinetd 	25528 	readjusting service 6969-udp
                                      Aug 12 22:36:48 	xinetd 	25528 	Swapping defaults
                                      Aug 12 22:36:48 	xinetd 	25528 	Starting reconfiguration
                                      Aug 12 22:36:48 	radiusd 	48622 	Ready to process requests.
                                      Aug 12 22:36:48 	radiusd 	46856 	Loaded virtual server <default>Aug 12 22:36:47 	xinetd 	25528 	Reconfigured: new=0 old=1 dropped=0 (services)
                                      Aug 12 22:36:47 	xinetd 	25528 	readjusting service 6969-udp
                                      Aug 12 22:36:47 	xinetd 	25528 	Swapping defaults
                                      Aug 12 22:36:47 	xinetd 	25528 	Starting reconfiguration
                                      Aug 12 22:36:47 	kernel 		done.
                                      Aug 12 22:36:47 	php-fpm 	28459 	/rc.start_packages: Restarting/Starting all packages.
                                      Aug 12 22:36:46 	check_reload_status 		Reloading filter
                                      Aug 12 22:36:46 	syslogd 		kernel boot file is /boot/kernel/kernel</default> 
                                      

                                      thanks for the excellent work @dbaio

                                      1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        dbaio
                                        last edited by

                                        @LucaTo:

                                        seems it works like a charms, zero errors on reboot!  :)

                                        Thanks for your feedback. :)

                                        –
                                        Danilo G. Baio (dbaio)

                                        1 Reply Last reply Reply Quote 0
                                        • L Offline
                                          LucaTo
                                          last edited by

                                          New pfsense installation, based on a Intel D510MO mobo (Atom),
                                          apcupsd works fine  :)
                                          But… due to a buggy bios this mobo can't handle the "halt" state (reboot at the end, this issue is not rare, many other mobos present the same problem).
                                          In this case the system reboots (instead of stay on halt state) at the end of "halt" ("shutdown -h now" from command line) but... poweroff regularly after select "Diagnostics-->Halt system" from pfsense web gui  ???

                                          My workaround is a little change in apccontrol file (/usr/local/etc/apcupsd/apccontrol),
                                          changing shutdown switch from -h (halt) to -p (poweroff)
                                          and change bios setting from "power failure: last state" to "power on"

                                          note: this mod survive on reboot or changhing settings on apcupsd web gui (maybe not after reinstalling or updating the pkg)

                                          
                                          	;;
                                          	doshutdown)
                                          		printf "Beginning Shutdown Sequence" | wall
                                          		${SHUTDOWN} -p now "apcupsd initiated shutdown"
                                          	;;
                                          
                                          

                                          Maybe this trick can be useful to someone else  ;)
                                          I think would be useful an option on apcupsd web setting page for select the type of shutdown :"halt" or "poweroff" ;D

                                          1 Reply Last reply Reply Quote 0
                                          • D Offline
                                            dbaio
                                            last edited by

                                            @LucaTo:

                                            
                                            	;;
                                            	doshutdown)
                                            		printf "Beginning Shutdown Sequence" | wall
                                            		${SHUTDOWN} -p now "apcupsd initiated shutdown"
                                            	;;
                                            
                                            

                                            Maybe this trick can be useful to someone else  ;)
                                            I think would be useful an option on apcupsd web setting page for select the type of shutdown :"halt" or "poweroff" ;D

                                            Good idea.
                                            Let's first resolve this problem and release apcupsd, then propose this improvement.
                                            Regards.

                                            –
                                            Danilo G. Baio (dbaio)

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