Remote frontend can't access backend MySQL

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

Moderator: Forum Moderators

aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus »

Did you try commenting out the bind-address directive? Also just noticed your ipv6 address. It didn't work right with my right ipv6 address either. had to change it in mythtv-setup to ::1 Do you have a firewall set? That's all I can think of at the moment.
Do you mean to comment-out bind-address in my.cnf? I'll give that a try with with "bind-address = 0.0.0.0" in mythtv.cnf.

The ipv6 thing is a bit confusing. I'm not using ipv6 on my LAN. I think I read somewhere that mysql trys ipv6 addresses first then ipv4. Or something. That's what seems to be happening in this case. What I don't understand is why it's apparently trying to connect to localhost even though I specified the IP address of the backend server.

I don't understand your suggestion about changing the ip adddress in mythtv-setup to ::1. My current backend setup specifies a static ipv4 address of 192.168.0.101. Should I change it to ::1 if I'm not using ipv4?

One of the first things I thought of was the firewall. I had this problem when I set up MythTV on Mint 14. The firewall on the backend is currently disabled and it appears that requests are making it to mysql on the backend as evidenced by the fact that it gives the "[Warning] IP address '192.168.0.119' could not be resolved" error in the log.
wesnewell
Senior
Posts: 731
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Remote frontend can't access backend MySQL

Post by wesnewell »

forget the ipv6 thing. That was another problem. Every time you upgrade mythtv, mythtv.cnf gets overwritten and the bind address will be commented out. Just comment out the bind-address in my.cnf and mythtv.cnf and try that. That is supposed to open up all ports to both ipv4 and ipv6 addresses. And make sure you have the same user and password for the remote frontend that you have on the master frontend.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.
aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus »

wesnewell wrote:forget the ipv6 thing. That was another problem. Every time you upgrade mythtv, mythtv.cnf gets overwritten and the bind address will be commented out. Just comment out the bind-address in my.cnf and mythtv.cnf and try that. That is supposed to open up all ports to both ipv4 and ipv6 addresses. And make sure you have the same user and password for the remote frontend that you have on the master frontend.
That makes sense. Tried commenting out the bind-address in my.cnf and mythtv.cnf. Still no go. Yes, I have the user and password on the remote and and master frontends. By the way, in case I didn't make it clear, the master frontend works flawlessly.

Any idea why I'm getting the localhost errors in the remote frontend log:

I MythCoreContext: Connecting to backend server: localhost:6543 (try 1 of 1)
E Unable to connect to database!

and

No address defined for host: localhost

It's as if the frontend is trying to connect to a local backend, which doesn't exist, not the remote backend. I definitely point it to the remote backend IP address in setup.
User avatar
rwagner
Developer
Posts: 217
Joined: Thu Feb 06, 2014 11:37 pm
United States of America

Re: Remote frontend can't access backend MySQL

Post by rwagner »

wesnewell wrote:forget the ipv6 thing. That was another problem. Every time you upgrade mythtv, mythtv.cnf gets overwritten and the bind address will be commented out. Just comment out the bind-address in my.cnf and mythtv.cnf and try that. That is supposed to open up all ports to both ipv4 and ipv6 addresses. And make sure you have the same user and password for the remote frontend that you have on the master frontend.
Just to clarify, that's "mysql", not "mythtv". MythTV doesn't touch your MySQL configuration files. Also, that's very bad practice for a package system to overwrite user-modified configuration files.
aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus »

Yea, that was a typo.

You're right about overwrighting config files. It's sloppy packaging. In my experience MythTV in general is a handfull. Before MythTV I used the commercial package SageTV. It did about the same thing as MythTV but was much easier to manage. MythTV is a terrific product, but I wish the developers would put more emphasis on usability, both in installation and operation.
wesnewell
Senior
Posts: 731
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Remote frontend can't access backend MySQL

Post by wesnewell »

Well I'm not positive which upgrade overwrites the mythtv.cnf file, but I assumed it was the mythtv upgrade because it was over written every time it was upgraded. And I don't know why there would be a mythtv.cnf file in a mysql upgrade.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.
aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus »

The Ubuntu "mythtv-database" package installs/overwrites /etc/mysql/conf.d/mythtv.cnf. There's probabaly a good reason, but it's a symptom of MythTV's usability problem. Common things like accessing a remote frontend accessing the backend should "just work" and not turn into computer science projects. That was the case for SageTV before it was assimilated by Google. Apparently Google bought it for other reasons than publishing their own PVR software. It's too bad they didn't make it open source.

Another thing that I don't understand in my case is that the Android frontend app can access the backend without a problem. The Android frontend has other limitations, though, like no commercial skipping.
wesnewell
Senior
Posts: 731
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Remote frontend can't access backend MySQL

Post by wesnewell »

aartimus wrote: Any idea why I'm getting the localhost errors in the remote frontend log:

I MythCoreContext: Connecting to backend server: localhost:6543 (try 1 of 1)
E Unable to connect to database!

and

No address defined for host: localhost

