<div dir="ltr">---------- Forwarded message ----------<br>From: Stephen Worthington <<a href="mailto:stephen_agent@jsw.gen.nz">stephen_agent@jsw.gen.nz</a>><br>To: MythTV in NZ <<a href="mailto:mythtvnz@lists.ourshack.com">mythtvnz@lists.ourshack.com</a>><br>Cc: <br>Bcc: <br>Date: Wed, 01 Nov 2017 13:29:21 +1300<br>Subject: Re: [mythtvnz] MythTV 0.29 and HDHomeRun<br>On Wed, 1 Nov 2017 11:15:31 +1300, you wrote:<br><p class="MsoNormal" style="margin-bottom:12pt"><span style="color:rgb(64,64,64)"><br></span></p><p class="MsoNormal" style="margin-bottom:12pt"><span style="color:rgb(64,64,64)">></span>If you set up MythTV to use the external IP
address of the PC (as you<br>
<span style="color:rgb(64,64,64)">></span>do if you are using external frontends),
then in v29 that problem<br>
<span style="color:rgb(64,64,64)">></span>should go away. I suspect that you
are just using localhost<br>
<span style="color:rgb(64,64,64)">></span>(127.0.0.1) to connect to the backend,
and the localhost interface<br>
<span style="color:rgb(64,64,64)">></span>comes up virtually instantly compared to
the real interfaces like<br>
<span style="color:rgb(64,64,64)">></span>Ethernet cards. In 0.28 and
before, if you used the external address<br>
<span style="color:rgb(64,64,64)">></span>of the PC, then mythbackend could come
up before it was ready and<br>
<span style="color:rgb(64,64,64)">></span>would decided to drop back to using
localhost. In v29 that should<br>
<span style="color:rgb(64,64,64)">></span>have been fixed and it will wait quite a
long time for the specified<br>
<span style="color:rgb(64,64,64)">></span>IP address to become available to bind
to.<br>
<span style="color:rgb(64,64,64)">></span><br>
<span style="color:rgb(64,64,64)">></span>In 0.28 and before, the normal fix on
Ubuntu with systemd was to<br>
<span style="color:rgb(64,64,64)">></span>create a systemd override file for
mythtv-backend.service to make it<br>
<span style="color:rgb(64,64,64)">></span>wait for NetworkManager to be
running. NetworkManager normally only<br>
<span style="color:rgb(64,64,64)">></span>signals it is running after the Ethernet
interfaces are up. There are<br>
<span style="color:rgb(64,64,64)">></span>threads on the mythtv-users mailing list
that tell you how to do that<br>
<span style="color:rgb(64,64,64)">></span>- it is a bit involved. But try
just changing to using the external<br>
<span style="color:rgb(64,64,64)">></span>IP address of the box first.<br>
<span style="color:rgb(64,64,64)">></span><br>
<span style="color:rgb(64,64,64)">></span>If mythbackend ever comes up before a
tuner is ready, then it will<br>
<span style="color:rgb(64,64,64)">></span>mark the tuner as unavailable and will
not use it. So if you have<br>
<span style="color:rgb(64,64,64)">></span>tuners that are slow to come up, it can
be a good idea to have a<br>
<span style="color:rgb(64,64,64)">></span>systemd override file for
mythtv-backend.service that tells it to wait<br>
<span style="color:rgb(64,64,64)">></span>for those tuners before starting
mythbackend. I do not know of any<br>
<span style="color:rgb(64,64,64)">></span>way to do that with HDHomerun tuners, so
you will need to make sure<br>
<span style="color:rgb(64,64,64)">></span>they are on and fully up before
mythbackend gets started. For<br>
<span style="color:rgb(64,64,64)">></span>internal tuners, you create a
/etc/udev/rules.d/99-tuner.rules file<br>
<span style="color:rgb(64,64,64)">></span>containing this:<br>
<span style="color:rgb(64,64,64)">></span><br>
<span style="color:rgb(64,64,64)">></span>#<br>
<span style="color:rgb(64,64,64)">></span># Create systemd device units for
capture devices<br>
<span style="color:rgb(64,64,64)">></span>#<br>
<span style="color:rgb(64,64,64)">></span>SUBSYSTEM=="video4linux",
TAG+="systemd"<br>
<span style="color:rgb(64,64,64)">></span>SUBSYSTEM=="dvb",
TAG+="systemd"<br>
<span style="color:rgb(64,64,64)">></span>SUBSYSTEM=="firewire",
TAG+="systemd"<br>
<span style="color:rgb(64,64,64)">></span><br>
<span style="color:rgb(64,64,64)">></span>and then in your systemd override file
you put things like this in the<br>
<span style="color:rgb(64,64,64)">></span>[Unit] section:<br>
<span style="color:rgb(64,64,64)">></span><br>
<span style="color:rgb(64,64,64)">></span>Wants=dev-dvb-adapter0-frontend0.device<br>
<span style="color:rgb(64,64,64)">></span>After=dev-dvb-adapter0-frontend0.device<br>
<span style="color:rgb(64,64,64)">></span>Wants=dev-dvb-adapter1-frontend0.device<br>
<span style="color:rgb(64,64,64)">></span>After=dev-dvb-adapter1-frontend0.device<br>
<span style="color:rgb(64,64,64)">></span><br>
<span style="color:rgb(64,64,64)">></span>A Wants line tells systemd that this
unit wants that other unit<br>
<span style="color:rgb(64,64,64)">></span>started. An After line tells
systemd to wait until that other unit<br>
<span style="color:rgb(64,64,64)">></span>signals it is started before starting
this unit.<br>
<br>
<span style="color:rgb(64,64,64)">Thanks very much Stephen! This is really useful. I have now verified (via mythbackend.log and
kern.log) that the mythbackend is definitely trying to connect to the HDHomeRun
before the eth0 interface is ready. </span><span></span></p>
<p class="MsoNormal"><span style="color:rgb(64,64,64)">As you suggest, I changed the IP
address in my MythBackend setup to point to the real IP address rather than
127.0.0.1. I had to modify the MYSQL
config file to bind to 0.0.0.0 rather than 127.0.0.1 so that the backend could
actually connect. Unfortunate there was
no change – the issue persists and the backend is still trying to connect to
the HDHomeRun before the network is up.<span></span></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(64,64,64)"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(64,64,64)">I shall have a hunt around online to see how I can delay the
mythbackend via systemmd.<span></span></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(64,64,64)"> </span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:Arial,sans-serif;color:rgb(64,64,64)">Cheers<span></span></span></p><div class="gmail_extra">Mark<br><div class="gmail_quote"><br></div></div></div>