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

Stephen Worthington stephen_agent at jsw.gen.nz
Tue Aug 6 07:25:33 UTC 2019


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".

>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.

>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.


More information about the mythtv-users mailing list