[Solved] Startup application not working 15.10

For discussion of topics specific to MythTV on linux
x_driver
Junior
Posts: 28
Joined: Tue Nov 24, 2015 9:15 pm
United States of America

Re: Startup application not working 15.10

Post by x_driver »

Bill,

I just had my Eureka moment, need just a bit of guidance to get everything running properly.

When I did my initial install I chose to "not" become a part of the mythtv group. For whatever reason I thought it was a mailing list and didn't realize it had to do with permissions, etc. Yeah, stupid me.

Anyway, I formatted my system and did a clean install (don't worry, I'm a pro at that too...) and joined the mythgroup, went through all the steps, etc. I enabled the mythtv-backend service. When I go to the frontend it still says "all tuners busy."

So I think it brings me to the simple question: when I install mythtv and it asks for a username and password, should I put in mythtv or my actual username? I know it boils down to not having the correct permissions/ownership/group settings when accessing my tuner card.

Thanks again.
User avatar
bill6502
Developer
Posts: 2436
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Startup application not working 15.10

Post by bill6502 »

x_driver wrote:When I go to the frontend it still says "all tuners busy."
I saw your private message too.

Two solutions, elegant and kludgy. See this section: Delay starting the backend until tuners have initialized
here: https://www.mythtv.org/wiki/Systemd_myt ... figuration . Note that if you elect to change
any systemd file, then the new copy should be placed in /etc/systemd/system/ and will override the standard
one. If you don't, then if a new version comes out, your changes will be lost (the standard place is:
/lib/systemd/system/...)

The 2nd solution would be to simply add a delay before starting the backend e.g.
ExecStart=sleep5;/usr/bin/mythbackend --syslog local7 --user mythtv
or another version would be to use:
ExecStartPre=sleep 5 before the ExecStart line.
So I think it brings me to the simple question: when I install mythtv and it asks for a username and password, should I put in mythtv or my actual username? I know it boils down to not having the correct permissions/ownership/group settings when accessing my tuner card.
Really a Mythbuntu question, but I believe it's asking for the username
and password for yourself. The mythtv user will be built for you automatically.
They usually choose a password for you and it's a random one, like a$tO-qyt.
x_driver
Junior
Posts: 28
Joined: Tue Nov 24, 2015 9:15 pm
United States of America

Re: Startup application not working 15.10

Post by x_driver »

Bill,

Okay, so for the elegant solution I would need to do a few things as I understand it.

First, create a udev rule:
/etc/udev/rules.d/99-mythbackend.rules
#
# Create systemd device units for capture devices
#
SUBSYSTEM=="video4linux", TAG+="systemd"
SUBSYSTEM=="dvb", TAG+="systemd"
SUBSYSTEM=="firewire", TAG+="systemd"
Since I am only waiting on dvb devices do I need to include the other subsystems, i.e. video4linux and firewire, that Richard Shaw used in his explanation? And as far as the rule goes I'm guessing I should name mine /etc/udev/rules.d/99-mythtv-backend.rules? Not quite sure what the 99 is for?

Second, once that is done modify my /lib/systemd/system/mythtv-backend.service file and then save it in /etc/systemd/system/mythtv-backend.service by doing something like:
[Unit]
Description=MythTV backend service
Wants=dev-dvb-adapter0-frontend0.device
Wants=dev-dvb-adapter1-frontend0.device
After=dev-dvb-adapter0-frontend0.device
After=dev-dvb-adapter1-frontend0.device
Am I in the ballpark? Thanks.
User avatar
bill6502
Developer
Posts: 2436
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Startup application not working 15.10

Post by bill6502 »

Full disclosure, my backend running 15.10 has no real tuners. So I
haven't tested the above yet. But you're on the right track. Only the
SUBSYSTEM=="dvb", TAG+="systemd" is required for udev as you
expected.

The leading 99 makes the rule execute after all other rules in /lib/udev/rules.d.
But naming it just mythbackend.rules (or any other descriptive name starting
with a letter would do the same. Your choice. If there are other existing rules
that you want to use before this one, you could adjust the name with numbers
or letters that are after the others.

The additions to the .service file look fine to me. Remember the systemd tools
mentioned earlier: e.g. systemctl enable mythtv-backend, systemctl daemon-reload,
systemctl cat mythtv-backend.
x_driver
Junior
Posts: 28
Joined: Tue Nov 24, 2015 9:15 pm
United States of America

Re: Startup application not working 15.10

Post by x_driver »

Got it!

Placed in /etc/udev/rules.d

Code: Select all

SUBSYSTEM=="dvb", TAG+="systemd"
Placed in /etc/systemd/system/mythtv-backend.service

Code: Select all

[Unit]
Description=MythTV Backend
Wants=mysql.service dev-dvb-adapter0-frontend0.device dev-dvb-adapter1-frontend0.device
After=mysql.service dev-dvb-adapter0-frontend0.device dev-dvb-adapter1-frontend0.device
When I give the computer a fresh start I have to wait about 10 seconds for the drivers to load, then mythbackend automatically starts and I can tune channels. No wonder the tuners were always listed as busy, it literally takes about 10 seconds.

Anyway, appreciate all the help. Thx Bill.
Last edited by Steve Goodey on Tue Dec 19, 2017 10:51 am, edited 1 time in total.
Reason: Corrected adatper0 to adapter0 in Wants line.
User avatar
bill6502
Developer
Posts: 2436
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Startup application not working 15.10

Post by bill6502 »

Thanks for posting the above. If you're sure that this is solved, please
edit the Subject: line and prepend [Solved] to it (to make it easier for
the next person tripping over this one.)
Post Reply