It's as if the frontend is trying to connect to a local backend, which doesn't exist, not the remote backend. I definitely point it to the remote backend IP address in setup.
I missed this part earlier. Run this for me on remote frontend.
cat /etc/hosts
hostname
ifconfig
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.
Gary Buhrmaster
Junior
Posts: 52
Joined: Mon Feb 10, 2014 8:19 pm
United States of America

Re: Remote frontend can't access backend MySQL

Post by Gary Buhrmaster »

aartimus wrote:The Ubuntu "mythtv-database" package installs/overwrites /etc/mysql/conf.d/mythtv.cnf. There's probabaly a good reason, but it's a symptom of MythTV's usability problem.
Not a MythTV usability issue, a packagers usability issue. Contact your packager, or change to a different packager, or do your own packaging. The project (itself) does not ship a package that overwrites your configurations.
Common things like accessing a remote frontend accessing the backend should "just work" and not turn into computer science projects.
MythTV is, and has always been, a solution by, and for, those that understand that it is a hobby, and not just a plug and pray solution. If you do not want a (new) hobby, or cannot find someone to run the hobby for you, it likely is not for you. Or, alternative, pick up the hobby, and improve its "first user experience". You, too, can contribute. Even if you can just help document (the wiki is open to all), or can just help the packagers improve the packages (I have never heard of a packager not accepting additional help), all those things can improve those things you claim to wish to see be improved. So you don't forget, contribute before midnight tonight!

On the other hand, if you just want a toaster, go rent your MSOs DVR, or install WMC.
That was the case for SageTV before it was assimilated by Google. Apparently Google bought it for other reasons than publishing their own PVR software. It's too bad they didn't make it open source.
All indications were that SageTV was purchased to acquire the needed resources to offer a Google Fiber STB (not sure if it was the engineers, or the product itself). Regardless, whatever the software evolved into had to meet the various content provider "DRM" rules for Google Fiber TV, so it likely could not really be truly open, in the terms most want it to mean (and I would not be surprised that SageTV used non-open software libraries in order to achieve accelerated TTM, which means that it would require extensive review/rewrites to even consider opening things up).
aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus »

wesnewell wrote:
aartimus wrote: Any idea why I'm getting the localhost errors in the remote frontend log:

I MythCoreContext: Connecting to backend server: localhost:6543 (try 1 of 1)
E Unable to connect to database!

and

No address defined for host: localhost

It's as if the frontend is trying to connect to a local backend, which doesn't exist, not the remote backend. I definitely point it to the remote backend IP address in setup.
I missed this part earlier. Run this for me on remote frontend.
cat /etc/hosts
hostname
ifconfig
Here they are.

Most of my previous tries were form a Windows frontent. Windows 8.1 has a hosts file with all lines commented out. There is no hostname command and ipconfig isn't exactly the same is ifconfig on Linux.

To eliminate the Windows variable, I tried to run the the frontend on Ubunty 13.10 with MythTV .27. The same results occurred, but frontend log file shows nothing -- it's empty.

So here's the information you asked for from the Ubuntu system:
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 pooh-1

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
$ hostname
pooh-1
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1a:a0:4e:ad:f5
inet addr:192.168.0.120 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::21a:a0ff:fe4e:adf5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:270533 errors:0 dropped:0 overruns:0 frame:0
TX packets:147634 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:330385466 (330.3 MB) TX bytes:14853341 (14.8 MB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:5852 errors:0 dropped:0 overruns:0 frame:0
TX packets:5852 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:572170 (572.1 KB) TX bytes:572170 (572.1 KB)
aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus »

Not a MythTV usability issue, a packagers usability issue. Contact your packager, or change to a different packager, or do your own packaging. The project (itself) does not ship a package that overwrites your configurations.
This is clearly a packaging proble and no criticism of MythTV was implied. And it's a small and easily managed problem.
MythTV is, and has always been, a solution by, and for, those that understand that it is a hobby, and not just a plug and pray solution. If you do not want a (new) hobby, or cannot find someone to run the hobby for you, it likely is not for you. Or, alternative, pick up the hobby, and improve its "first user experience". You, too, can contribute. Even if you can just help document (the wiki is open to all), or can just help the packagers improve the packages (I have never heard of a packager not accepting additional help), all those things can improve those things you claim to wish to see be improved. So you don't forget, contribute before midnight tonight!

On the other hand, if you just want a toaster, go rent your MSOs DVR, or install WMC.
Well, that kind of sells MythTV short. Sure, it's not for everyone, but it has capabilities that can be found nowhere else. You have to draw the line on user competency somewhere, but you should also in my opinion try to make stuff work out of the box. When someone runs into a difficult problem it's not helpful to say in effect that they're not competent enough to use product.

I ran MythTV for a very long time before my current problems happened. It started with a upgrade of the backend OS from Mint 14 to Mint 17. Backing up and restoring the database went without a hitch and everything works perfectly on the backend system, including the local frontend (except for user jobs). But three thing broke after the upgrade:

1. No remote frontend access
2. Mythwenb broken
3. No user jobs -- at least no mythlink as a user job

1 and 2 probably have nothing directly to do with MythTV. The remote frontend access is caused by MySQL not accepting remote requests. Not a MythTV problem. Mythweb is broken because Apache2 won't serve up the MythTV pages -- probably a packaging problem. I don't know what's with the user job problem. The user job (mythlink) runs fine manually as user mythtv, but not as a user job, even though the log file indicates that the job ran successfully. I think this is a MythTV problem, at least to the extent that MythTV gives me nothing to go on to diagnose the problem. It looks like I'll have to run a test script as a user job to try to trace down what's happing, or more correctly, what's not happening. But I don't what to spend time on this until the more important remote fronend access problem is solved.
wesnewell
Senior
Posts: 731
Joined: Mon Jun 23, 2014 6:54 pm
Location: Wylie TX, USA
United States of America

Re: Remote frontend can't access backend MySQL

Post by wesnewell »

All that data looks good, except the ipv4 address is 192.168.0.120, not .119. Connecting to the backend server from a remote is pretty simple. All you need to do is make sure the ports are open, it listens for the addresses that try to connect to it, and you have the correct user name and password. binding 0.0.0.0 allows all addresses. Using the same user name and password you use on the master frontend should work. Double check the data in the General frontend setup screen and confirm you have it exactly like you have on the master frontend. Make sure the last bind-address = 0.0.0.0. If that doesn't work, I don't know what else to tell you. Make sure the database name is mythconverg. And I'd advise putting in that xmythtv.cnf file to avoid upgrades screwing it up later.
BE/FE-Asrock AB350 Pro Ryzen 3 3200G, 6 atsc tuners. FE's-GF8200's Athlon II, Ryzen 3 2200G. Mythtv user since 2005.
aartimus
Junior
Posts: 21
Joined: Tue May 27, 2014 6:01 am
United States of America

Re: Remote frontend can't access backend MySQL

Post by aartimus »

wesnewell wrote:All that data looks good, except the ipv4 address is 192.168.0.120, not .119. Connecting to the backend server from a remote is pretty simple. All you need to do is make sure the ports are open, it listens for the addresses that try to connect to it, and you have the correct user name and password. binding 0.0.0.0 allows all addresses. Using the same user name and password you use on the master frontend should work. Double check the data in the General frontend setup screen and confirm you have it exactly like you have on the master frontend. Make sure the last bind-address = 0.0.0.0. If that doesn't work, I don't know what else to tell you. Make sure the database name is mythconverg. And I'd advise putting in that xmythtv.cnf file to avoid upgrades screwing it up later.
As I mentioned above, I ran this on a different machine, hence the different IP address. I definitely have the same login information as on the local frontend, and bind-address is set to 0.0.0.0. Seems slimple enough, but it still refuses to work. I'm sure the problem is with MySQL. Maybe I should find a MySQL forum and ask them.

Here's something that I'm curious about. As I type this I'm watching a program using the MythTV Android app. It works perfectly. The Android app can do most of the important things that the Linux fronend can do including list, play, and delete recorded programs, display the channel guide, and list upcoming programs. (Sadly, what it doesn't do is skip commercials.) To configure the app all I had to do was specify the backend IP address. No MySQL password is required. How does it do all this without accessing the MySQL database, which I presume it doesn't do because it doesn't require a password. And why doesn't the LInux frontend do the same thing? Just wondering.
User avatar
dizygotheca
Developer
Posts: 267
Joined: Wed Sep 03, 2014 9:02 am
Great Britain

Re: Remote frontend can't access backend MySQL

Post by dizygotheca »

MythTV gives me nothing to go on to diagnose the problem
Myth has extensive logging available - see "mythfrontend -v help"

Try:

mythfrontend -v general, database, network --loglevel debug

on the frontend to check that it is configured correctly and doing what you expect.
And you can get detailed MySQL logs by adjusting your my.cnf.
Maybe they will help you to pinpoint the issue.

Re the user job: Are you getting log files from it ? Either add %VERBOSEMODE% to the job arguments or an explicit --logfile.

mythbackend --setverbose system; mythbackend --setloglevel debug

will change the logging of *your backend that is already running* and may give some clues.
User avatar
bill6502
Developer
Posts: 2307
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Remote frontend can't access backend MySQL

Post by bill6502 »

aartimus wrote: Here's something that I'm curious about. As I type this I'm watching a program using the MythTV Android app. It works perfectly. The Android app can do most of the important things that the Linux fronend can do including list, play, and delete recorded programs, display the channel guide, and list upcoming programs. (Sadly, what it doesn't do is skip commercials.) To configure the app all I had to do was specify the backend IP address. No MySQL password is required. How does it do all this without accessing the MySQL database, which I presume it doesn't do because it doesn't require a password. And why doesn't the LInux frontend do the same thing? Just wondering.
MythTV Andriod Frontend (and likely others) access the backend using the Services API. It does not
connect to mysql. The Services API running in the backend accesses the DB as needed.
Post Reply