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

    Apcupsd on 2.2: multiple processes

    pfSense Packages
    6
    14
    4.8k
    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.
    • S
      sporkme
      last edited by

      I keep seeing apcupsd getting started twice since upgrading to 2.2:

      
      2015-04-02 18:18:34 -0400  apcupsd shutdown succeeded
      2015-04-02 18:18:39 -0400  apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
      2015-04-02 18:18:40 -0400  apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
      2015-04-02 18:18:40 -0400  apcserver: cannot bind port 3551\. ERR=Address already in use
      2015-04-02 19:18:40 -0400  apcserver: cannot bind port 3551\. ERR=Address already in use
      2015-04-02 20:18:40 -0400  apcserver: cannot bind port 3551\. ERR=Address already in use
      2015-04-02 21:18:40 -0400  apcserver: cannot bind port 3551\. ERR=Address already in use
      2015-04-02 22:18:40 -0400  apcserver: cannot bind port 3551\. ERR=Address already in use
      2015-04-02 23:18:40 -0400  apcserver: cannot bind port 3551\. ERR=Address already in use
      2015-04-02 23:23:34 -0400  apcupsd exiting, signal 15
      2015-04-02 23:23:34 -0400  apcupsd shutdown succeeded
      2015-04-02 23:23:34 -0400  apcupsd exiting, signal 15
      2015-04-02 23:23:34 -0400  apcupsd shutdown succeeded
      2015-04-02 23:23:40 -0400  apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
      2015-04-02 23:23:41 -0400  apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
      2015-04-02 23:23:41 -0400  apcserver: cannot bind port 3551\. ERR=Address already in use
      2015-04-02 23:32:23 -0400  apcupsd exiting, signal 15
      2015-04-02 23:32:23 -0400  apcupsd shutdown succeeded
      2015-04-02 23:32:23 -0400  apcupsd exiting, signal 15
      2015-04-02 23:32:23 -0400  apcupsd shutdown succeeded
      2015-04-02 23:32:33 -0400  apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
      
      

      It still seems to work, but something seems amiss.

      Any other info I can provide?

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

        Paste the contents of /usr/local/etc/rc.d/apcupsd.sh.
        Could you try remove and reinstall the package, please?

        –
        Danilo G. Baio (dbaio)

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

          Well that's a bit odd, there are two startup scripts:

          
          lrwxr-xr-x  1 root  wheel   38 Jul  3  2014 apcupsd -> /usr/pbi/apcupsd-i386/etc/rc.d/apcupsd
          -rwxr-xr-x  1 root  wheel  482 Apr 23 15:56 apcupsd.sh
          
          

          apcupsd.sh:

          
          #!/bin/sh
          # This file was automatically generated
          # by the pfSense service handler.
          
          rc_start() {
          	echo "Starting APC UPS Daemon..."
          	if [ ! -d /var/spool/lock ]; then
          		/bin/mkdir -p /var/spool/lock
          	fi
          	/bin/rm -f /var/spool/lock/*LCK* 2>/dev/null
          	/usr/pbi/apcupsd-i386/sbin/apcupsd
          }
          
          rc_stop() {
          	echo "Stopping APC UPS Daemon..."
          	/usr/bin/killall apcupsd
          	/bin/sleep 5
          }
          
          case $1 in
          	start)
          		rc_start
          		;;
          	stop)
          		rc_stop
          		;;
          	restart)
          		rc_stop
          		rc_start
          		;;
          esac
          
          

          apcupsd:

          
          #!/bin/sh
          #
          # $FreeBSD: head/sysutils/apcupsd/files/apcupsd.in 340872 2014-01-24 00:14:07Z mat $
          #
          # PROVIDE: apcupsd
          # REQUIRE: SERVERS
          # BEFORE: DAEMON
          # KEYWORD: shutdown
          #
          # Add the following line to /etc/rc.conf[.local] to enable apcupsd
          #
          # apcupsd_enable (bool):	Set to "NO" by default.
          #				Set it to "YES" to enable apcupsd.
          # apcupsd_args (str):		Custom additional arguments to be passed
          #				to apcupsd (default empty).
          #
          
          . /etc/rc.subr
          
          name="apcupsd"
          rcvar=apcupsd_enable
          
          load_rc_config $name
          
          : ${apcupsd_enable="NO"}
          : ${apcupsd_flags="--kill-on-powerfail"}
          : ${apcupsd_pidfile="/var/run/apcupsd.pid"}
          : ${apcupsd_lockfile="/var/spool/lock/apcupsd.lock"}
          
          pidfile="/var/run/apcupsd.pid"
          required_files="/usr/local/etc/apcupsd/apcupsd.conf"
          command="/usr/local/sbin/apcupsd"
          
          run_rc_command "$1"
          
          

          I also just reinstalled the package.  Same deal, two startup scripts and two running apcupsd processes.  Anything else I can provide?

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

            We have the same problem: We have apcupsd running on two pfSense boxes connecting to a ups. Sometimes the boxes slow down to a grinding halt because of a double start. Why? Everything is the newest version. We see this all the time:

            Jul 13 15:34:08 fw2 apcupsd[58559]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
            Jul 13 15:34:08 fw2 apcupsd[58559]: NIS server startup succeeded
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcserver: cannot bind port 3551. ERR=Address already in use
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in pcnet.c at line 663 Cannot bind socket (48)
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided
            Jul 13 15:34:08 fw2 apcupsd[62688]: apcupsd FATAL ERROR in newups.c at line 103 Mutex lock failure. ERR=Resource deadlock avoided

            • thousands more of this….
            1 Reply Last reply Reply Quote 0
            • A
              azzido
              last edited by

              This issue might be related to the problem that I had with FreeRADIUS. See bug: https://redmine.pfsense.org/issues/4337.

              The fact that there are two startup scripts is normal and is not the cause of this issue.

              To check if the startup scripts are causing the issue try to kill all apcupsd processes and start it manually by running "apcupsd.sh start". Then check how many processes are started.

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

                The problem seems to occur on booting and firewall configuration changes. So maybe the problem is there.

                When stopping/starting manually:

                /usr/local/etc/rc.d/apcupsd.sh stop
                      -> no process
                /usr/local/etc/rc.d/apcupsd.sh start
                      -> one process runs

                In system.log:

                Jul 14 10:35:34 fw2 kernel: pid 49899 (apcupsd), uid 0: exited on signal 10 (core dumped)
                Jul 14 10:35:47 fw2 apcupsd[77519]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
                Jul 14 10:35:47 fw2 apcupsd[77519]: NIS server startup succeeded

                Everything fine.

                So what to do?

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

                  Question:

                  Starting APC UPS Daemon…

                  Is never shown in system.log; is /usr/local/etc/rc.d/apcupsd.sh not used?

                  We only get:

                  Jul 14 10:54:19 fw2 apcupsd[85701]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
                  Jul 14 10:54:19 fw2 apcupsd[85701]: NIS server startup succeeded
                  Jul 14 10:54:19 fw2 apcupsd[93634]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded

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

                    anybody?

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

                      Anybody?

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

                        Still seeing it here after both upgrading pfSense to 2.2.3 (will try 2.2.4 when convenient) and reinstalling the apcupsd package.  The package reports itself as version 3.14.12.

                        
                        Aug 6 21:50:50	apcupsd[94698]: NIS server startup succeeded
                        Aug 6 21:50:50	apcupsd[94698]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
                        Aug 6 21:50:45	apcupsd[82835]: apcupsd shutdown succeeded
                        Aug 6 21:50:45	apcupsd[86117]: apcupsd shutdown succeeded
                        Aug 6 21:50:45	apcupsd[82835]: apcupsd exiting, signal 15
                        Aug 6 21:50:45	apcupsd[86117]: apcupsd exiting, signal 15
                        Aug 6 21:50:26	apcupsd[86117]: apcserver: cannot bind port 3551\. ERR=Address already in use
                        Aug 6 21:50:26	apcupsd[86117]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
                        Aug 6 21:50:26	apcupsd[82835]: NIS server startup succeeded
                        Aug 6 21:50:26	apcupsd[82835]: apcupsd 3.14.12 (29 March 2014) freebsd startup succeeded
                        Aug 6 21:50:21	apcupsd[67945]: apcupsd shutdown succeeded
                        Aug 6 21:50:21	apcupsd[67945]: apcupsd exiting, signal 15
                        Aug 6 21:50:20	php-fpm: /rc.start_packages: Restarting/Starting all packages.
                        Aug 6 21:50:20	php-fpm: /rc.start_packages: Restarting/Starting all packages.
                        
                        
                        1 Reply Last reply Reply Quote 0
                        • F
                          FlashEngineer
                          last edited by

                          Having this issue still with latest pfsense, can this be fixed somehow?

                          1 Reply Last reply Reply Quote 0
                          • W
                            webdawg
                            last edited by

                            I sent a PM to the maintainer:  dbaio

                            I also posted in his thread here:  https://forum.pfsense.org/index.php?topic=70830.0

                            Lets see what happens.  I have the same issue when installing.  I am going to disable for now.

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

                              Sorry, I was away from this forum.

                              @webdawg, try this command like @alfredo did:

                              /usr/local/etc/rc.d/apcupsd.sh stop
                              

                              Check if this works killing all apcupsd process.

                              I think  "killall apcupsd" is not killing the process in your box.

                              About the two startup scripts, apcupsd.sh is generated by pfsense and this script is used by the web interface.

                              The other one came with the FreeBSD package and it's not used.

                              –
                              Danilo G. Baio (dbaio)

                              1 Reply Last reply Reply Quote 0
                              • W
                                webdawg
                                last edited by

                                Not going to be able to do this for you.

                                2.3 changed entirely how packages work and this package was removed.

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