Can't Connect to Master Backend via IP addr for Services API

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
yajrendrag
Junior
Posts: 16
Joined: Sun May 03, 2015 12:38 am
United States of America

Can't Connect to Master Backend via IP addr for Services API

Post by yajrendrag »

I upgraded an ubuntu 14.04 / myth 0.28 fixes system to ubuntu 16.04 / myth 0.28 fixes - did a fresh install of ubuntu 16.04.3 and imported my database. It all worked fine - i could access mythweb and hit the services API.

after a reboot, i could no longer connect to mythweb - it reported that it could not connect to the master backend. I opened Mythbackend Setup and it showed that both the local backend and master backend ip addresses were set to the (same) real IP address on my local network. Presumably this is how i had it set up on my 14.04 system (which i still have available on a separate disk in case i need to go check any settings). I only have a single backend.

I changed the master backend entry to 127.0.0.1 (leaving the local backend address set to the real ip) and then mythweb connects but i cannot hit the services API unless i use localhost as the backend ip address, which means i can only use it from the master backend machine.

Even now if i go back and change the master backend address to the same real IP as the local backend address, i still can't access the services API.

if i try and connect to the services API using the backend's IP, i get an error in the browser saying the master.IP.address refused to connect.

Any ideas of how to fix this?

thx, jay
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: Can't Connect to Master Backend via IP addr for Services

Post by MikeB2013 »

Without logs it is difficult, but I am going to guess based on your comment that all was working until a reboot.

Ubuntu 16.04 uses a different method at boot than Ubuntu 14.04 (systemd instead of upstart), which can under some circumstances can result in mythbackend starting before networking and tuner devices have been fully initialized. There is a simple test you can run to see if this startup issue exists.

In a terminal session do:
sudo systemctl restart mythtv-backend.service

If everything now works you have the startup issue. There are many posts about how to fix this issue, here is what I am now using on my production and test systems, it is a pragmatic solution which delays mythbackend startup by 20 seconds. Technically it adds a systemd override file, which will survive mythtv updates.

In a terminal on the machine running mythtv backend:

sudo systemctl edit mythtv-backend.service and add the following two lines:
[Service]
ExecStartPre=/bin/sleep 20

Then exit from the edit screen (it uses nano by default, so Ctrl+x, then y, then Return key) then reboot the machine.

As a final point always use sudo systemctl stop mythtv-backend.service before running mythtv-setup (there are reports around that mythbackend does not always stop). If mythbackend and mythtv-setup run at the same time strange things happen.
yajrendrag
Junior
Posts: 16
Joined: Sun May 03, 2015 12:38 am
United States of America

Re: Can't Connect to Master Backend via IP addr for Services

Post by yajrendrag »

thanks very much @MikeB2013.
that was indeed the problem - all is well again.

thx, Jay
Post Reply