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

David Engel david at istwok.net
Mon Dec 10 22:31:57 UTC 2018

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.


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)
         QList<QNetworkAddressEntry> IPs = qni->addressEntries();

David Engel
david at istwok.net

More information about the mythtv-users mailing list