mythtv not finding tuners when autostarting

For discussion of topics specific to MythTV on linux
glubbish
Newcomer
Posts: 14
Joined: Thu Sep 18, 2014 6:24 am
Australia

mythtv not finding tuners when autostarting

Post by glubbish »

Hi,

Running latest mythtv 0.28 with ubuntu 16.04.1 hdhomerun tuners

When the backend starts (after a reboot etc) we get:

Jan 28 16:41:10 MaxxM mythbackend: mythbackend[1253]: E CoreContext recorders/hdhrstreamhandler.cpp:339 (Connect) HDHRSH(11109E76-0): Unable to connect to device
Jan 28 16:41:10 MaxxM mythbackend: mythbackend[1253]: E CoreContext dtvmultiplex.cpp:379 (ParseTuningParams) DTVMux: ParseTuningParams -- Unknown tuner type = 0xffffffff80000000
Jan 28 16:41:10 MaxxM mythbackend: mythbackend[1253]: E CoreContext recorders/dtvchannel.cpp:299 (SetChannelByString) DTVChan[1](11109E76-0): SetChannelByString(1): Failed to initialize multiplex options
Jan 28 16:41:11 MaxxM mythbackend: mythbackend[1253]: E CoreContext recorders/hdhrstreamhandler.cpp:382 (TunerGet) HDHRSH(11109E76-0): Get request failed#012#011#011#011eno: Resource temporarily unavailable (11)
Jan 28 16:41:11 MaxxM mythbackend: mythbackend[1253]: E CoreContext recorders/hdhrstreamhandler.cpp:421 (TunerSet) HDHRSH(11109E76-0): Set request failed#012#011#011#011eno: Resource temporarily unavailable (11)
Jan 28 16:41:11 MaxxM mythbackend: mythbackend[1253]: E CoreContext dtvmultiplex.cpp:379 (ParseTuningParams) DTVMux: ParseTuningParams -- Unknown tuner type = 0xffffffff80000000
Jan 28 16:41:11 MaxxM mythbackend: mythbackend[1253]: E CoreContext recorders/dtvchannel.cpp:299 (SetChannelByString) DTVChan[2](11109E76-0): SetChannelByString(1): Failed to initialize multiplex options
Jan 28 16:41:11 MaxxM mythbackend: mythbackend[1253]: E CoreContext recorders/hdhrstreamhandler.cpp:382 (TunerGet) HDHRSH(11109E76-0): Get request failed#012#011#011#011eno: Resource temporarily unavailable (11)

This results in livetv showing channel unavailable

If we start it from a terminal (not logged on as mythtv, but as the main user, it works fine.

Can anyone help by letting us know what the difference in the startup is and what can be changed to fix this issue?

Thanks
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: mythtv not finding tuners when autostarting

Post by MikeB2013 »

Does Live TV work if you restart mythtv-backend service from a terminal ?
(sudo systemctl restart mythtv-backend.service )

If it does work then there is a race condition at boot see
viewtopic.php?f=29&t=1916#p9340

Mike
glubbish
Newcomer
Posts: 14
Joined: Thu Sep 18, 2014 6:24 am
Australia

Re: mythtv not finding tuners when autostarting

Post by glubbish »

Thanks Mike.
That was it exactly.
Live tv is now working as expected.
User avatar
paulh
Developer
Posts: 909
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: mythtv not finding tuners when autostarting

Post by paulh »

It seems to be a common problem with all distros using Systemd with the backend starting before all the services it requires have started like the network being up.

It's really annoying the f#%* out of me :evil: There's a lot of, outdated?, advice out there that simply doesn't work reliably at least for me.

If anyone does find a solution that works for them then please share it ;)
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: mythtv not finding tuners when autostarting

Post by MikeB2013 »

@paulh

Here is the solution I used (it is similar to that in the mythtv thread but is slightly easier to setup, no creation of directory and file, it uses systemd built-in functionality). This change should continue to work when mythtv is updated. I have a number of systems running mythbuntu 16.04, some with fixed IP address (using static IP in /etc/network/interfaces), others using IP address from my Router. Some using network tuners, other using PCI-e tuner cards, after the changes below I have had no problems.

In a terminal on the machine running mythtv backend:

sudo systemctl enable NetworkManager-wait-online.service
sudo systemctl edit mythtv-backend.service

Then paste the following 2 lines
[Unit]
After=NetworkManager-wait-online.service

Then exit from the edit screen (it uses nano by default, so Ctrl+x, then y, then Return key)

Now reboot the system (sudo reboot)

Mike
cliffgi
Newcomer
Posts: 2
Joined: Fri Jan 23, 2015 2:46 am
United States of America

Re: mythtv not finding tuners when autostarting

Post by cliffgi »

Mike. Thanks for this elegant fix. I banged my head for the better part of a day until I came across this. This kind of stuff should be prominently posted on the Official MythTV Wiki install how-to. I guess that's the price you pay for "free". If the docs were better, I have no doubt that Mythtv would be huge in the cordcutting world. As it is, it's just a pain between the back pockets.

