[mythtv-users] Which SystemD script?

Stephen Worthington stephen_agent at jsw.gen.nz
Thu Apr 28 15:16:11 UTC 2022


On Thu, 28 Apr 2022 06:13:42 -0500, you wrote:

>That's a good tip, but it may not be needed. I have the same
>mythtv-backend.service file as the OP in that thread and I have never
>had an issue with my hdhr tuner being marked as unavailable.

Until it happens.  It is a race condition - it is likely that there is
something in your system that makes mythbackend start late enough that
networking is up.  Most of the time.  But with race conditions,
eventually something happens that changes the timing, and then
mythbackend starts earlier and the tuner is not found.  Things that
affect the timing fairly drastically are fscks being run on partitions
at startup, which will happen from time to time if you are using ext
format partitions, or if you have a power failure and the partitions
are still marked as dirty on the next boot.  Or some random program
that used to hold things up for a while gets a new version that makes
it work faster.  Or a new version of systemd gets installed that runs
something in parallel that used to run in sequence.  Or you upgrade to
Ubuntu 22.04 LTS and the timings have changed and you always get
mythbackend starting too early.  That is the nature of race conditions
- some systems will see the problem on almost every boot, and others
will not see it except maybe once in the lifetime of the system.

So, have you ever had a problem where mythbackend did not seem to be
working and you restarted it and then it was working?  That is the
characteristic pattern that you see with this race condition - it only
happens at boot, so a restart of mythbackend even a few seconds after
boot will never have it happen.

It really is always better to actually fix race conditions by making
things happen in the required order, rather than just rely on "its
working, so why bother?".  Unfixed race conditions will usually bite
you at some time and it often happens when it will cause real problems
for you, like when you are trying to work out some hardware problem
and the race condition also pop up and fools you into thinking that a
bit of hardware is faulty so you buy a new one that you really did not
need to.


More information about the mythtv-users mailing list