Migrating Mythbuntu 12.04 to Mythbuntu 14.04
Summary
This tutorial outlines the process of migrating from Mythbuntu 12.04
to 14.04. The existing Mythbuntu 12.04 system was running MythTV
0.25, and the new Mythbuntu 14.04 will be running MythTV 0.27.
In the steps detailed below, the recordings are assumed to exist in a
partition separate from the Mythbuntu Operating System. These
recordings will not be touched and will be accessible when the
migration is complete.
CAUTION: Recordings assumed stored in a separate partition. Partition File system Mount point Description --------- ----------- ----------- ----------- /dev/sda1 ext4 / Mythbuntu 12.04 operating system /dev/sda2 linux-swap swap Linux swap space /dev/sda3 ext4 /data MythTV recordings, videos, etc. |
Contents
- Backup MythTV Database
- Backup Existing Mythbuntu Operating System Partition [Optional]
- Install New Mythbuntu Operating System
- Adjust Folder Ownership
- Restore MythTV Database
- Upgrade and Re-configure MythTV Database
- Re-configure MythTV automatic wakeup and shutdown [Optional]
- Test MythTV Operation
- Migration Complete
- References
TIP: GNU/Linux Tips |
Backup MythTV Database
In order to later restore access to our existing recordings, we need to make a backup of the MythTV database. The MythTV database backup will contain information about our configuration and recordings, but not the recordings themselves.
When creating the export file, be sure to save the file (or a copy) of the resulting backup someplace that will survive re-installs and/or disk failures. In this example we use the /data/mythtv/db_backups directory. Note that the default location in an unmodified Mythbuntu install is /var/lib/mythtv/db_backups.
- Boot the existing Mythbuntu computer and exit
MythFrontend.
Note that if you are using Mythwelcome auto-wakeup then remember to select Lock shutdown from the Mythwelcome menu to prevent an unexpected shutdown.
- Open a terminal window and create an export of the
existing MythTV database.
/usr/share/mythtv/mythconverg_backup.pl --verbose \
--directory=/data/mythtv/db_backups
Note that this directory likely contains other automatic MythTV database export files. Ours will be the most recent file.
Backup Existing Mythbuntu Operating System Partition [Optional]
This step is optional but highly recommended. By making a backup of the operating system partition we enable the option to restore the Mythbuntu 12.04 partition if needed.
- Boot from live media that contains an image backup
program.
My personal preference is to boot from a CD-RW containing GParted Live. - Locate a folder in a different partition to hold the backup image, or mount a USB drive for this purpose.
- Create an image backup of the Mythbuntu OS
partition /dev/sda1.
My preference is to use fsarchiver which uses the following syntax:
sudo fsarchiver savefs -s 4000 /mnt/Mythbuntu1204os.fsa /dev/sda1
Note the -s 4000 parameter is used to split the image backup into multiple files of 4000 MiB to avoid encountering the FAT32 file system maximum file size of 4 GiB - 1 byte. Personally I used -s 2000 when I ran this command because I did not recall offhand the exact file size limit. - Reformat OS partition.
This is a good time to erase or reformat the Mythbuntu Operating System partition. For those using a Solid State Drive (SSD) the mkfs.ext4 format command has the added benefit of running a trim operation on the drive to enhance performance.
sudo mkfs.ext4 -L mythbuntu1404 /dev/sda1
WARNING: Be sure to pick the correct partition!
The above format command will overwrite the partition with a new file system and any prior data in the partition will be lost.
Install New Mythbuntu Operating System
For people maintaining a single PVR, choose the option
to Install Mythbuntu 14.04 from Live
Media.
If, like myself, you maintain additional PVRs for friends or family
then it can be useful make an image backup of a fresh Mythbuntu
installation after installing Mythbuntu 14.04.1. This image backup
will save time when upgrading the other PVRs. The steps to restore
the image backup are covered under Restore
Pre-Created Mythbuntu 14.04 Image.
Either: Install Mythbuntu 14.04 from Live Media
- Install Mythbuntu 14.04 on Operating System partition.
Follow the Installing Mythbuntu 14.04.1 with MythTV 0.27 instructions, but stop at step U. Create Scheduled Direct Acccount [Optional]. We stop at step "U" because we will be importing the MythTV database settings.
- Skip ahead to Restore MythTV Database.
Or: Restore Pre-Created Mythbuntu 14.04 Image
- Boot from live media that contains an image backup
program.
My personal preference is to boot from a CD-RW containing GParted Live. - Locate a folder containing the image backup, or mount a the USB drive with the image backup.
- Restore the image backup of the new Mythbuntu OS
partition /dev/sda1.
Assuming fsarchiver, the restoration command is as follows:
sudo fsarchiver restfs /mnt/Mythbuntu1404os.fsa id=0,dest=/dev/sda1
- Boot from live media that contains MythBuntu 14.04.1.
- Restore GRUB 2 boot by using the following commands
(as root) in a terminal window:
mkdir /tmp/mydir
mount /dev/sda1 /tmp/mydir
mount --bind /dev /tmp/mydir/dev
mount --bind /proc /tmp/mydir/proc
mount --bind /sys /tmp/mydir/sys
chroot /tmp/mydir
grub-install /dev/sda
exit
- Reboot into Mythbuntu 14.04.1 from the hard drive.
Note if the image is being installed onto different hardware then you will need to wait while the network connection times out. We will fix this in a later step. - Ensure correct display resolution.
- Start Applications -> Settings -> Display
TIP: If the menu is off-screen, you can right-click to access the menu.
- Choose a Resolution from the drop-down list.
- At the prompt Would you like to keep this configuration? click Keep this configuration.
- Close the window.
- Start Applications -> Settings -> Display
- Fix Networking [Required if different
hardware].
- Update ethernet MAC address.
Each network card has a unique MAC address. To account for a different MAC address use an editor to fix the mapping between ethernet name eth0 and the MAC address. The new MAC address will have been mapped to eth1. Delete eth1.
sudo leafpad /etc/udev/rules.d/70-persistent-net.rules
- Ensure unique static IP address [Optional].
If the image uses a static IP address and the computer is on the same network, then edit to change the IP address to a unique number.
sudo leafpad /etc/network/interfaces
- Update ethernet MAC address.
- Update Linux Software RAID [Optional]
If using RAID and this is different hardware, you will need to update the RAID configuration information.
sudo mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Edit /etc/mdadm/mdadm.conf to update the file for the correct RAID identification.
sudo leafpad /etc/mdadm/mdadm.conf
- Edit /etc/fstab to ensure /data is mounted from original
HDD or RAID, and linux-swap has correct UUID.
sudo leafpad /etc/fstab
Note you can use the blkid command (as root) to view UUIDs. - Ensure /data is mounted and linux-swap is active.
sudo mount -a
sudo swapon -a
- Add new Mythbuntu 14.04 streaming directory.
sudo mkdir /data/mythtv/streaming
Adjust Folder Ownership
- Ensure correct new ownership of mythtv.mythtv for
files and folders in /data.
In a terminal window, enter the following command:
sudo chown -R mythtv.mythtv /data
It is important to ensure the correct ownership because different installs of Mythbuntu might use a different number for the mythtv userid or mythtv group.
Restore MythTV Database
- Stop the MythTV backend.
In a terminal window enter the following command:
sudo stop mythtv-backend
- Locate the recently created database export
file.
ls -lt /data/mythtv/db_backups | head
The most recent file is listed at the top with a name in the form:
mythconverg-1299-20141025134231.sql.gz
Note that the date and timestamp is contained in the filename. - Import the previously created export file into the
new MythTV database.
/usr/share/mythtv/mythconverg_restore.pl \
--drop-database --create-database \
--directory=/data/mythtv/db_backups \
--filename=mythconverg-1299-20141025134231.sql.gz
Remember to replace the filename mythconverg... with the one you created previously.
Upgrade and Re-configure MythTV Database
- Start the MythTV backend again.
Start Applications -> System -> MythTV Backend Setup.
When prompted "Warning: MythTV wants to upgrade your database" use the arrow keys to select upgrade, and then press Enter to accept. - Ensure new Mythbuntu storage group streaming
exists and is set to /data/mythtv/streaming.
7. Storage Directories "Streaming" Storage directories /data/mythtv/streaming
- Exit out of MythTV Backend Setup.
Since you've been using MythTV previously I'm confident you know how to exit. ;-) - Start the MythTV Frontend.
Start Applications -> System -> MythTV Frontend.
When prompted "Warning: MythTV wants to upgrade..." use the arrow keys to select upgrade, and then press Enter to accept. - Check Themes are up-to-date.
Setup -> Theme Chooser - Set commercial skip rewind amount.
Setup -> Video -> Playback
On Commercial Skip (8/8) screen:
Commercial skip automatic rewind amount (secs): 1
Navigate through to Finish to ensure settings are saved. - Update CD/DVD device because Mythbuntu 14.04 no
longer uses /dev/dvd.
Setup -> Media Settings -> Music Settings -> General Settings
CD device: /dev/sr0 # was /dev/cdrom
Setup -> Media Settings -> Video Settings -> Player Settings
DVD drive: /dev/sr0 # was /dev/dvd
Setup -> Media Settings -> Archive Files Settings
Location of DVD: /dev/sr0 # was /dev/dvd
- Adjust MythTV web browser text size.
Setup -> Info Center Settings -> Web Settings
Text size: 1.3 # was 1.7
- Configure new default recording rule template.
Manage Recordings -> Recording Rules
Default (Template) Schedule Options: Start Recording 1 minute early End Recording 1 minute late
Re-configure MythTV automatic wakeup and shutdown [Optional]
If you previously configured MythTV to automatically shutdown when
idle and later wakeup to record shows, then ensure that all necessary
scripts and setting exist by following the steps
for Configuring
MythTV Automatic Wakeup and Shutdown.
One key difference is that now Mythwelcome should not be set to
automatically start Mythfrontend.
- Exit to Mythwelcome screen.
- Press i key to bring up settings screen.
- Disable Automatically Start mythfrontend.
- Finish.
Test MythTV Operation
At this point I highly recommending rebooting your Mythbuntu PVR and confirming proper MythTV operation, such as viewing TV shows. In this way you can help ensure that you do not miss any upcoming recordings.
Migration Complete
With the completion of the above steps, you should now have your PVR migrated to the new Mythbuntu 14.04. :-)
References
While migrating my Mythbuntu installation I found the following references useful: