Bug 848129 - apcupsd apparently not listening for connections: apcaccess cannot connect, netstat doesn't show it listening
apcupsd apparently not listening for connections: apcaccess cannot connect, n...
Product: Fedora
Classification: Fedora
Component: apcupsd (Show other bugs)
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Michal Hlavinka
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-08-14 13:40 EDT by Adam Williamson
Modified: 2012-08-15 15:15 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-08-15 15:15:16 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Adam Williamson 2012-08-14 13:40:26 EDT
After I updated my desktop to F18, I notice that GNOME doesn't show a battery icon for my UPS any more. Investigating further, although apcupsd is certainly running properly:

[root@adam ~]# systemctl status apcupsd.service
apcupsd.service - APC UPS Power Control Daemon for Linux
	  Loaded: loaded (/usr/lib/systemd/system/apcupsd.service; enabled)
	  Active: active (running) since Tue, 14 Aug 2012 10:33:34 -0700; 4min 3s ago
	 Process: 8842 ExecStartPre=/bin/rm -f /etc/apcupsd/powerfail (code=exited, status=0/SUCCESS)
	Main PID: 8845 (apcupsd)
	  CGroup: name=systemd:/system/apcupsd.service
		  └ 8845 /sbin/apcupsd -b -f /etc/apcupsd/apcupsd.conf

Aug 14 10:33:35 adam.localdomain apcupsd[8845]: apcupsd 3.14.10 (13 Septembe...d
[root@adam ~]# ps aux | grep apcupsd
root      8845  0.0  0.0  59160  2620 ?        Ssl  10:33   0:00 /sbin/apcupsd -b -f /etc/apcupsd/apcupsd.conf
root      9173  0.0  0.0 109172   932 pts/1    S+   10:37   0:00 grep --color=auto apcupsd
[root@adam ~]#

apcaccess can't talk to it:

[root@adam ~]# apcaccess 
Error contacting apcupsd @ localhost:3551: Connection refused
[root@adam ~]# 

and indeed, so far as I can tell (I'm terrible at using netstat, but I think I got it right), apcupsd isn't listening on 3551 or indeed any other port:

[root@adam ~]# netstat --numeric-ports -a -p | grep apc
unix  3      [ ]         STREAM     CONNECTED     2951055  8845/apcupsd         
unix  2      [ ]         DGRAM                    2969015  8845/apcupsd         

Those are both sockets, no ports are shown.
Comment 1 Michal Hlavinka 2012-08-15 06:53:09 EDT
That's odd, we have the same apcupsd in all Fedora releases. I tested it in Fedora 17 and it works as expected.

Could you check if it works after you restart the service? Does it work with SELinux in permissive mode ($ setenfoce 0 ) - maybe it does not allow to open listening port? And also please check if there is anything else using that port:
netstat -ln | grep 3551. If nothing of this helps, recheck and attach your apcupsd.conf Thanks
Comment 2 Michal Hlavinka 2012-08-15 12:49:30 EDT
I just tried to reproduce it in virtual machine with fresh F18 and exported usb and it was working fine. Btw, don't forget to check acpupsd service status again after some time. If you start it and check status, it's running (and trying to connect to ups), but if it fails to connect, it gives up after some time. Also it listens on 3551 only when it's connected to ups. So, check apcupsd status again after half a minute and also check /var/log/messages log too.
Comment 3 Adam Williamson 2012-08-15 15:13:34 EDT
apcupsd.service - APC UPS Power Control Daemon for Linux
	  Loaded: loaded (/usr/lib/systemd/system/apcupsd.service; enabled)
	  Active: active (running) since Tue, 14 Aug 2012 12:19:08 -0700; 23h ago
	Main PID: 889 (apcupsd)
	  CGroup: name=systemd:/system/apcupsd.service
		  └ 889 /sbin/apcupsd -b -f /etc/apcupsd/apcupsd.conf

Aug 14 12:19:09 adam.localdomain apcupsd[889]: apcupsd 3.14.10 (13 September...d

23 hours running, still not listening anywhere. 

[root@adam x86_64]# netstat -ln | grep 3551
[root@adam x86_64]# 


Nothing useful in /var/log/messages:

Aug 14 12:19:09 adam apcupsd[889]: apcupsd 3.14.10 (13 September 2011) redhat startup succeeded

is the sole message from the most recent start of apcupsd. Nothing with 'apc' after that.

It was working fine in Fedora 17 before I upgraded (at least, GNOME could see the UPS, I didn't specifically test for a listening port and apcaccess working). I suppose it's possible apcupsd was actually behaving the same in F17 for some reason and GNOME should be able to see the UPS without a TCP/IP port, I can't say I know that for sure. My apcupsd.conf is very standard and hasn't changed since f17, but I'll attach it anyhow.
Comment 4 Adam Williamson 2012-08-15 15:15:16 EDT
Ah, d'oh. I have NIS disabled in the config file. So I was looking at the wrong thing; there's no evidence apcupsd is behaving wrong here. I guess I'll have to look at the GNOME end of things instead.

Note You need to log in before you can comment on or make changes to this bug.