[mythtv-users] SystemD (Was: Recommended Linux Distro post CentOS)

R. G. Newbury newbury at mandamus.org
Fri Dec 25 18:24:40 UTC 2020


On 2020-12-25 1:47 a.m., Stephen Worthington wrote:
> On Thu, 24 Dec 2020 23:44:41 -0500, you wrote:

>>>
>>> My guess would be that time-sync.target is what is fixing things. 

I think that you are correct. I did not know about that target, but it 
appears to do exactly what is needed.

>> I may have missed it, but I don't think the OP ever stated whether this
>> was a BE/FE box, or an external FE, trying to talk to the BE. It makes a
>> difference in the config.xml...

>> <Host> is the IP address of the backend and mariadb server box.
>> Localhost is only useful on a BE/FE box, but NOT if you want access from
>> any other FE. The other items in that stanza are the login details for
>> the user from the particular FE, INTO the mariadb server on the <Host> box.
>> Of course, if that is not set, then the external FE will never connect.
>> Remember that although you may have a user mythtv on each box (or even
>> your phone!) it is a different user for the mariadb access. Each
>> user/computer combo has to be authorized on the mariadb server.
> 
> You have a misconception here.  The Host field in config.xml is only
> the address of the database server.  The address of the backend is
> stored in the database.  So even on a backend/frontend box, it makes
> sense for the config.xml file to have <Host>localhost</Host>, so that
> mythbackend will connect to the database using the much faster
> localhost connection.  And, in fact, if you specify localhost,
> mythbackend has special code that checks for that and then has it
> connect via the even faster Unix socket connection to the database.

I hope we have not confused the OP. Not a misconception on my part. I 
was talking about setting up an external FE. As you point out, the 
database server *can be* on a different box entirely from any BE or FE. 
In that case, all boxes are treated as 'external' to the db server and 
need the <Host> attribute to point to the db box. Only in the case of a 
combined BE/db server can you use (and should use) 'localhost' (so that, 
in that particular case, a socket is used instead of networking).


> If you want to have external frontends, the address for the backend in
> the database needs to be set to the external IP address of the box.
> And the config.xml files on other devices running frontends need to
> have the external IP address of the database box (which does not need
> to be on the same box as the backend).  And the database needs to be
> told to bind to the external IP address of its box as well as to
> localhost (bind-address=:: or bind-address=0.0.0.0).

Exactly. the bind address setting is in /etc/my.cnf or equivalent.


> I do not like the look of "restart mariadb.service".  If the backend
> is up and recording, that would likely corrupt the database for that
> recording.  Or if it was running mythfilldatabase, the EPG would get
> corrupted.  Mariadb should be waking up properly automatically if the
> backend box went to sleep.  If that is not happening, then that is
> what needs to be fixed.  Or maybe using "start" instead of "restart"
> would work - that will only affect mariadb if it is not already
> running.  Using "restart" here would only be safe if the frontend
> attempted to connect before doing the WOL part and never did that
> command if the database connected Ok.  I have never used WOL, so I am
> not sure which way it works.
You are correct: it should be 'systemctl start mariadb.service'. Did 
some searching; if the service is running already, 'start' does nothing. 
'restart' *stops* the service and starts it again, thus breaking 
whatever was running.

Apparently 'restart' is used for any service upon which another service 
depends. Mariadb.service needs networking (for the external service 
case). Restarting networking will also start mariadb.service. (But this 
is not transitive: restarting mariadb.service does nothing to networking 
so I was using it 'backwards' by mistake.
WakeOnLAN can be used to bring a box out of "hibernation"/suspend etc, 
so that your remote FE can wake the BE/db server. In that case you might 
need to start the mariadb.service (and, I guess, in that case, 'restart' 
would not make any difference).

As I said, I hope we have not by now, thoroughly confused the OP. 
Checking this has refreshed my memory that doing a RTFM about mariadb 
*ALWAYS* takes 2 hours.

Merry Christmas to all (even to those who are now enjoying Boxing Day).

Geoff




More information about the mythtv-users mailing list