[mythtvnz] Anyone upgraded to V34
Stephen Worthington
stephen_agent at jsw.gen.nz
Fri Mar 22 23:46:05 GMT 2024
On Sat, 23 Mar 2024 10:36:45 +1300, you wrote:
>Discovered that my problem was an old script I had running that looked
>for HD Homerun units on the network and restarted mythtv-backend when
>they became available. Looks like something was going wrong causing
>lots of backend restarts and consequently restart/start then being
>blocked.
>
>From vague memory of mythtv changes a long time ago I don't think the
>script is needed anymore so I've disabled it and mythtv 0.34 looks fine
>now.
When using networked tuners like HDHomeruns, or using external
frontends, you do need to use some method of ensuring mythbackend only
starts after the network is up. Otherwise there is a race condition
where mythbackend will only see the localhost network interface and
will not bring up the normal network interface. It sounds like you
have never implemented the right sort of fix for this using systemd,
and have been relying on your old script doing things externally to
systemd. Even though your system now seems to be booting ok, the race
condition will still exist and at some point the timing of things at
boot time will change (for example, if you have an ext partition do an
automatic fsck at boot time). And then mythbackend will not start
properly.
The right fix for this when using networked tuners is normally to make
the mythbackend systemd unit wait until the networked tuners respond
to network traffic. With HDHomerun tuners, you can use the
hdhomerun_config command to tell systemd when the tuners are
responding. The best way to do this is to create a new systemd unit
that calls hdhomerun_config repeatedly until it gets a response. Then
have the mythbackend systemd unit wait for the new unit before it
starts.
Something like this should work (but as I do not have any HDHomerun
tuners I have not tested this).
sudo systemctl edit wait-for-hdhomerun-response.service
Then paste this into the editor:
[Unit]
Description=Wait for an HDHomerun networked tuner to respond
After=network.target
[Service]
Type=simple
ExecStartPre=/usr/local/bin/wait-for-hdhomerun-response.sh
ExecStart=/bin/true
[Install]
WantedBy=multi-user.target
Create the /usr/local/bin/wait-for-hdhomerun-response.sh file and put
this in it:
#!/bin/bash
TRIES=30
echo "Waiting for HDHomerun"
for i in $(seq $TRIES); do
hdhomerun_config FFFFFFFF get /sys/model > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Found HDHomerun at try $i"
exit 0
fi
sleep 1.0
done
echo "Cannot find HDHomerun after $TRIES tries"
exit 1
Then do:
sudo chown root:root /usr/local/bin/wait-for-hdhomerun-response.sh
sudo chmod a=r,g=r,u=rwx /usr/local/bin/wait-for-hdhomerun-response.sh
sudo systemctl edit mythtv-backend.service
Paste this into the editor:
[Unit]
Wants=wait-for-hdhomerun-response.service
After=wait-for-hdhomerun-response.service
Then do:
sudo systemctl daemon-reload
More information about the mythtvnz
mailing list