Ubuntu 14.04.1 Configuration of mythtv backend

For discussion of topics specific to MythTV on linux
Post Reply
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

Hi,

I need help to install and configure mythtv in ubuntu 14.04.
I have some time ago install and configure it on ubuntu 13 and it's work, so i have done the same steps and configuration but now i have some problem to figure it out.
Maybe i have lost some step or something is different.

I have a ubuntu installed and have root user and mythtv user.
With mythtv user i start mythtbackend but i have some error:

Code: Select all

2014-10-21 01:23:47.645480 C  mythbackend version: fixes/0.27 [v0.27-1-g5b917e8] www.mythtv.org
2014-10-21 01:23:47.645555 C  Qt version: compile: 4.8.4, runtime: 4.8.4
2014-10-21 01:23:47.645584 N  Enabled verbose msgs:  general
2014-10-21 01:23:47.645623 N  Setting Log Level to LOG_INFO
2014-10-21 01:23:47.657608 I  Added logging to the console
2014-10-21 01:23:47.661747 I  Setup Interruzione handler
2014-10-21 01:23:47.661854 I  Setup Terminato handler
2014-10-21 01:23:47.661956 I  Setup Errore di segmentazione handler
2014-10-21 01:23:47.662045 I  Setup Annullato handler
2014-10-21 01:23:47.662145 I  Setup Errore di bus handler
2014-10-21 01:23:47.662220 I  Setup Eccezione in virgola mobile handler
2014-10-21 01:23:47.662309 I  Setup Istruzione non consentita handler
2014-10-21 01:23:47.662407 I  Setup Segnale real-time 0 handler
2014-10-21 01:23:47.662637 N  Using runtime prefix = /usr
2014-10-21 01:23:47.662735 N  Using configuration directory = /home/mythtv/.mythtv
2014-10-21 01:23:47.663149 I  Assumed character encoding: it_IT.UTF-8
2014-10-21 01:23:47.665208 N  Empty LocalHostName.
2014-10-21 01:23:47.665270 I  Using localhost value of Multimedia-Server
2014-10-21 01:23:47.665472 I  Testing network connectivity to '192.168.0.4'
2014-10-21 01:23:47.666649 I  Starting process manager
2014-10-21 01:23:47.670734 I  Starting process signal handler
2014-10-21 01:23:47.672223 I  Starting IO manager (read)
2014-10-21 01:23:47.672305 I  Starting IO manager (write)
2014-10-21 01:23:47.769262 I  New Client:  (#1)
 
Cannot login to database
 
Would you like to configure the database connection now? [no]  2014-10-21 01:23:47.808865 E  Unable to connect to database!
2014-10-21 01:23:47.808932 E  Driver error was [1/2003]:
QMYSQL: Unable to connect
Database error was:
Can't connect to MySQL server on '192.168.0.4' (111)
I have set my database in /mythtv/.mythtv/config.xml


Some help?
Wroxter
Newcomer
Posts: 8
Joined: Tue Apr 15, 2014 8:06 pm
Canada

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by Wroxter »

You do not mention if this is a clean install including a new database or if you are using your old database.

There are several different locations (3 to 6+) for the location of the configuration files and more configuration is needed than just that file. Check each one to be sure the right passwords are in all of them. (Sometimes the installation scripts have generated a new password for me on an upgrade.) Check too, the pinging option. If that is set (probably the default) and your system does not support pinging, you will not be able to connect to the database.

https://www.mythtv.org/wiki/MythTV-HOWTO

A short checklist:

Try as root or sudo to reconfigure mythtv-common and mythtv-database.

On my system:
dpkg-reconfigure mythtv-common
dpkg-reconfigure mythtv-database

If that does not work mysql and/or the database (either new or the the old one) might need additional configuration.

-You have created the users with the right permissions in mysql for the database (including both root and mythtv users on both the ip address and the local host/local host address)?

-You do have the right owners/groups/permissions on the directories?
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

So some information:
I have done a fresh install to retry to config all and make it work.

Now i try to take a look to mythtv page, i have already see a lot of documentation but already i can't make it work.

I try the command and:
If i run dpkg-reconfig mythtv-common i have only to confirm what appear:
- Database mythconverg
- Username mythtv
- Password mythtv
- Host Mysql Server 192.168.0.4

With dpkg-reconfig mythtv-database
- Other computer run mythtv: YES

For other question, so i have create user mythtv with password.
I have check that in mysql there is mythtv user and i can access with it.
Maybe i have to check permission on database from user mythtv and from ip address, i can't do that?

For directory right witch one owners/groups i have to own? How check it?
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

I would try to grant access in mysql to mysql@192.168.0.4 i have some error:
mysql -u mythtv -p
mythtv (password)

then
GRANT ALL PRIVILEGES ON *.* TO 'mythtv'@'192.168.0.%' IDENTIFIED BY 'mythtv' WITH GRANT OPTION;

i obtain
ERROR 1045 (28000): Access denied for user 'mythtv'@'localhost' (using password: YES)

Why coul have this error if i just access on mysql with same user and password?
Wroxter
Newcomer
Posts: 8
Joined: Tue Apr 15, 2014 8:06 pm
Canada

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by Wroxter »

Database backups are good... do one before you start adjusting the database...any non-existant warranty is voided and you may need to restore it from the original.

Permissions/ownerships/groups - are for the directories that you assigned to the categories - recordings,videos etc. with mythtv-setup. This is always a good thing to double check on a new install and does mess up the front end / back end interaction through the database. That does not seem to be the problem here.
mysql -u mythtv -p
mythtv (password)

then
GRANT ALL PRIVILEGES ON *.* TO 'mythtv'@'192.168.0.%' IDENTIFIED BY 'mythtv' WITH GRANT OPTION;
may need to be

Code: Select all

GRANT ALL PRIVILEGES ON *.* TO 'mythtv'@'192.168.0.%' IDENTIFIED BY 'your_mythtv_password' WITH GRANT OPTION;
Alternately
i obtain
ERROR 1045 (28000): Access denied for user 'mythtv'@'localhost' (using password: YES)
You may not have created a 'mythtv' user at 'localhost' .

Easiest way to check is to login to mysql as root

Code: Select all

mysql> SELECT User, Host, Password FROM mysql.user;
Do you have mythtv users and are the values the same at
'localhost'
'127.0.0.1'
'ip address' of your backend (I have a combined BE/FE and I seemed to need the specific ip address for that FE despite having the address in the range for remote FEs, and those do work without a specific address.)
'ip addresses" of any remote frontend

and
2014-10-21 01:23:47.665270 I Using localhost value of Multimedia-Server
suggests you need a user there too if you do not already have one.

You may as well check at the same time that you have root users at the same addresses including your host name. [Why root at localhost is not equivalent to root at the local ipaddress or at the host name is not in my knowledge base(security?), but I seemed to have a problem with that recently. I have seen a posting suggesting that a specific IPv6 address might also be needed. My setup which had similar problems to yours relating to the database at starting at upgrades to 27.0xxxx to 27.3 (now 27.4+) which finally upgraded successfully from 27.3 a couple of days ago and is currently working without that specific IPv6 address.]

W
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

Ok, start step by step.

Code: Select all

mysql> SELECT User, Host, Password FROM mysql.user;
result:

Code: Select all

| root             | localhost         | 
| root             | multimedia-server | 
| root             | 127.0.0.1         |
| root             | ::1               |
| debian-sys-maint | localhost         |  |
| mythtv           | localhost         |  |
| mythtv           | %                 | 
i have to add mythtv user some where else?
Wroxter
Newcomer
Posts: 8
Joined: Tue Apr 15, 2014 8:06 pm
Canada

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by Wroxter »

If you have not yet fixed this

From your Mysql printout one sees this does not seem to have been done.
GRANT ALL PRIVILEGES ON *.* TO 'mythtv'@'192.168.0.%' IDENTIFIED BY 'mythtv' WITH GRANT OPTION;
Try that one again, but perhaps your installation woud be more secure as (and I have not yet needed that powerful a mythtv user):

GRANT ALL PRIVILEGES ON mythconverg.* TO 'mythtv'@'192.168.0.%' IDENTIFIED BY 'your_mythtv_password' ;
as well as
GRANT ALL PRIVILEGES ON mythconverg.* TO 'mythtv'@'127.0.0.1 ' IDENTIFIED BY 'your_mythtv_password' ;
and
GRANT ALL PRIVILEGES ON mythconverg.* TO 'mythtv'@'192.168.0.4 ' IDENTIFIED BY 'your_mythtv_password' ;

I also had to create a root account at the Host address of the database so

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.0.4' IDENTIFIED BY 'your_root_password' WITH GRANT OPTION;

If you read elsewhere on this forum you will also see a suggestion that another Ubuntu user needed a IPv6 address too. I am not running Ubuntu and I do not need that.
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

Thanks for help!
I have to restore my database and apply some privileges for make it work but now it's ok.

I follow the previous command in this topic and have found why it could'n access in database.

Now i need other help, this time i want to wakeup automatically the pc for manteinence.
I already can wake up for recorders but i can't understand how call the same command that mythtv calls when a new recorder was selected.
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by bill6502 »

Hi,
This may get you started if you just want to start your backend at random times for maintenance:
http://en.wikipedia.org/wiki/Wake-on-LAN
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

Yes i start backend when i need already with wol but i need other un-manage system to start it in determinated period like 1 a week or mouth.
i want to do some cron stuff and i need to start it.

How backend save time to wake up and put it in database?
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by bill6502 »

inconsapevole wrote: How backend save time to wake up and put it in database?
I use a script and the time is written as follows:

Code: Select all

ALARM_FILE="/sys/class/rtc/rtc0/wakealarm"
NEW_TIME=${1}
echo 0 > ${ALARM_FILE}
echo ${NEW_TIME} > ${ALARM_FILE}
The 1st echo is recommended to 'clear' the alarm. Note that it's
possible you may have to adjust for localtime versus UTC (my
system uses UTC, so I don't adjust.)

To do what you want, your script would need to know if there's
any non MythTV events that are before the MythTV generated
next recording (or any other MythTV events.) It could then see
which comes 1st and store that time.

Another solution (much easier) would be using anacron. Then
when the backend wakes up, if cron events had passed, they
would be run. But not at the desired time, because the host was
off-line.
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

Yes i would do exact that, would see any mythtv wake up events and then i can do script for order non mythtv event cronologically.

I see that mythshutdown -w set a wake up timer (in database and then in wakealarm) and if u set 1 or more recorder it's will wake up the computer if it's off.
So the different wake up time are saved in database and when needed at shutdown the first occorency is set in wakeup files.

So how can i use this metode for set a personal mythtv wake up or where i see other time wake up for create a script that order and use the right time?
User avatar
bill6502
Developer
Posts: 2323
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by bill6502 »

Using mythtv-setup, find the field: "Command to set wakeup time" and put
your script there. If your next maintenance wakeup is before the next
recording, you'd use it.

The problem is that when your maintenance task ends, it must
also set the proper next wakeup time, so how does it get that
from the database? Here's a Python script that should get
you started.

Code: Select all

#!/usr/bin/env python

#
# Get the next scheduled wakeup time.
#

import sys
from MythTV import MythDB

try:
    db = MythDB()
except:
    print 'Unable to connect to the backend'
    sys.exit(1)

nextScheduled = db.settings.NULL.MythShutdownNextScheduled

if nextScheduled:
    print nextScheduled
else:
    print 'Unable to find: MythShutdownNextScheduled'
    sys.exit(2)
inconsapevole
Junior
Posts: 20
Joined: Sun Jul 06, 2014 11:05 pm
Italy

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by inconsapevole »

Yeah i have already set and configure the "set wake up command" and i have that if i record more program they'll set every time a wake up (when computer going to shutdown i think).
Infact the problem is to add timer unamnaged by mythtv.

I will try to set a script more complete like one mentioned, but i don't understand how mythtv manage multiple timer, where it are saved and how and when it set to bios setting.
I need to know that for try to add my time to the other saved for better integration.
How first step i try to make a script and see if it work well.

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

Re: Ubuntu 14.04.1 Configuration of mythtv backend

Post by bill6502 »

You left IRC before I could mention the following useful commands.

To change the verbose level of the backend, without restarting it:

Code: Select all

mythbackend --setverbose system,idle
The system flag will let you see external commands that are executed, like the script you're planning on writing.

To restore 'normal' logging:

Code: Select all

mythbackend --setverbose general
To turn debugging on/off:

Code: Select all

mythbackend --setloglevel debug
mythbackend --setloglevel info
The backend log is likely to help you fix problems when creating your new set wakeup time script. It's also useful to understand how the backend shuts down when idle.

Finally, Try this command:

Code: Select all

mythshutdown --check
to see if the backend can be shutdown.
Post Reply