[mythtv-users] BE3 - Issues with installation and database

Stephen Worthington stephen_agent at jsw.gen.nz
Sat May 25 11:24:56 UTC 2019


On Fri, 24 May 2019 15:51:54 -0500, you wrote:

>
>
>Hi Stephen!
>
>
>sudo restart mythtv-backend
>
>Found another potential error, or could be just a shortcut command I
>don?t have installed:
>
>
>barry at Backend-3:~$ sudo restart mythtv-backend
>
>sudo: restart: command not found
>Sorry, that was a typo on my part.  It should be:
>
>sudo systemctl restart mythtv-backend
>
>    Oops! I might have caught the error if you did what I do often: add
>    an ‘r’ ==> “systemct*r*l”!
>
>OK, that all looks good except for not being able to connect to
>MariaDB on 192.168.0.3.  That is likely only that you have not yet
>changed the bind-address= line in the MariaDB config files, so it is
>only allowing connections on localhost.  So you need to fix that now.
>Do this to find all the bind-address lines:
>
>sudo su
>cd /etc/mysql
>grep -ar "bind-address" *
>
>There may be more than one bind-address line.  If so, choose one of
>them and change it to:
>
>bind-address=::
>
>and change all the others by adding a # character as the first
>character on the line (comment them out).  Use your favourite editor,
>or nano.
>
>    OK. I’m taking things too literal here and realizing a problem. *cd
>    /etc/mysql* changes to a directory and there are several files and
>    subir’s within. (*grep -ar* command) ...Ah! So sort of like the find
>    command!
>
>
>    barry at Backend-3:~$ cd /etc/mysql
>
>    barry at Backend-3:/etc/mysql$ ls
>
>    conf.d debian.cnf-5.7 mariadb.cnf my.cnf mysql.cnf
>
>    debian.cnf debian-start mariadb.conf.d my.cnf.fallback mysql.conf.d
>
>    barry at Backend-3:/etc/mysql$
>
>
>
>    This is the original:
>
>
>    root at Backend-3:/etc/mysql# grep -ar "bind-address" *
>
>    conf.d/mythtv.cnf:#bind-address=::
>
>    mariadb.conf.d/50-server.cnf:bind-address = 127.0.0.1
>
>    mysql.conf.d/mysqld.cnf:bind-address = 127.0.0.1
>
>    root at Backend-3:/etc/mysql#
>
>
>    And the one with the double colon is commented out. Think I’ll
>    uncomment that one and comment the two with 127.0.0.1.
>
>
>    root at Backend-3:/etc/mysql# grep -ar "bind-address" *
>
>    conf.d/mythtv.cnf:bind-address=::
>
>    mariadb.conf.d/50-server.cnf:# bind-address = 127.0.0.1
>
>    mysql.conf.d/mysqld.cnf:# bind-address = 127.0.0.1
>
>    root at Backend-3:/etc/mysql#
>
>
>Then restart MariaDB:
>
>systemctl restart mariadb
>
>and exit from the root command prompt:
>
>exit
>
>Now check that you can connect using 192.168.0.3:
>
>mysql -u mythtv -p mythconverg
>
>and give it the password from /etc/mythtv/config.xml.
>
>    barry at Backend-3:/etc/mysql$ mysql -u mythtv -p mythconverg
>
>    Enter password:
>
>    Reading table information for completion of table and column names
>
>    You can turn off this feature to get a quicker startup with -A
>
>
>    Welcome to the MariaDB monitor. Commands end with ; or \g.
>
>    Your MariaDB connection id is 109
>
>    Server version: 10.1.38-MariaDB-0ubuntu0.18.04.2 Ubuntu 18.04
>
>
>    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
>
>
>    Type 'help;' or '\h' for help. Type '\c' to clear the current input
>    statement.
>
>
>    MariaDB [mythconverg]>
>
>
>
>
>    This looks better!! :)
>
>
>Will check out your credentials-checking script.
>
>
>
 Hmm: is it safe to try to configure the Backend? Think I’ll upload 
>this port and then take a celebratory break.
>
>
>Thanks!
>
>Barry

Yes, it should be OK to run mythtv-setup now.  I can not remember if
you have any networked tuners though - if you do, then to make sure
mythbackend can see them when it starts up, you will need to do the
same fix that is needed for mythbackend to only start after the
network is fully up.  In the mean time, if would pay to simply restart
mythbackend manually after bootup is complete:

sudo systemctl restart mythtv-backend


=====================================================================

To install the full fix for starting mythbackend only after the
network is up, the first thing to do is to download this file from my
web server:

sudo su
cd /usr/local/bin
wget -c http://www.jsw.gen.nz/mythtv/wait-until-pingable.py
chown root:root wait-until-pingable.py
chmod u=rwx,g=rx,o=rx wait-until-pingable.py

Now test wait-until-pingable.py - find the IP address or DNS name of
something on your network that is pingable and will always be
available.  If your Ethernet switch is pingable, that is the best
option, otherwise your router is usually pingable:

sudo wait-until-pingable.py <IP address> 5; echo $?

That will return immediately and display a 0 result if the ping
succeeds.  If the ping fails, it will timeout after 5 seconds and
display a non-zero result.

Then you need to create a systemd override file for mythbackend:

systemctl edit mythtv-backend

That will start your default editor (usually nano).  Paste this text
into it, (with <IP address> changed to an IP address that you tested
above that worked):

[Service]
ExecStartPre=/usr/local/bin/wait-until-pingable.py <IP address> 30

What that does is to tell systemd to run the wait-until-pingable.py
program before it tries to start mythbackend.  Systemd will wait until
wait-until-pingable.py stops before it will go on to start
mythbackend.  The parameters on the wait-until-pingable.py command
line are an IP address for it to ping, and a timeout in seconds, so
mythbackend will eventually be started even if the ping fails.  The
<IP address> can also be a DNS name, in which case it also has to wait
for DNS lookups to be working.


More information about the mythtv-users mailing list