[mythtv-users] MythTV 0.21 to 0.25 upgrade sequence questions

Michael T. Dean mtdean at thirdcontact.com
Wed May 2 20:44:48 UTC 2012


On 05/02/2012 04:30 PM, DFishburn wrote:
> I am upgrading from MythTV 0.21 to 0.25.
>
> Since my 0.21 is running on Ubuntu 7.04, I am planning on reformatting 
> the drive and reinstalling from scratch.
>
> Prior to doing that, I am using 2 VMs to test my upgrade process so I 
> don't have any surprises.
>
> I created two VMs, one running 0.24+fixes (Mythbuntu 11.10) and 
> 0.25+fixes (Mythbuntu 12.04).
>
> I have read a couple of posts on this forum, which are specific that 
> 0.21 cannot be upgraded directly to 0.25.
> *
> Notice for users of old (pre-0.22) MythTV versions*
> http://www.gossamer-threads.com/lists/mythtv/users/507819
> *Changing from 0.21 to 0.25 using new hardware*
> http://www.gossamer-threads.com/lists/mythtv/users/508796
>
> I have also read this wiki entry:
> http://www.mythtv.org/wiki/Database_Backup_and_Restore
>
> In the wiki it specifically mentions:
>
> ***
>
>
>         Change the hostname of a MythTV frontend or backend
>
> Before changing the hostname of a MythTV frontend or backend, make 
> sure you create a good database backup, so that you can get back to a 
> known state if things go wrong.
>
> When changing the hostname of your system, you /must/ perform the 
> following actions /before/ you start any MythTV programs. If you start 
> a MythTV program before modifying the hostname in the database, the 
> program will create new entries with the new hostname, meaning that 
> the following procedure is likely to fail because of duplicate entries.
>
> It is also critical to ensure you do not change the name of a host to 
> the name of another already-existing host in the database--doing so 
> will cause duplicate entries. Instead, if necessary, run the command 
> below multiple times, using a temporary "placeholder" hostname to 
> ensure the different hosts are not improperly merged.
>
> Note that changing the hostname is performed on an existing database 
> and does not restore a database. Therefore, to change a hostname, 
> ensure that the database exists (restore an old database, as above, if 
> necessary) and execute the following command, replacing "XXXX" and 
> "YYYY" with appropriate values for the old and new hostnames, 
> respectively:
>
> ***
>
> So, if I consider sequence.
>
> 1.  I cannot simply save the backup and restore it to my newly 
> formatted (same hardware) machine since it was at 0.21.
> 2.  So I have to upgrade the database on a different 0.24 machine first.
> 3.  This means I have to technically change the hostname, or I might 
> run into duplicates.  But I have to do this _before_ running 
> mythtv-setup to perform the upgrade.
> 4.  After running mythtv-setup, I then run mythtv-frontend which 
> upgrades more of the database (videos and something else).
> 5.  Then I would reformat my 0.21 machine, reinstall 12.04 and 0.25.
> 6.  Perform the same steps over again, this time with another hostname 
> change, but actually back to the original 0.21 name.
>
>
> So I am not sure which is the correct approach.  I could forget the 
> hostname change completely and eventually dump the fully upgraded 
> database back into my fresh 0.25 install.
>
>
> The other concern I had was, one of the threads above indicated, 
> upgrading (even through the intermediate steps) may not work 
> completely with 0.25 and a fresh database might be a better approach.  
> If this is true, what process do you follow to dump all your 
> recordings, schedules and what not back into the fresh 0.25 database?
>
>
> Right now, I will be following this sequence (without the hostname 
> change on purpose, though each machine has different hostnames):
>
> 0.21
>
> /usr/share/mythtv/mythconverg_backup.pl
>
> scp file to 0.24 machine
>
> 0.24
>
> sudo stop mythtv-backend
> /usr/share/mythtv/mythconverg_restore.pl --drop_database 
> --create_database --filename mythconverg-1214-one-from-021.sql.gz
>
> mythtv-setup
> - Upgrades most of the schema
> mythtv-frontend
> - Upgrades the rest of the schema
>
> /usr/share/mythtv/mythconverg_backup.pl
>
> scp file to 0.25 machine
>
> 0.25
>
> sudo stop mythtv-backend
> /usr/share/mythtv/mythconverg_restore.pl --drop_database 
> --create_database --filename mythconverg-1214-one-from-024.sql.gz
>
> mythtv-setup
> - Upgrades most of the schema
> mythtv-frontend
> - Upgrades rest of the schema
>
>
> Format 0.21 machine.
> Install a fresh Mythbuntu 12.04, 0.25 machine.
> scp file from test 0.25 machine.
>
> sudo stop mythtv-backend
> /usr/share/mythtv/mythconverg_restore.pl --drop_database 
> --create_database --filename mythconverg-1214-one-from-025.sql.gz
>
>
> The recordings are all on different partitions from the main Ubuntu 
> install, so they should just remain in place.  So after the restore, I 
> believe they should be immediately accessible.

Easiest approach is to:

a) Shut down all MythTV applications on your production system 
(mythfrontend/mythbackend/...)
b) When you use the 0.24-fixes system to upgrade the database, copy the 
mysql.txt file from your old 0.21 system over (and remove any config.xml 
files), then change the DBHostName (and other DB info) *and* specify a 
LocalHostName override that uses the same host name your 0.21-fixes 
master backend used
c) Use the same mysql.txt (again updating DBHostName, as required)

At that point, you've only ever used the <backendhostname> system to run 
MythTV applications involved in the upgrade.

Note, also, you can make it even easier--no need to actually more the 
database around.

Just shut down the production system, then crate a DB backup (as you 
planned), then start up the 0.24-fixes mythtv-setup/mythfrontend with 
the mysql.txt file mentioned in b) above but with the DBHostName pointed 
at the database server on the old machine.  Then create a DB backup.  
Then copy the mysql.txt file over to the 0.25 machine and use it without 
modification to upgrade to 0.25.  Then crate a DB backup.  Then upgrade 
any/all hosts, as desired.

So, basically, by using LocalHostName to override the hostname 
identifier, MythTV never creates settings, etc. for other hosts.

Mike


More information about the mythtv-users mailing list