[mythtv-commits] Ticket #13155: mythtv fails schema upgrade

MythTV noreply at mythtv.org
Wed Oct 18 10:47:48 UTC 2017

#13155: mythtv fails schema upgrade
     Reporter:  dhighey@…           |      Owner:
         Type:  Bug Report - Crash  |     Status:  new
     Priority:  major               |  Milestone:  needs_triage
    Component:  MythTV - General    |    Version:  v29.0
     Severity:  high                |   Keywords:
Ticket locked:  0                   |
 After upgrading to mythtv-backend-29.0-1.fc26.x86_64 the back end fails to

 The log file has the following error listed.

 2017-10-13 03:45:08.076484 E [16990/16990] CoreContext dbcheck.cpp:411
 (performUpdateSeries) - DB Error (Performing database upgrade):
 Query was: @�^F^B
 Error was: Driver error was [2/1064]:
 QMYSQL: Unable to execute query
 Database error was:
 You have an error in your SQL syntax; check the manual that corresponds to
 your MariaDB server version for the right syntax to use near '@�^F^B' at
 line 1

 2017-10-13 03:45:08.076490 E [16990/16990] CoreContext dbcheck.cpp:519
 (UpgradeTVDatabaseSchema) - Database schema upgrade failed.
 2017-10-13 03:45:08.076671 E [16990/16990] CoreContext
 main_helpers.cpp:571 (run_backend) - Couldn't upgrade database to new

 Subsequently found that by running mythtv-setup I was able to complete the
 database upgrade.

 This issue was first reported to the rpmfusion.org as defect 4685.

 Additional information below from that report by another user.

 The guy on that thread was right.  Seems like master.toUtf8() on 3361 of
 libmythtv/dbcheck.cpp is buggy.  Perhaps what we have in common is we have
 our locale's set to something myth doesn't expect?  Just a guess.

 Here's the workaround, but only run this if you schema is currently at

 Get a cmd line into your mythtv mysql server.  Run the commands that the
 1346 section of that cpp file shows.  Here they are for those who don't
 want to sift through source.  You must change the "yourhost" type values
 to what suits your setup.  Ignore the # lines they are just my comments.

 insert into settings (value,data,hostname) values ('MasterServerName'

 insert into settings (value,data,hostname) select 'BackendServerAddr',
 data, hostname from settings where value = 'BackendServerIP';
 # seems to put in the wrong address if you have 2 hostnames, but things
 still seem to work so I just left it alone

 update settings a, settings b set b.data = a.data where a.value =
 'BackendServerIP6' and b.hostname = a.hostname and b.value =
 'BackendServerAddr' and b.data = '' and a.data != '::1' and
 a.data is not null and a.data != '';
 # noop if you don't have an ipv6 setup

 update settings a, settings b, settings c set c.data = a.data where
 a.value = 'MasterServerIP' and b.value = 'MasterServerName' and c.value =
 'BackendServerAddr' and c.hostname = b.data;
 # was noop on my box

 delete from settings where value in ('WatchTVGuide');

 update settings set data=1347 where value='DBSchemaVer';

 Then have systemd restart mythtv-backend and it should update to the
 latest version and run fine.  Works for me!

 If someone wants to bother, it would be nice to put this as a bug on the
 mythtv bugzilla so upstream can fix it.  They need to fix that Utf8 call
 which is almost certainly the problem since that string does not appear
 anywhere else in the cpp file.

Ticket URL: <https://code.mythtv.org/trac/ticket/13155>
MythTV <http://www.mythtv.org>
MythTV Media Center

More information about the mythtv-commits mailing list