"Attempting to connect to Database" error...

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
Bernmeister
Newcomer
Posts: 9
Joined: Sat Sep 19, 2015 2:33 am
Australia

"Attempting to connect to Database" error...

Post by Bernmeister »

I have installed Xubuntu 16.04.03 LTS and then MythTV 0.29 from the “Mythbuntu Team” team PPA. Single backend/frontend on the one box. I am replacing an old machine that ran Mythbuntu 12.04 and things are different...

When I run the frontend I get a screen with a progress bar and the message "Attempting to connect to Database" which eventually changes to "Unable to connect to Database". If I click on Setup from that screen, I get a popup saying "Cannot login to database". hostname is currently set to localhost and I did checked "Enable database server wakeup".

I found viewtopic.php?t=1935#p9389 and followed the instructions and got no errors (as each command was entered). On reboot however, the same problem of "Attempting to connect to Database" occurs when I manually run the frontend.

Can anyone suggest what I should try next in terms of diagnosing and then fixing please? Also, should I add the frontend to the Session and Startup panel of Xubuntu or is there another (official/proper) way to do this?


Thanks in advance,

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

Re: "Attempting to connect to Database" error...

Post by bill6502 »

Hi,

I'm assuming that the backend is running, and therefore mysql is too.

Try this: grep 'Using configuration directory' mythbackend.log (or wherever
your logs are stored. That will tell you where the config.xml file is for the
backend. Then do the same grep for the frontend log and see if it matches.

See this for help: https://www.mythtv.org/wiki/Config.xml#Troubleshooting
if the config.xml files don't match.

Can't speak to the Xubuntu question.
User avatar
pgbennett
Developer
Posts: 503
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: "Attempting to connect to Database" error...

Post by pgbennett »

I am using the session and startup of Xubuntu to start a shell script that starts the frontend and also logs off afterward. See https://github.com/bennettpeter/mythscr ... ntend29.sh . Note my script does other things as well. Before MythTV I have a menu that selects MythTV or a browser with a streaming service URL.
Bernmeister
Newcomer
Posts: 9
Joined: Sat Sep 19, 2015 2:33 am
Australia

Re: "Attempting to connect to Database" error...

Post by Bernmeister »

bill6502 wrote:
Tue Jan 16, 2018 3:31 pm
Hi,

I'm assuming that the backend is running, and therefore mysql is too.

Try this: grep 'Using configuration directory' mythbackend.log (or wherever
your logs are stored. That will tell you where the config.xml file is for the
backend. Then do the same grep for the frontend log and see if it matches.

See this for help: https://www.mythtv.org/wiki/Config.xml#Troubleshooting
if the config.xml files don't match.

Can't speak to the Xubuntu question.
I don't think the backend is in fact running. I'm not sure if it starts automatically and then fails but when I try to start manually I get the following...

sudo systemctl start mythtv-backend
activating
sudo systemctl is-active mythtv-backend.service
active
...
sudo systemctl is-active mythtv-backend.service
inactive

I have changed the value for Password in ~/.mythtv/config.xml to match the same value in /home/mythtv/.mythtv/config.xml (which also matches that in /etc/mythtv/config.xml) and tried to start the mythtv-backend.service with same result; seems to start but then eventually is inactive.

Looking at /var/log/mythtv/mythbackend.log there doesn't seem to be any obvious error message. Looking at /var/log/syslog I saw these failure messages repeating:

systemd[1]: Started MythTV Backend.
systemd[1]: mythtv-backend.service: Main process exited, code=exited, status=133/n/a
systemd[1]: mythtv-backend.service: Unit entered failed state.
systemd[1]: mythtv-backend.service: Failed with result 'exit-code'.
[1]: mythtv-backend.service: Service hold-off time over, scheduling restart.
systemd[1]: Stopped MythTV Backend.

Anything else I can try or check to make sure is running or other logs to check for messages?
Bernmeister
Newcomer
Posts: 9
Joined: Sat Sep 19, 2015 2:33 am
Australia

Re: "Attempting to connect to Database" error...

Post by Bernmeister »

pgbennett wrote:
Tue Jan 16, 2018 4:55 pm
I am using the session and startup of Xubuntu to start a shell script that starts the frontend and also logs off afterward. See https://github.com/bennettpeter/mythscr ... ntend29.sh . Note my script does other things as well. Before MythTV I have a menu that selects MythTV or a browser with a streaming service URL.
Thanks for the script; as I posted below I don't believe that the mythtv backend is running; the front end will run if I manually kick it off but that's as far it'll go if the backend isn't up. I'll keep the script in mind if I get to that point!
User avatar
bill6502
Developer
Posts: 2307
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: "Attempting to connect to Database" error...

Post by bill6502 »

To see if the backend will start automatically at boot (with systemd)
type: systemctl status mythtv-backend and look at the Loaded: line.
"enabled:" will appear there. If not do sudo systemctl enable mythtv-backend

Unfortunately, /var/log/mythtv/mythbackend.log is typically the best choice
to see why the backend isn't starting (you've already checked the journal.)
Put the full, and most recent startup in a pastebin and put a link to it here. Others
may be able to spot something. The log starts with a like similar to this:

Code: Select all

mythbackend version: master [v30-Pre-365-ga5a83435c4-dirty]
and the newest will be near the bottom of the file.

Error code 133, can mean: "Database needs upgrade", which should appear
in the log if that's the case.
Bernmeister
Newcomer
Posts: 9
Joined: Sat Sep 19, 2015 2:33 am
Australia

Re: "Attempting to connect to Database" error...

Post by Bernmeister »

Did a reboot and running 'systemctl status mythtv-backend' yields both loaded/enabled and active/running.

I deleted the mythbackend.log and rebooted and pasted the content at https://pastebin.com/zbiRv4Ax
User avatar
bill6502
Developer
Posts: 2307
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: "Attempting to connect to Database" error...

Post by bill6502 »

Code: Select all

Start up failure. host 192.168.0.5, status dbAwakeFail
Just confirms that the backend can't talk to the DB, so the frontend is guaranteed
to fail. Since you already did the tests in the link in your original post, this must be
working:

Code: Select all

mysql -u mythtv -p mythconverg
At the password prompt, use the value from config.xml, which should be the same
in, may as well confirm the DB hosts are the same while you're at it:

Code: Select all

egrep "<Host>|<Password>" {~,~mythtv}/.mythtv/config.xml
If not (meaning I don't understand the earlier comment) what does the output say?
Bernmeister
Newcomer
Posts: 9
Joined: Sat Sep 19, 2015 2:33 am
Australia

Re: "Attempting to connect to Database" error...

Post by Bernmeister »

Tried to connect to mysql and it worked (got the message "Welcome to the MariaDB monitor...").

Result from 'egrep "<Host>|<Password>" {~,~mythtv}/.mythtv/config.xml' yields matching values for host and password.

I have read and tried a few of the things at the page https://www.mythtv.org/wiki/Systemd_myt ... figuration as I suspect one or more services are not enabled or not starting, or starting in the wrong order. I wonder if I have now broken my system by trying different things (each time I try something I do my best to back out, but kruft does occur). I might instead do a clean install on a VirtalBox VM (at least then I can make a backup/snapshot and rollback to a known state).

<rant>
I am stunned at how difficult it is to setup MythTV (or rather the Ubuntu MythTV packages(s) on Xubuntu). Mythbuntu is/was fantastic but sadly no more. I suppose I could/should just install Mythbuntu 16.04 now rather than Xubuntu 16.04 with MythTV on top, but I wanted to move in the direction suggested by the Mythbuntu developers. I appreciate the hard work of the MythTV developers (and of course Mythbuntu and those that maintain the Ubuntu MythTV packages); I am not having a go at any of your work; just wish it was a little easier to get a basic install up and running.

If anyone has other suggestions to try, I'd be most grateful; and a big thank you to those whom have helped thus far. I might also try my luck at the Ubuntu forums (they have a multimedia section intended for MythTV) or perhaps AskUbuntu.

If by some miracle I get MythTV working on Xubuntu 16.04, I'll post some sort of walkthrough; this really should be so difficult and a list of things to test might help someone in the future. MythTV is fantastic software and I have been using it for 10 year now; very sad (and frustrating) to get to a point that I cannot (do a fresh) install.
</rant>
User avatar
bill6502
Developer
Posts: 2307
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: "Attempting to connect to Database" error...

Post by bill6502 »

Sorry to hear (the rant.)

I didn't mention the -h switch to mysql. E.g. -h 192.168.0.5. Test that.
Usually, the backend is run with <Host> = localhost so that a socket
is used rather than a TCP connection. That would be done is config.xml.

Since you're [now] using mariadb, the file that allows connections from
non localhost boxen has moved. It was: /etc/mysql/conf.d/mythtv.cnf and
is now: /etc/mysql/mariadb.conf.d/mythtv.cnf, You're interested in the
bind-address= line. I set mine equal to :: to allow both IPv4 and 6.

Also, mythbuntu may be setting MYTHCONFDIR in the service. Type:
systemctl cat mythtv-backend to see. While the mythtv and user config
files in mythbuntu normally point to /etc/mythtv (or something like that)
the links have been known to get broken. The grep I used above wouldn't
look in /etc/mythtv if the links aren't there.
User avatar
dizygotheca
Developer
Posts: 267
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: "Attempting to connect to Database" error...

Post by dizygotheca »

There could be 2 issues lurking here.
1. You're using 192.168.0.5 for localhost and usually reboot. Maybe the backend is starting up before the network? It's an irritation specific to Ubuntu 16.04+. Try changing your master backend address to "localhost" or 127.0.0.0.
2. When you restarted the backend (no logs) it may have baulked at an db upgrade. IIRC sometimes the backend can't perform an upgrade; it needs mythtv-setup to do it and 12.04 is pretty old. Have you tried running it ?

What Myth version ? You may need to install time zone tables https://www.mythtv.org/wiki/MySQL_Time_Zone_Tables
Bernmeister
Newcomer
Posts: 9
Joined: Sat Sep 19, 2015 2:33 am
Australia

Re: "Attempting to connect to Database" error...

Post by Bernmeister »

Apologies for not getting back sooner; life gets in the way when you make other plans.

Thanks to all for tremendous help offered. Unfortunately I could not make it work and will give up.

I have been documenting the installation thus far and had hoped to release it as a walk-through to help people. However, what I have so far is laughable. I will give Mythbuntu 16.04 a try; at least the OS is supported for a couple of more years and hopefully by then the issues with the MythTV package on Ubuntu has been sorted out.

Thanks again to all and sundry.
Post Reply