[mythtv-users] : MythTV backend service started before network is functional

R Kannan rk111810 at gmail.com
Tue Aug 6 21:38:33 UTC 2019

> Date: Tue, 06 Aug 2019 19:25:33 +1200
> From: Stephen Worthington<stephen_agent at jsw.gen.nz>
> To: Discussion about MythTV<mythtv-users at mythtv.org>
> Subject: Re: [mythtv-users] Fwd: MythTV backend service started before
> 	network is functional
> Message-ID:<kp8ikepn33al4k9d59ia57075c4u3mgv9i at 4ax.com>
> Content-Type: text/plain; charset=us-ascii
> On Mon, 5 Aug 2019 15:09:22 -0400, you wrote:
>> Stephen,
>> A few questions.
>> 1) Why doesn't stopping and stopping mythtv-backend' service fix this
>> issue? Is the tuner permanently marked as 'bad' barring a reboot. Note
>> that the reboot runs into the same issue.
> If stopping and restarting mythbackend does not fix the problem, then
> it is not the race condition.  But you do need to be sure that you
> have actually stopped and restarted mythbackend.  In 14.04, how you do
> that is rather different as it does not use systemd, and also not init
> scripts except as a fallback option, but instead a different system
> again, called Upstart.
> So to do the check that restarting mythbackend fixes the problem and
> hence you are getting the race condition, this is what you need to do:
> Check that mythbackend is running now:
>    ps -e | grep mythbackend
> Then stop mythbackend:
>    sudo stop mythtv-backend
> and verify that it has stopped:
>    ps -e | grep mythbackend
> and start mythbackend again:
>    start mythtv-backend
> and verify that mythbackend is running again:
>    ps -e | grep mythbackend
> Note that the "service xxxxx start" commands also work, but only
> indirectly.  The correct commands to use with Upstart are "start",
> "stop", "status" and "restart".
You can see from my question below that I have tried stopping and 
restarting the backend. I did it with 'service' and 'update-rc.d' but 
that did not seem to help for some reason.
>> 2) I have ubuntu 14.04 (upgraded from 12.04) and it seems to be half way
>> into systemd and so 'systemctl' is unavailable. The backend seems to ave
>> been stopped and started with 'service mythtv-backend start'.
>> 'NetworkManager-wait-online.service' you refer to in your solution seems
>> to be unavailable as well. I see that the
>> '/etc/init/mythtv-backend.conf' has the following line....
>> start on (local-filesystems and *net-device-up IFACE!=lo *and started
>> udev-finish)
>> Doesn't this ensure that network access to all non-loopback devices are
>> up before mythtv-backend is started? Why is there a need for the
>> additional checks in your solution. Am I missing something?
> I theory it should work, but when I checked my old 14.04.5 partition,
> I can see that this is what I had:
> #start on (local-filesystems and net-device-up IFACE!=lo and started
> udev-finish)
> start on (local-filesystems and net-device-up IFACE=eth0 and
> net-device-up IFACE=br0 and net-device-up IFACE=eth1 and started
> udev-finish)
> stop on runlevel [016]
> So I have commented out the default "start on" line and replaced it
> with one that specifically specifies all the network devices to wait
> on.  In my case that is eth0, eth1 and tap0, due to how that PC does
> other networking and routing functions (it is my OpenVPN server).  In
> your case, you would probably only want to make it wait on eth0 (or
> whatever the name of your Ethernet interface is).  I am pretty sure
> that I had to do that as the default "start on" line did not work
> properly.
> How many network interfaces does your MythTV box have?  If it only has
> localhost and one Ethernet interface, then the default "start on" line
> should work.  If it has more than one Ethernet interface, or also has
> other interfaces such as WiFi or virtual ones such as my tap0
> interface for OpenVPN, then the default "start on" line will allow
> mythbackend to start when any of the other interfaces is up, not only
> after the Ethernet interface used to talk to the tuners is up.
I have both ethernet and wireless network interface on this desktop but 
both connect the same router where my network tuner (HDHR) is connected. 
If wireless is connected, the backend should be able to see the HDHR 
through the wireless connection.
>> Thanks again for your help
> Have you upgraded the PC to boot from an SSD?  That causes all sorts
> of changes to the timing of things, and Upstart was never optimised
> for that.

No I did not. I have the plain old spinning disk.  For now I added a 
sleep line to "/etc/init/mythtv-backend.conf"  at the pre-start section 
as below:

pre-start script
     sleep 10 # Added sleep to allow for network to be operational 
during reboot before backend

and this seems to work. I tried multiple reboots to test it.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20190806/8c7eea14/attachment.html>

More information about the mythtv-users mailing list