[mythtv-users] delaying backend startup until the network is up

James Abernathy jfabernathy at gmail.com
Tue Dec 11 01:32:51 UTC 2018

On 12/10/18 5:31 PM, David Engel wrote:
> On Mon, Dec 10, 2018 at 05:03:02PM -0500, James Abernathy wrote:
>> on my production system I use without issue the systemd override provided by.
>> sudo systemctl edit mythtv-backend.service
>> [Unit]
>> After=NetworkManager-wait-online.service
>> When I built a test system using the same HDHR tuners but with the mythhdhrrecorder external recorder I used the same overide setup. However, if I boot my test system I get a lot of errors on 2-4 tuners and the errors are related to opening the tuner. This is solved by doing the following after boot:
>> sudo systemctl stop mythtv-backend
>> sudo systemctl start mythtv-backend
>> What is special about mythhdhrrecorder and external recorder blackbox that makes this systemd override not work???
> Does this patch help?  I've used it for several years along with
> "Requires=ifup at eth0.service" in my mythbackend.service file to avoid
> starting before the network.  I never commited it because I assumed
> the normal code worked for everyone else.  In case it matters, I use
> Debian testing.
> David
> diff --git a/mythtv/libs/libmythbase/serverpool.cpp b/mythtv/libs/libmythbase/serverpool.cpp
> index c39e99024f..65a5cf0a08 100644
> --- a/mythtv/libs/libmythbase/serverpool.cpp
> +++ b/mythtv/libs/libmythbase/serverpool.cpp
> @@ -117,7 +117,7 @@ void ServerPool::SelectDefaultListen(bool force)
>       QList<QNetworkInterface>::const_iterator qni;
>       for (qni = IFs.begin(); qni != IFs.end(); ++qni)
>       {
> -        if ((qni->flags() & QNetworkInterface::IsRunning) == 0)
> +        if ((qni->flags() & QNetworkInterface::IsUp) == 0)
>               continue;
>           QList<QNetworkAddressEntry> IPs = qni->addressEntries();

I'm not sure I could try this.  From what I see it's a C++ patch to 
source code. I'm running straight Ubuntu 18.04 binary.  And I only have 
this issue with tuners that are used via External Recording -> 
mythhdhrrecorder.  My production system, which is standard HDHR tuners 
has never had an issue with mythtv-backend starting before the network 
could talk to the HDHR tuners.

Jim A

More information about the mythtv-users mailing list