[mythtv-users] race

Daryl McDonald darylangela at gmail.com
Mon Sep 21 20:13:11 UTC 2020

On Mon, Sep 21, 2020 at 1:55 PM Stephen Worthington <
stephen_agent at jsw.gen.nz> wrote:

> On Mon, 21 Sep 2020 12:48:30 -0400, you wrote:
> >From what I've read on this list I think I have a race issue. I'm using
> one
> >PCIe and three PCI capture devices, no network tuners, but now that I have
> >ACPI functioning, I noticed a conflict for football games on Sunday. Half
> >of my tuners were not recognized (outlined in red) fixed with a "sudo
> >systemctl restart mythtvbackend". Googling shows a solution for 16.04
> >involving system.d, because I'm using 20.04, I'm not sure that that is
> >appropriate for me. I believe I need to add a delay and would appreciate
> >being told where to put it. OS is now on a SSD, mythtv version 31. TIA
> >Daryl
> No, never fix race conditions using a delay.  That always ends badly.
> Race conditions should be fixed by waiting for the device to be ready.
> For non-networked tuners, you can add a udev rule to make their status
> available to systemd, then set up systemd to make mythbackend wait
> until all the tuners are available before it starts.
> In /etc/udev/rules.d add a new file 99-tuner.rules:
> #
> # Create systemd device units for capture devices
> #
> SUBSYSTEM=="video4linux", TAG+="systemd"
> SUBSYSTEM=="dvb", TAG+="systemd"
> SUBSYSTEM=="firewire", TAG+="systemd"
> It should be chown root:root and chmod u=rw,og=r.
> Then do:
> sudo systemctl edit mythtv-backend
> which will either create a new systemd override file or edit an
> existing one.  In the override file, put:
> [Unit]
> Wants=dev-dvb-adapter0-frontend0.device
> After=dev-dvb-adapter0-frontend0.device
> Wants=dev-dvb-adapter1-frontend0.device
> After=dev-dvb-adapter1-frontend0.device
> Wants=dev-dvb-adapter2-frontend0.device
> After=dev-dvb-adapter2-frontend0.device
> Wants=dev-dvb-adapter3-frontend0.device
> After=dev-dvb-adapter3-frontend0.device
> Save the file and exit the editor.  Then do:
> sudo systemctl daemon-reload
> to get systemd to see the new configuration.  Then reboot.
> What the SUBSYSTEM=="dvb", TAG+="systemd" rule does is create systemd
> devices for each DVB adapter like "dev-dvb-adapter0-frontend0.device".
> If you look in your /var/log/kern.log file you should find messages
> about each DVB adapter that gets created giving the adapter numbers.
> You can also do a command like:
> sudo systemctl status dev-dvb-adapter0-frontend0.device.  Here is what
> I get:
> ? dev-dvb-adapter0-frontend0.device - /dev/dvb/adapter0/frontend0
>    Follow: unit currently follows state of
> sys-devices-pci0000:00-0000:00:0a.0-0000:07:00.0-dvb-dvb0.frontend0.device
>    Loaded: loaded
>    Active: active (plugged) since Fri 2020-09-18 02:10:33 NZST; 4 days
> ago
>    Device:
> /sys/devices/pci0000:00/0000:00:0a.0/0000:07:00.0/dvb/dvb0.frontend0
> Sep 18 02:10:33 mypvr systemd[1]: Found device
> /dev/dvb/adapter0/frontend0.
> and from the sys-devices line you can track down which PCI bus device
> is being referred to and hence which tuner.
> The [Unit] Wants and After lines tell systemd that this unit needs
> those devices to have been started and become available before it gets
> started.  There is a global systemd timeout that gets applied, so that
> even if one of the devices is not available, after that timeout (30?
> seconds), the unit gets started anyway.
> The above presumes that all your tuners are DVB or ATSC devices which
> create devices like /dev/dvb/adapter0/frontend0.  If they are analogue
> capture cards that create devices like /dev/video0, then the systemd
> device names needed will be like dev-video0.device.
> Yes, all ATSC. I just rebooted, after making the changes, and unlike other
reboots, when I opened the FE, it searched for the BE, which confirms, for
me, that this worked very well. Many thanks Stephen!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20200921/57993f17/attachment.htm>

More information about the mythtv-users mailing list