[Nut-upsuser] unable to connect to APC UPS Connection Refused

Jim Klimov jimklimov+nut at gmail.com
Sat May 27 18:24:55 BST 2023


As a wild guess, your `upsd.conf` tells it to listen on `127.0.0.1`
explicitly, which may be why it refuses to listen on wildcard `0.0.0.0`.
However the clients connect to `localhost`.

How is the system name resolution set up (check `/etc/hosts` as a starting
point) - can `localhost` there mean IPv6 `::1` as well (or even
exclusively)?

Good luck,
Jim


On Sat, May 27, 2023 at 5:03 PM Dan G via Nut-upsuser <
nut-upsuser at alioth-lists.debian.net> wrote:

>
> I've not been able to connect to my ups using NUT 2.7.4 or NUT 2.8.0.
> 2.7.4 was installed as a package, 2.8.O was compiled from source.
> I've messed with permissons, everything is root:root and has the
> approprate read/execute permissons. I've tried two differnt UPS(es) APC &
> CyperPower. I'm running PI OS (Raspbian) on a Raspberry Pi3 model B. The
> port 3493 is open (UFW). I can reach the Pi on the network from another
> machine on port 3493 (using upsstats.cgi).
>
> The usbhid-ups driver starts up. But the ups is initally connected, but
> somehow gets lost. Next comes the message connection refused.
>
> upsmon keeps running and reports ups battery low - which is true
> but nut-monitor and nut-server quit
>
> Here's the startup:
>
> in 2.8.0:
>
> upsdrvctl start
> systemctl start nut-server
> systemctl start nut-monitor
>
> Any ideas?
>
> Thanks, Dan
> =========================================
>
> May 27 09:15:05 RaspBerry-Pi-3 usbhid-ups[2944]: Startup successful
> May 27 09:15:13 RaspBerry-Pi-3 systemd[1]: Starting Network UPS Tools -
> nut-server.service...
> May 27 09:15:13 RaspBerry-Pi-3 systemd[1]: Started Network UPS Tools -
> nut-server.service.
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: fopen
> /var/run/nut/upsd.pid: No such file or directory
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: Could not find PID file
> '/var/run/nut/upsd.pid' to see if previous upsd instance is already running!
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: /etc/nut/upsd.conf is
> world readable
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: listening on 127.0.0.1
> port 3943
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: not listening on 0.0.0.0
> port 3943
> May 27 09:15:13 RaspBerry-Pi-3 upsd[2948]: /etc/nut/upsd.conf is world
> readable
> May 27 09:15:13 RaspBerry-Pi-3 upsd[2948]: listening on 127.0.0.1 port 3943
> May 27 09:15:13 RaspBerry-Pi-3 upsd[2948]: not listening on 0.0.0.0 port
> 3943
> May 27 09:15:13 RaspBerry-Pi-3 usbhid-ups[2944]: sock_connect: enabling
> asynchronous mode (auto)
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: Connected to UPS [ups]:
> usbhid-ups-ups
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: Found 1 UPS defined in
> ups.conf
> May 27 09:15:13 RaspBerry-Pi-3 upsd[2948]: Connected to UPS [ups]:
> usbhid-ups-ups
> May 27 09:15:13 RaspBerry-Pi-3 upsd[2948]: Found 1 UPS defined in ups.conf
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: /etc/nut/upsd.users is
> world readable
> May 27 09:15:13 RaspBerry-Pi-3 nut-server[2948]: Running as foreground
> process, not saving a PID file
> May 27 09:15:13 RaspBerry-Pi-3 upsd[2948]: /etc/nut/upsd.users is world
> readable
> May 27 09:15:13 RaspBerry-Pi-3 upsd[2948]: Running as foreground process,
> not saving a PID file
> May 27 09:15:17 RaspBerry-Pi-3 systemd[1]: Starting Network UPS Tools -
> nut-monitor.service...
> May 27 09:15:17 RaspBerry-Pi-3 systemd[1]: Started Network UPS Tools -
> nut-monitor.service.
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2952]: fopen
> /var/run/nut/upsmon.pid: No such file or directory
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2952]: Could not find PID file
> to see if previous upsmon instance is already running!
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2952]: UPS: ups at localhost
> (secondary) (power value 1)
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2952]: Using power down flag
> file /etc/killpower
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2953]: upscli_init called but
> SSL wasn't compiled in
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2953]: UPS [ups at localhost]:
> connect failed: Connection failure: Connection refused
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2953]: commbad
> May 27 09:15:17 RaspBerry-Pi-3 upsched-cmd.sh:: upsched-cmd.sh running
> May 27 09:15:17 RaspBerry-Pi-3 upssched:: commbad
> May 27 09:15:17 RaspBerry-Pi-3 nut-monitor[2954]: Network UPS Tools upsmon
> 2.8.0.1
> May 27 09:15:22 RaspBerry-Pi-3 nut-monitor[2953]: UPS [ups at localhost]:
> connect failed: Connection failure: Connection refused
> May 27 09:15:22 RaspBerry-Pi-3 nut-monitor[2953]: nocomm
> May 27 09:15:22 RaspBerry-Pi-3 upsched-cmd.sh:: upsched-cmd.sh running
> May 27 09:15:22 RaspBerry-Pi-3 upssched:: nocomm
> May 27 09:15:22 RaspBerry-Pi-3 nut-monitor[2963]: Network UPS Tools upsmon
> 2.8.0.1
> ================================================
>         NUT configuration  2023-05-27 13:38:31 UTC
>
>         ########### Operating system ###########
> Kernel release 6.1.21-v7+ GNU/Linux
> PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
> NAME="Raspbian GNU/Linux"
> VERSION_CODENAME=bullseye
> Network UPS Tools upsd 2.8.0.1
> Bash version 5.1.4(1)-release
> User root
> updated-nut-report version: 2020-08-07
>
>         ########### USB attached UPS units ###########
> Bus 001 Device 005: ID 0b38:0010 Gear Head 107-Key Keyboard
> Bus 001 Device 006: ID 051d:0002 American Power Conversion Uninterruptible
> Power Supply
>
>         ########### /etc/nut//nut.conf ###########
> MODE=netserver
> UPSD_OPTIONS="-DD"
> UPSMON_OPTIONS="primary"
>
>         ########### /etc/nut//ups.conf ###########
> maxretry = 2
> [ups]
>         driver=usbhid-ups
>         desc="APS BR1600G UPS"
>         port=auto
>
>         ########### /etc/nut//upsd.conf ###########
> STATEPATH /var/run/nut
> LISTEN 0.0.0.0 3943
> LISTEN 127.0.0.1 3943
>
>         ########### /etc/nut//upsd.users ###########
>         [upsmonitor]
>                 password  =  ****m****
>                 actions = SET
>                 instcmds = ALL
>                 upsmon master
>         [admin]
>                 password =  ****m****
>                 actions = SET
>                 instcmds = ALL
>                 upsmon master
>         [root]
>                 password  =  ****m****
>                 actions = SET
>                 instcmds = ALL
>                 upsmon master
>         [upsmon]
>                 password  =  ****m****
>                 actions = SET
>                 instcmds = ALL
>                 upsmon master
>         [dan]
>                 password  =  ****m****
>                 actions = SET
>                 instcmds = ALL
>                 upsmon master
>
>         ########### /etc/nut//upsmon.conf ###########
> RUN_AS_USER root
> MONITOR ups at localhost 1 upsmonitor  ****m****  secondary
> MINSUPPLIES 1
> SHUTDOWNCMD "logger -t upsmon.conf: SHUTDOWN CMD "
> NOTIFYCMD /etc/nut/upssched-cmd.sh
> POLLFREQ  10
> POLLFREQALERT 5
> HOSTSYNC 15
> DEADTIME  30
> POWERDOWNFLAG /etc/killpower
> NOTIFYMSG ONLINE        "online"
> NOTIFYMSG ONBATT        "onbatt"
> NOTIFYMSG LOWBATT       "lowbatt"
> NOTIFYMSG FSD           "fsd"
> NOTIFYMSG COMMOK        "commok"
> NOTIFYMSG COMMBAD       "commbad"
> NOTIFYMSG SHUTDOWN      "shutdown"
> NOTIFYMSG REPLBATT      "replacebatt"
> NOTIFYMSG NOCOMM        "nocomm"
> NOTIFYMSG NOPARENT      "noparent"
> NOTIFYFLAG ONLINE       SYSLOG+WALL+EXEC
> NOTIFYFLAG ONBATT       SYSLOG+WALL+EXEC
> NOTIFYFLAG LOWBATT      SYSLOG+WALL+EXEC
> NOTIFYFLAG FSD          SYSLOG+WALL+EXEC
> NOTIFYFLAG COMMOK       SYSLOG+WALL+EXEC
> NOTIFYFLAG COMMBAD      SYSLOG+WALL+EXEC
> NOTIFYFLAG SHUTDOWN     SYSLOG+WALL+EXEC
> NOTIFYFLAG REPLBATT     SYSLOG+WALL+EXEC
> NOTIFYFLAG NOCOMM       SYSLOG+WALL+EXEC
> NOTIFYFLAG NOPARENT     SYSLOG+WALL+EXEC
> RBWARNTIME 43200
> NOCOMMWARNTIME 10
> FINALDELAY 5
>
>         ########### /etc/nut//upssched.conf ###########
> CMDSCRIPT /etc/nut/upssched-cmd.sh
> PIPEFN /run/nut/upssched/upssched.pipe
> LOCKFN /run/nut/upssched/upssched.lock
> AT ONBATT * EXECUTE START-TIMER onbatttimer  5
> AT ONLINE * EXECUTE CANCEL-TIMER onbatttimer online
> AT LOWBATT * EXECUTE lowbatt
> AT COMMBAD * EXECUTE START-TIMER combaddtimer  5
> AT COMMOK  * EXECUTE CANCEL-TIMER combaddtimer  commok
> AT NOCOMM  * EXECUTE  nocomm
> AT SHUTDOWN * EXECUTE powerdown
> AT FSD      * EXECUTE fsd
> AT NOPARENT * EXECUTE noparent
> AT REPLBATT * EXECUTE replacebatt
>
>         ########### /etc/nut/upssched-cmd.sh ###########
> logger -t upsched-cmd.sh: "upsched-cmd.sh running"
> case $1 in
>         online)
>         logger -t upssched: "online"
>         msmtp -t dan.grostick at outlook.com </etc/nut/online.txt
> ;;
>         onbatt)
>         logger -t upssched: "onbatt"
>         msmtp -t dan.grostick at outlook.com </etc/nut/onbatt.txt
> ;;
>         lowbatt)
>         logger -t upssched: "lowbatt"
>         msmtp -t dan.grostick at outlook.com </etc/nut/lobatt.txt
> ;;
>         commok)
>         logger -t upssched: "commok"
>         msmtp -t dan.grostick at outlook.com </etc/nut/commok.txt
> ;;
>         commbad)
>         logger -t upssched: "commbad"
> ;;
>         shutdown)
>         logger -t upssched: "shutdown"
>         msmtp -t dan.grostick at outlook.com </etc/nut/shutdown.txt
> ;;
>         replacebatt)
>         logger -t upssched: "replacwbatt"
>         msmtp -t dan.grostick at outlook.com </etc/nut/replacebatt.txt
> ;;
>         nocomm)
>         logger -t upssched: "nocomm"
> ;;
>         noparent)
>         logger -t upssched: "noparent"
>         msmtp -t dan.grostick at outlook.com </etc/nut/noparent.txt
> ;;
>         fsd)
>         logger -t upssched: "fsd"
>         msmtp -t dan.grostick at outlook.com </etc/nut/fsd.txt
> ;;
>         *)
>         logger -t upssched: "unknown command $1"
>         msmtp -t dan.grostick at outlook.com </etc/nut/unknowncommand.txt
> ;;
> esac
>
>         ########### /etc/hosts.allow ###########
>
>         ########### ps -eLf ###########
>
>         ########### Ownership and permissions of executables ###########
> -rwxr-xr-x 1 root root 320248 May 22 20:23 /usr/sbin//upsd*
> -rwxr-xr-x 1 root root 163620 May 22 20:23 /usr/sbin//upsdrvctl*
> -rwxr-xr-x 1 root root   6466 May 22 20:23 /usr/sbin//upsdrvsvcctl*
> -rwxr-xr-x 1 root root 182580 May 22 20:23 /usr/sbin//upsmon*
> -rwxr-xr-x 1 root root 133112 May 22 20:23 /usr/sbin//upssched*
>
>         ########### Ownership and permissions of configuration files
> ###########
> -rw-r--r-- 1 root root    89 May 20 17:46 /etc/nut//commbad.txt
> -rw-r--r-- 1 root root    83 May 20 17:46 /etc/nut//commok.txt
> -rw-r--r-- 1 root root    79 May 20 17:46 /etc/nut//fsd.txt
> -rwxr-xr-x 1 root root  1110 May 20 17:46 /etc/nut//hosts.conf*
> -rw-r--r-- 1 root root    79 May 20 17:46 /etc/nut//lowbatt.txt
> -rw-r--r-- 1 root root    85 May 20 17:46 /etc/nut//nocomm.txt
> -rw-r--r-- 1 root root    79 May 20 17:46 /etc/nut//noparent.txt
> -rw-r--r-- 1 root root  1587 May 27 08:51 /etc/nut//nut.conf
> -rw-r--r-- 1 root root    79 May 20 17:46 /etc/nut//onbatt.txt
> -rw-r--r-- 1 root root    67 May 20 17:46 /etc/nut//online.txt
> -rw-r--r-- 1 root root   105 May 20 17:46 /etc/nut//replacebatt.txt
> -rw-r--r-- 1 root root    93 May 20 17:46 /etc/nut//shutdown.txt
> -rw-r--r-- 1 root root    71 May 20 17:46 /etc/nut//unknowncommand.txt
> -rwxr-xr-x 1 root root  5595 May 23 08:35 /etc/nut//ups.conf*
> -rwxr-xr-x 1 root root  4594 May 20 17:46 /etc/nut//upsd.conf*
> -rwxr-xr-x 1 root root  2539 May 20 17:46 /etc/nut//upsd.users*
> -rwxr-xr-x 1 root root 15224 May 23 15:03 /etc/nut//upsmon.conf*
> -rwxr----- 1 root root  1211 May 20 17:46 /etc/nut//upssched-cmd.sh*
> -rwxr-xr-x 1 root root  4270 May 20 17:46 /etc/nut//upssched.conf*
> -rwxr-xr-x 1 root root  4178 May 20 17:46 /etc/nut//upssched.conf.bak*
> -rwxr-xr-- 1 root root  1201 May 20 17:46 /etc/nut//upssched.sh*
>
> /etc/nut//sample:
> total 88
> drwxr-xr-x 2 root root  4096 May 23 10:18 ./
> drwxr-xr-x 5 root root  4096 May 27 08:51 ../
> -rw-r--r-- 1 root root  1071 May 22 20:23 hosts.conf.sample
> -rw-r--r-- 1 root root  1911 May 22 20:23 nut.conf.sample
> -rw-r--r-- 1 root root  9269 May 22 20:23 ups.conf.sample
> -rw-r--r-- 1 root root  7477 May 22 20:23 upsd.conf.sample
> -rw-r--r-- 1 root root  2349 May 22 20:23 upsd.users.sample
> -rw-r--r-- 1 root root 21243 May 22 20:23 upsmon.conf.sample
> -rw-r--r-- 1 root root  4213 May 22 20:23 upssched.conf.sample
>
> /etc/nut//share:
> total 12
> drwxr-xr-x 3 root root 4096 May 20 17:31 ./
> drwxr-xr-x 5 root root 4096 May 27 08:51 ../
> drwxr-xr-x 3 root root 4096 May 22 20:23 nut-monitor/
>
> /etc/nut//usbdriver:
> total 1248
> drwxr-xr-x 2 root root   4096 May 22 20:23 ./
> drwxr-xr-x 5 root root   4096 May 27 08:51 ../
> -rwxr-xr-x 1 root root 299392 May 22 20:23 apcupsd-ups*
> -rwxr-xr-x 1 root root 286620 May 22 20:23 skel*
> -rwxr-xr-x 1 root root 677060 May 22 20:23 usbhid-ups*
>
>         ########### Custom NOTIFYCMD scheduler /etc/nut/upssched-cmd.sh
> ###########
> logger -t upsched-cmd.sh: "upsched-cmd.sh running"
> case $1 in
>         online)
>         logger -t upssched: "online"
>         msmtp -t dan.grostick at outlook.com </etc/nut/online.txt
> ;;
>         onbatt)
>         logger -t upssched: "onbatt"
>         msmtp -t dan.grostick at outlook.com </etc/nut/onbatt.txt
> ;;
>         lowbatt)
>         logger -t upssched: "lowbatt"
>         msmtp -t dan.grostick at outlook.com </etc/nut/lobatt.txt
> ;;
>         commok)
>         logger -t upssched: "commok"
>         msmtp -t dan.grostick at outlook.com </etc/nut/commok.txt
> ;;
>         commbad)
>         logger -t upssched: "commbad"
> ;;
>         shutdown)
>         logger -t upssched: "shutdown"
>         msmtp -t dan.grostick at outlook.com </etc/nut/shutdown.txt
> ;;
>         replacebatt)
>         logger -t upssched: "replacwbatt"
>         msmtp -t dan.grostick at outlook.com </etc/nut/replacebatt.txt
> ;;
>         nocomm)
>         logger -t upssched: "nocomm"
> ;;
>         noparent)
>         logger -t upssched: "noparent"
>         msmtp -t dan.grostick at outlook.com </etc/nut/noparent.txt
> ;;
>         fsd)
>         logger -t upssched: "fsd"
>         msmtp -t dan.grostick at outlook.com </etc/nut/fsd.txt
> ;;
>         *)
>         logger -t upssched: "unknown command $1"
>         msmtp -t dan.grostick at outlook.com </etc/nut/unknowncommand.txt
> ;;
> esac
>
> =============================================================================
>
> _______________________________________________
> Nut-upsuser mailing list
> Nut-upsuser at alioth-lists.debian.net
> https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20230527/fa8fcf7f/attachment-0001.htm>


More information about the Nut-upsuser mailing list