[mythtv-users] Help: Failed to connect to (127.0.0.1:6543) Connection refused

Keith Pyle kpyle at austin.rr.com
Sat Sep 7 16:09:29 UTC 2019


On 09/07/19 06:40, Craig Huff wrote:
> On Fri, Sep 6, 2019 at 7:47 PM Bill Meek <keemllib at gmail.com> wrote:
>> On 9/6/19 7:36 PM, Craig Huff wrote:
>>>     Hmmm...
>>>
>>>     So, if the settings in config.xml are for mysql, and the settings in
>> mythtv-backend point to the IP address 192.168.1.149, why is
>>>     mythwelcome trying to connect to 127.0.0.1:6543 <
>> http://127.0.0.1:6543>?
>>>     --
>>>     Craig.
>>>
>>>
>>> Could it be that the local loopback hardware on my several year old mobo
>> is acting up (failing) even though the network connection is fine?
>>> --
>>> Craig.
>> Are both IPs in mythtv-setup the same? master and server. And, mention your
>> version as v30 had changes that my be in  play, e.g. Master Server Name.
>> Then
>> see what IP that name resolves to.
>>
>> I'd pastebin the latest backend and welcome logs and add a link here. Maybe
>> someone can spot something.
>>
>> --
>> Bill
>>
> Except for one time today, which took a long time to connect, I can't get
> into mythtv-setup now either -- the logs have the same error symptom.
> IIRC, both IPs are the same in the backend setup.
>
> I don't have pastebin set up right now, but the logs are pretty short.
>
> Here's the log of the latest run of mythbackend:
<snip>
> Sep  6 19:57:26 penguin mythwelcome: mythwelcome[18683]: E
> MythSocketThread(-1) mythsocket.cpp:721 (ConnectToHostReal)
> MythSocket(2ae4f00:-1): Failed to connect to (127.0.0.1:6543) Connection
> refused
> Sep  6 19:58:26 penguin mythwelcome: mythwelcome[18683]: E
> MythSocketThread(-1) mythsocket.cpp:721 (ConnectToHostReal)
> MythSocket(29b67d0:-1): Failed to connect to (127.0.0.1:6543) Connection
> refused
> Sep  6 19:59:27 penguin mythwelcome: mythwelcome[18683]: E
> MythSocketThread(-1) mythsocket.cpp:721 (ConnectToHostReal)
> MythSocket(29b67d0:-1): Failed to connect to (127.0.0.1:6543) Connection
> refused
>
> It worked when I last started the system up, but today's been a bust.  I
> have no clue what changed.
>
> --
> Craig.
Broadly speaking , there are two main causes for a "Connection refused" error: (1) there is no program listening for a connection on the specified port, or (2) a firewall is actively blocking connections to that port.  Checking for the first case is easy.  Run this command as root on the machine to which you are trying to connect, penguin in this case:

lsof -i :6543 -n -P

This will list all instances of any program listening on port 6543.  You should get output that looks something like this:

COMMAND     PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
mythbacke 32307 mythtv   77u  IPv4 3577349      0t0  TCP 127.0.0.1:6543 (LISTEN)
mythbacke 32307 mythtv   78u  IPv4 3577350      0t0  TCP 192.168.1.1:6543 (LISTEN)
mythbacke 32307 mythtv   79u  IPv6 3577351      0t0  TCP [::1]:6543 (LISTEN)
mythbacke 32307 mythtv   80u  IPv6 3577352      0t0  TCP [fd74:1234:5678:0:1:23:4567:a1b]:6543 (LISTEN)
mythbacke 32307 mythtv   81u  IPv6 3577353      0t0  TCP [fe80::123:4567:89ab:a1b]:6543 (LISTEN)

The key point here is that you should see a line like the first one that has "127.0.0.1:6543 (LISTEN)" in the last column.  This shows that mythbackend is listening on localhost port 6543 for a TCP IPv4 connection.  If you have IPv6 configured, you'll have a line like the third one showing "[::1]:6543 (LISTEN)".  If you don't have a line like either of these, then your application is not listening on localhost.  You'll need to examine the application configuration (i.e., myth) to determine why.  If localhost is present, then you should determine if you have some type of firewall (e.g., iptables) running that is blocking connections.

In the above output, the second line shows that mythbackend is listening on the IPv4 address 192.168.1.1 and lines 4 & 5 show mythbackend is listening on IPv6 as well.

Keith


More information about the mythtv-users mailing list