Thanks again to all above.
cliffgi
Glb1945
Junior
Posts: 28
Joined: Sat Jul 08, 2017 10:39 pm
United States of America

Re: mythtv not finding tuners when autostarting

Post by Glb1945 »

Mike,
Many thanks for the fix. Will it be included in the next version so that others do not have to search for it?

Jerry
Glb1945
Junior
Posts: 28
Joined: Sat Jul 08, 2017 10:39 pm
United States of America

Re: mythtv not finding tuners when autostarting

Post by Glb1945 »

Mike,

I spoke too soon. The fix seems to have taken down my machine. Have you tried it on Ubuntu 16.04?
I will reload Ubuntu and then add your fix to see if I messed up something.

Jerry
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: mythtv not finding tuners when autostarting

Post by MikeB2013 »

At the time of the original fix, it was tested on Mythbuntu 16.04 LTS, subsequently (following discontinuation of Mythbuntu 16.04) I have used it on Xubuntu 16.04 (suggested replacement for Mythbuntu 16.04) and Lubuntu 16.04.

There is no way that fix will take down your machine, at worst it will not solve the problem and mythbackend will still start too early.

To backout the fix :

Code: Select all

sudo systemctl disable NetworkManager-wait-online.service
sudo rm -r /etc/systemd/system/mythtv-backend.service.d/
sudo reboot
There is a more pragmatic fix which simply delays mythbackend start up for say 20 seconds

sudo systemctl edit mythtv-backend.service

Then paste the following 2 lines
[Service]
ExecStartPre=/bin/sleep 20

Followed by a reboot.
Glb1945
Junior
Posts: 28
Joined: Sat Jul 08, 2017 10:39 pm
United States of America

Re: mythtv not finding tuners when autostarting

Post by Glb1945 »

MikeB,

Your suggestion does not fix the tuner startup problem. I still receive the channel unavailable on both mythfrontend and kodi.

Jerry
Glb1945
Junior
Posts: 28
Joined: Sat Jul 08, 2017 10:39 pm
United States of America

Re: mythtv not finding tuners when autostarting

Post by Glb1945 »

MikeB,

I am running Ubuntu 16.04 LTS with Myth 29 and Kodi Krypton on a Zotac 1327 with a SSD. Your fix does not bring down the machine but does not
help the channel unavailable issue.

Jerry

Jerry
MikeB2013
Senior
Posts: 519
Joined: Mon Jul 25, 2016 4:16 pm
Great Britain

Re: mythtv not finding tuners when autostarting

Post by MikeB2013 »

Glb1945 wrote:
Mon Mar 05, 2018 8:58 pm
MikeB,

I am running Ubuntu 16.04 LTS with Myth 29 and Kodi Krypton on a Zotac 1327 with a SSD. Your fix does not bring down the machine but does not
help the channel unavailable issue.

Jerry

Jerry
There are other reasons for channel unavailable, besides mythbackend starting too early. The most common one I have encountered is the mythtv Tuning and Signal Timeouts for the Capture Card are too low.

Channel Unavailable in Kodi pvr mythtv is often due to the timeout in Advanced tab being too low (defaults to 5 seconds), but changing this if mythfrontend is having problems is not likely to resolve the issue.

Without mythbackend, mythfrontend logs and dmesg output, I would just be guessing.
Glb1945
Junior
Posts: 28
Joined: Sat Jul 08, 2017 10:39 pm
United States of America

Re: mythtv not finding tuners when autostarting

Post by Glb1945 »

Mike,

When I kill mythbackend and restart it the problem always goes away. What is the best other fix you suggest to delay the startup of mythbackend until the tuners are recognized?

Jerry
User avatar
Steve Goodey
Moderator
Posts: 220
Joined: Fri Feb 07, 2014 6:30 pm
Location: Colchester, England
Great Britain

Re: mythtv not finding tuners when autostarting

Post by Steve Goodey »

This is what sorted my problem with tuners not being ready.

https://www.mythtv.org/wiki/Systemd_myt ... figuration
Don't forget the Wiki.
Glb1945
Junior
Posts: 28
Joined: Sat Jul 08, 2017 10:39 pm
United States of America

Re: mythtv not finding tuners when autostarting

Post by Glb1945 »

Steve,

I can't believe that the average user is going to be able to implement the suggestions in your link? I am very familiar with UNIX and the suggestions in the link make make me nervous. I spoke with the creator of NextPVR (he coded the entire program by himself). It is trivial to setup and very robust.
No problems with tuners or channel unavailable error messages and Kodi works flawlessly with NextPVR. Unfortunately NextPVR only works on Windows. Someone needs to fix the problems with Mythtv to make it as robust and as easy to set up as NextPVR? I hope this suggestion is seen as encouraging the Mythtv developers to restructure their code towards this desirable goal. I think it has come a long way towards this goal from when I first started to try it
and with just a bit more work it would reach the goal.

Jerry
Post Reply