Delay backend startup for device detection with systemd

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Post Reply
dantengwen
Newcomer
Posts: 6
Joined: Sat Nov 17, 2018 10:28 pm
Afghanistan

Delay backend startup for device detection with systemd

Post by dantengwen »

fter upgrading my (0.28) backend to Ubuntu 16.04 it would not reliably use all tuners. The backend service was starting before udev had detected all USB devices and created symlinks for them.

Creating this systemd configuration file will delay the start of the backend service until udev has settled:

# file /etc/systemd/system/mythtv-backend.service.d/mythtv-backend.conf
# Delay mythtv backend start until all tuners have been detected

[Unit]
After=systemd-udev-settle
EDIT: Add errors from mythbackend.log


Jan 4 10:15:19 tv mythbackend: mythbackend[1385]: W CoreContext recorders/dvbchannel.cpp:245 (Open) DVBChan[1](/dev/dvb/adapter_pctv/frontend0): Opening DVB frontend device failed.#012#011#011#011eno: No such file or directory (2)
Jan 4 10:15:19 tv mythbackend: mythbackend[1385]: E CoreContext recorders/dvbchannel.cpp:250 (Open) DVBChan[1](/dev/dvb/adapter_pctv/frontend0): Failed to open DVB frontend device due to fatal error or too many attempts.
Jan 4 10:15:19 tv mythbackend: mythbackend[1385]: E CoreContext recorders/channelbase.cpp:871 (CreateChannel) ChannelBase: CreateChannel() Error: Failed to open device /dev/dvb/adapter_pctv/frontend0
Jan 4 10:15:19 tv mythbackend: mythbackend[1385]: E CoreContext main_helpers.cpp:202 (setupTVs) Problem with capture cards. Card 1 failed init
Last edited by Steve Goodey on Thu Nov 22, 2018 9:04 pm, edited 2 times in total.
Reason: Download links removed.
User avatar
bill6502
Developer
Posts: 2325
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Delay backend startup for device detection with systemd

Post by bill6502 »

systemctl cat systemd-udev-settle has some interesting comments in it. I've
never used it with the backend service. Here's my unit section:

Code: Select all

[Unit]
...
Wants=dev-dvb-adapter0-frontend0.device dev-dvb-adapter1-frontend0.device
After=dev-dvb-adapter0-frontend0.device dev-dvb-adapter1-frontend0.device
And from /etc/udev/rules.d/mythtv.conf

Code: Select all

SUBSYSTEM=="dvb", \
    KERNEL=="dvb?.frontend0", \
    ATTRS{subsystem_vendor}=="0x0070", \
    ATTRS{subsystem_device}=="0x8851", \
    SYMLINK+="dvb/hvr-2200-$minor", \
    TAG+="systemd"
See: https://www.mythtv.org/wiki/Systemd_myt ... nitialized

I've also never tried it with USB devices.
Post Reply