mythbackend cannot find mysql.txt after upgrade

Bug #546616 reported by Geoffrey Pursell on 2010-03-25
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Mythbuntu
High
Unassigned
Nominated for 10.04 by Geoffrey Pursell

Bug Description

After upgrading to Mythbuntu 10.04 beta, mythbackend doesn't work.

It's unable to connect to the database, because it can't find mysql.txt, I suppose because in the service mythbackend's context, either MYTHCONFDIR is not set, or HOME is not set. Since I have a correct mysql.txt both in /etc/mythtv/ and in $HOME/.mythtv.

If I start mythbackend by hand in a terminal, it works fine.

It spews this continually:

................................................................................
2010-03-24 21:44:17.606 UPnPautoconf() - No UPnP backends found
2010-03-24 21:44:17.606 No UPnP backends found

No UPnP backends found

Would you like to configure the database connection now? [no]
[console is not interactive, using default 'no']
2010-03-24 21:44:17.608 Deleting UPnP client...
2010-03-24 21:44:18.218 Failed to init MythContext, exiting.
2010-03-24 21:44:18.344 mythbackend version: trunk [23623] www.mythtv.org
2010-03-24 21:44:18.345 Using runtime prefix = /usr
2010-03-24 21:44:18.345 Using configuration directory = /.mythtv
2010-03-24 21:44:18.345 Unable to read configuration file mysql.txt
2010-03-24 21:44:18.345 Empty LocalHostName.
2010-03-24 21:44:18.346 Using localhost value of mythtv
2010-03-24 21:44:18.352 New DB connection, total: 1
2010-03-24 21:44:18.359 Unable to connect to database!
2010-03-24 21:44:18.359 Driver error was [1/1045]:
QMYSQL: Unable to connect
Database error was:
Access denied for user 'mythtv'@'localhost' (using password: YES)

................................................................................
2010-03-24 21:44:20.917 UPnPautoconf() - No UPnP backends found
2010-03-24 21:44:20.917 No UPnP backends found

No UPnP backends found

Would you like to configure the database connection now? [no]
[console is not interactive, using default 'no']
2010-03-24 21:44:20.918 Deleting UPnP client...

MarcRandolph (mrand) wrote :

Mythbuntu is attempting to transition to using only config.xml. Could you please double check that it exists, and that is contents match your known good mysql.txt file(s)?

Changed in mythbuntu:
status: New → Incomplete
Geoffrey Pursell (geoffp) wrote :

geoff@mythtv:/etc/mythtv$ ls -l
total 24
-rw-rw---- 1 mythtv mythtv 422 2010-03-24 23:05 config.xml
-rw-rw-r-- 1 mythtv mythtv 1122 2010-03-24 19:36 mysql.txt
-rw-r--r-- 1 root root 1990 2009-12-21 05:00 mythweb-canned_searches.conf.php
-rw-r--r-- 1 root root 4732 2009-12-21 05:00 mythweb-config.php
-rw-r--r-- 1 root root 1110 2009-01-26 11:38 session-settings

geoff@mythtv:/etc/mythtv$ cat config.xml
<Configuration>
  <UPnP>
    <MythFrontend>
      <DefaultBackend>
        <DBHostName>localhost</DBHostName>
        <DBUserName>mythtv</DBUserName>
        <DBPassword>Br9O078H</DBPassword>
        <DBName>mythconverg</DBName>
        <DBPort>0</DBPort>
      </DefaultBackend>
    </MythFrontend>
    <UDN>
      <MediaRenderer>d11d3572-6a68-4795-b247-dbcedd30fb72</MediaRenderer>
    </UDN>
  </UPnP>
</Configuration>

geoff@mythtv:/etc/mythtv$ cat mysql.txt
DBHostName=localhost

# By default, Myth tries to ping the DB host to see if it exists.
# If your DB host or network doesn't accept pings, set this to no:
#
DBHostPing=no

DBUserName=mythtv
DBName=mythconverg
DBType=QMYSQL3

# Set the following if you want to use something other than this
# machine's real hostname for identifying settings in the database.
# This is useful if your hostname changes often, as otherwise you
# will need to reconfigure mythtv (or futz with the DB) every time.
# TWO HOSTS MUST NOT USE THE SAME VALUE
#
#LocalHostName=my-unique-identifier-goes-here

# If you want your frontend to be able to wake your MySQL server
# using WakeOnLan, have a look at the following settings:
#
#
# The time the frontend waits (in seconds) between reconnect tries.
# This should be the rough time your MySQL server needs for startup
#
#WOLsqlReconnectWaitTime=0
#
#
# This is the number of retries to wake the MySQL server
# until the frontend gives up
#
#WOLsqlConnectRetry=5
#
#
# This is the command executed to wake your MySQL server.
#
#WOLsqlCommand=echo 'WOLsqlServerCommand not set'
DBPassword=Br9O078H
geoff@mythtv:/etc/mythtv$

That config.xml schema doesn't look right to me. Everything in the UPnP node?

Now, there's an empty config.xml file in $HOME/.mythtv, but I'm not sure why that would affect the backend at startup. I assume that mythbackend does not run as "geoff". The mysql.txt there is just a symlink to /etc/mysql.txt, anyway.

Please try deleting the one in your home dir (config.xml) and trying again.

On Thu, Mar 25, 2010 at 6:38 AM, Geoffrey Pursell <email address hidden> wrote:

> geoff@mythtv:/etc/mythtv$ ls -l
> total 24
> -rw-rw---- 1 mythtv mythtv 422 2010-03-24 23:05 config.xml
> -rw-rw-r-- 1 mythtv mythtv 1122 2010-03-24 19:36 mysql.txt
> -rw-r--r-- 1 root root 1990 2009-12-21 05:00
> mythweb-canned_searches.conf.php
> -rw-r--r-- 1 root root 4732 2009-12-21 05:00 mythweb-config.php
> -rw-r--r-- 1 root root 1110 2009-01-26 11:38 session-settings
>
> geoff@mythtv:/etc/mythtv$ cat config.xml
> <Configuration>
> <UPnP>
> <MythFrontend>
> <DefaultBackend>
> <DBHostName>localhost</DBHostName>
> <DBUserName>mythtv</DBUserName>
> <DBPassword>Br9O078H</DBPassword>
> <DBName>mythconverg</DBName>
> <DBPort>0</DBPort>
> </DefaultBackend>
> </MythFrontend>
> <UDN>
> <MediaRenderer>d11d3572-6a68-4795-b247-dbcedd30fb72</MediaRenderer>
> </UDN>
> </UPnP>
> </Configuration>
>
> geoff@mythtv:/etc/mythtv$ cat mysql.txt
> DBHostName=localhost
>
> # By default, Myth tries to ping the DB host to see if it exists.
> # If your DB host or network doesn't accept pings, set this to no:
> #
> DBHostPing=no
>
> DBUserName=mythtv
> DBName=mythconverg
> DBType=QMYSQL3
>
> # Set the following if you want to use something other than this
> # machine's real hostname for identifying settings in the database.
> # This is useful if your hostname changes often, as otherwise you
> # will need to reconfigure mythtv (or futz with the DB) every time.
> # TWO HOSTS MUST NOT USE THE SAME VALUE
> #
> #LocalHostName=my-unique-identifier-goes-here
>
> # If you want your frontend to be able to wake your MySQL server
> # using WakeOnLan, have a look at the following settings:
> #
> #
> # The time the frontend waits (in seconds) between reconnect tries.
> # This should be the rough time your MySQL server needs for startup
> #
> #WOLsqlReconnectWaitTime=0
> #
> #
> # This is the number of retries to wake the MySQL server
> # until the frontend gives up
> #
> #WOLsqlConnectRetry=5
> #
> #
> # This is the command executed to wake your MySQL server.
> #
> #WOLsqlCommand=echo 'WOLsqlServerCommand not set'
> DBPassword=Br9O078H
> geoff@mythtv:/etc/mythtv$
>
>
> That config.xml schema doesn't look right to me. Everything in the UPnP
> node?
>
> Now, there's an empty config.xml file in $HOME/.mythtv, but I'm not sure
> why that would affect the backend at startup. I assume that mythbackend
> does not run as "geoff". The mysql.txt there is just a symlink to
> /etc/mysql.txt, anyway.
>
> --
> mythbackend cannot find mysql.txt after upgrade
> https://bugs.launchpad.net/bugs/546616
> You received this bug notification because you are subscribed to
> Mythbuntu.
>

Geoffrey Pursell (geoffp) wrote :

No luck. I also have user directories for mythtv and root at /home/mythtv and /root, respectively, and in those, I have .mythtv/config.xml files that symlink back to /etc/mythtv/config.xml.

This:

2010-03-24 21:44:18.345 Using configuration directory = /.mythtv

Does not seem right. I feel like that should be /home/mythtv/.mythtv or /etc/mythtv or /home/geoff/.mythtv.

Have a look at mythdirs.cpp, line 62.
http://www.google.com/codesearch/p?hl=en#-zNo3rQOo4A/mythtv/libs/libmythdb/mythdirs.cpp&q=myth%20%22using%20configuration%20directory%22&sa=N&cd=1&ct=rc

Geoffrey Pursell (geoffp) wrote :

Guys, please let me know if you need anything more from me to get this fixed.

James Stembridge (jstembridge) wrote :

I've had the exact same issue after just upgrading from karmic.

I've added "env HOME=/home/mythtv" to "/etc/init/mythtv-backend.conf" for the time being as a workaround.

yota (yota-opensystems) wrote :

Even if I'm not affected by this exact bug the lack of proper environment settings (like $HOME) are making my mythfilldatabase fail:

...
2010-04-09 13:16:53.430 Using runtime prefix = /usr
2010-04-09 13:16:53.446 Using configuration directory = /.mythtv
2010-04-09 13:16:53.446 Unable to read configuration file mysql.txt
2010-04-09 13:16:53.446 Empty LocalHostName.
...

I believe this comes from how the mythbackend process is launched in /etc/init/mythtv-backend.conf which executes the process without setting the environment. This said I was able to resolve the problem by launching mythbackend after a switch user to mythtv with "--login" option.

The modified version of /etc/init/mythtv-backend.conf is attached.

James Stembridge (jstembridge) wrote :

This problems seems to be due to an old /etc/default/mythtv-backend file that doesn't provide the --user flag. The necessary defaults appear to be in /etc/init/mythtv-backend.conf so this files seems unneeded now.

Thanks. Adding --user $USER in the command in /etc/default/mythtv-backend did the trick =)

MarcRandolph (mrand) wrote :

James, thanks for the analysis.

Changed in mythbuntu:
importance: Undecided → High
status: Incomplete → Triaged
Mario Limonciello (superm1) wrote :

OK, we should have this fixed in the next autobuild.

Changed in mythbuntu:
status: Triaged → Fix Committed
Mario Limonciello (superm1) wrote :

(and the fix is modifying the upstart script to not source that file. If you need something from that file in your upstart script, modify it yourself)

Thomas Mashos (tgm4883) wrote :

Marking as fixed released since this should be available via the mythtv-updates repo from the Mythbuntu team

Thomas Mashos (tgm4883) on 2011-05-06
Changed in mythbuntu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers