Bug 2450

Summary: MythTV backend searches for configurations in /etc/mythtv/.mythtv
Product: Fedora Reporter: Göran Uddeborg <goeran>
Component: mythtvAssignee: Richard <hobbes1069>
Status: VERIFIED FIXED    
Severity: normal CC: alex, jarod
Priority: P5    
Version: 17   
Hardware: x86_64   
OS: GNU/Linux   
namespace:

Description Göran Uddeborg 2012-08-20 18:31:47 CEST
After updating my MythTV box the backend could no longer connect to the database server.  After searching the logs a little, I found this in /var/log/mythtv/mythbackend.....log:

2012-08-20 18:05:18.180125 N [632/632] thread_unknown mythdirs.cpp:64 (InitializeMythDirs) - Using configuration directory = /etc/mythtv/.mythtv

2012-08-20 18:05:18.181335 I [632/632] CoreContext mythcorecontext.cpp:227 (Init) - Assumed character encoding: sv_SE.UTF-8
2012-08-20 18:05:18.184690 E [632/632] CoreContext mythdb.cpp:866 (LoadDatabaseParamsFromDisk) - Unable to read configuration file mysql.txt
2012-08-20 18:05:18.184810 E [632/632] CoreContext mythdb.cpp:899 (ValidateDatabaseParams) - DBHostName is not set in config.xml
2012-08-20 18:05:18.184857 N [632/632] CoreContext mythcontext.cpp:477 (LoadDatabaseSettings) - Empty LocalHostName.
2012-08-20 18:05:18.184867 I [632/632] CoreContext mythcontext.cpp:481 (LoadDatabaseSettings) - Using localhost value of pluto
2012-08-20 18:05:15.640486 E [632/632] CoreContext mythdbcon.cpp:213 (OpenDatabase) - Unable to connect to database!
2012-08-20 18:05:15.640525 E [632/632] CoreContext mythdbcon.cpp:214 (OpenDatabase) - Driver error was [1/2002]:
QMYSQL: Unable to connect
Database error was:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

My configuration is placed directly in /etc/mythtv.  Not in a .mythtv subdirectory of that directory.  And that worked, until the upgrade I did today.

A soft link worked around the problem.

lrwxrwxrwx 1 root root 1 20 aug 18.13 /etc/mythtv/.mythtv -> .

With that link, the backend can connect to the database again, and everything works fine.

But this isn't the intended behavior, is it?  The files config.xml and mysql.txt are owned by the mythtv-common package, and it still puts them directly in /etc/mythtv.  And that seems to make more sense, so I'm assuming the backend has got a bug and is looking in the wrong place.

Package versions:
mythtv-common-0.25.2-1.fc17.x86_64
mythtv-backend-0.25.2-1.fc17.x86_64
Comment 1 Richard 2012-08-24 02:12:23 CEST
Sorry, I just started a new position at work so things have been a little busy.

Quick question:

In your /lib/systemd/system/mythbackend.service file, does it specify both a HOME environment and MYTHCONFDIR or just HOME?

Something to the effect of:
# Default setting assumes a system wide install. Otherwise it should be set to 
# the folder containing the .mythtv subfolder containing the config.xml file
Environment=HOME=/etc/mythtv
            ^^^^
Comment 2 Göran Uddeborg 2012-08-24 18:52:31 CEST
It specifies only HOME, and that seems to be how it was from the start:

[goeran@pluto ~]$ grep Environment /usr/lib/systemd/system/mythbackend.service 
Environment=HOME=/etc/mythtv
[goeran@pluto ~]$ rpm -Vf /usr/lib/systemd/system/mythbackend.service 
[goeran@pluto ~]$
Comment 3 Richard 2012-08-24 21:17:43 CEST
It used to specify both but I was let to believe by upstream that HOME was preferred. It seems that for HOME, .mythtv is appended but for MYTHCONFDIR it is not. 

Try copying the service file from /lib/systemd/system into /etc/systemd/system and change HOME to MYTHCONFDIR.
Comment 4 Richard 2012-08-25 18:57:54 CEST
Had a chance to test myself and it does indeed fix the problem. I'm working on new builds now.
Comment 5 Göran Uddeborg 2012-08-25 21:12:03 CEST
You beat me to it with a couple of hours.  Let me know if there is anything else I can help with.
Comment 6 Richard 2012-09-29 21:13:18 CEST
Fixed in 0.25.2-2.
Comment 7 Göran Uddeborg 2012-10-01 19:04:20 CEST
Works for me now.  Thanks for the fix!