[mythtvnz] [Mythtv] How to view the backend logs

Stephen Worthington stephen_agent at jsw.gen.nz
Sat May 26 12:08:10 BST 2018


On Sat, 26 May 2018 18:36:16 +1200, you wrote:

>My mythtv system is having issues. If I try to use it it will play for
>about 30 seconds to a minute then says:
>"Could not connect to master backend MythContext Could not connect to
>the master backend server. Is it running? is the IP Address set for it
>in myth-setup correct?"
>
>Obviously the IP Address is correct or how else does it play 30-60
>seconds of live TV before breaking.
>
>I seem to be able to do this twice before it says all tuners are
>currently busy, and I also can't see any of my recordings.
>
>I'm hoping that if I can see the backend logs it might give me a clue
>as to what is going on. However I can't seem to find out how to view
>them.
>
>A little background:
>This system has been working for years, however around the time of the
>royal wedding we noticed that new recording showed red spinners on
>them and they never stopped (they still have them) Usually they have
>green spinners while recording and then red for a short period after.
>Then this morning my wife noticed edge tv wasn't working (a blank
>screen if you tried to watch it) so she closed mythtv did the ubuntu
>updates (hadn't been done for ages) and restarted the machine. That
>didn't fix the problem so she came to ask me for help. I ran the
>backend setup and tried to do a rescan on the channels but the scan
>didn't work. So I googled it and found out this can happen if the
>backend is still running (the back end setup program should stop it
>but obviously had failed to do so. I stopped the backend from the
>commandline which took ages, and then ran the channel scan which
>worked fine. Now the edge channel was on a different number, it did
>work but only for 30 seconds, then showed the message as per above. So
>I tried other channels and they all have the same problem.
>
>My guess is that the backend is crashing but I need to look at the
>logs to know why, and that does not seem to be documented.
>https://www.mythtv.org/wiki/Logging seems very complicated and doesn't
>actually tell you how to see the logs assuming a default config.

On Ubuntu, the log files are in /var/log/mythtv.  The backend log is
"mythbackend.log".  You may or may not have enough information in the
log file to work out what the problem is.  What version of Ubuntu and
MythTV are you using?  In recent versions, you can add extra logging
options to the mythbackend command line by creating a file like this:

root at mypvr:/etc/mythtv# cat additional.args
#ADDITIONAL_ARGS=-v all --loglevel debug
ADDITIONAL_ARGS=-v record,dvbcam

You create a file "additional.args" in the /etc/mythtv directory, and
put in a line which is a Bash variable assignment statement assigning
your extra command line arguments to the variable "ADDITIONAL_ARGS".
The first line in my file (commented out with a # at the start) would
turn on all possible logging.  That is enough to slow down the
operation of mythbackend unless you have a fast PC and the log file is
going to a fast SSD.  But it will make sure that every possible
message is logged.  The second line is the one I run with normally.
The option you probably want is what I use there: "-v record", which
tells mythbackend to log extra messages about how it makes recordings,
including its interaction with the tuners.

When you change the additional.args file, you need to restart
mythbackend to get it to see the new command line arguments:

systemctl restart mythtv-backend

There is also an ability to change the logging at run time.  To do
that, you run a second copy of mythbackend with the special command
line options that change the logging.  The second copy of mythbackend
finds the first copy and sends the new commands to it, then shuts
down.  There are two options you use for this:

--setverbose
--setloglevel

The --setverbose option allows you change the options set for verbose
output, so you would do:

mythbackend --setverbose record

to do the same as the -v record option in the additional.args file. To
turn off the record option, you would do:

mythbackend --setverbose norecord

To change the overall log level, you use:

mythbackend --setloglevel debug

which would set the logging level to "debug".  To reduce the logging
again, you would do:

mythbackend --setloglevel info

which turns off the debug level messages, setting the logging level to
"info".

These commands give you the mythbackend command line help:

mythbackend --help
mythbackend -v help

Warning: If you mistype the mythbackend command and it does not have a
valid --setloglevel or --setverbose option, you will get a second copy
of mythbackend trying to run alongside the normal one.  That is not
good.  So if that happens, do this:

ps -ef | grep mythbackend

to see which is the wrong one, and then kill the wrong one:

kill <PID of wrong mythbackend>

and if that does not work within a few seconds:

kill -9 <PID of wrong mythbackend>

You may need to run some of these commands as root or using sudo
("systemctl" and "kill" will need that).

If you have a log that shows the problems, you can post a copy on
http://pastebin.com for us to look at.

What sort of setup do you have?  Is it a combined backend/frontend
box?  Is it set up to allow external frontends, or not?  What sort of
tuners are you using?



More information about the mythtvnz mailing list