Linux Crumbs
Simbiotic - A Cyberpunk Thriller Novel

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.

The steps in this tutorial will preserve the recordings only if the recordings are stored in a partition separate from the operating system partition.

If the recordings are stored in the same partition as the operating system then these recordings will be lost when the partition is overwritten with the new Mythbuntu version.

In my case, I have my recordings stored in a separate RAID partition /dev/md0p1 mounted at /data.

This tutorial assumes your Mythbuntu system is set up similar to the following:


    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

TIP:   GNU/Linux Tips

This tutorial assumes a moderate level of experience with GNU/Linux. Following are some quick reminder tips.

To learn the device path used for a removable device:

Plug in a USB drive, run the dmesg command, and scan the output for the path (for example, /dev/sdd).

To mount device partition /dev/sdd1 on folder /mnt:

sudo mount /dev/sdd1 /mnt

To unmount folder /mnt:

sudo umount /mnt

To learn the UUID for partition /dev/sda2:

sudo blkid /dev/sda2

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.

  1. 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.

  2. 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.

  1. Boot from live media that contains an image backup program.

    My personal preference is to boot from a CD-RW containing GParted Live.
  2. Locate a folder in a different partition to hold the backup image, or mount a USB drive for this purpose.
  3. 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.
  4. 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

  1. 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.

  2. Skip ahead to Restore MythTV Database.

Or: Restore Pre-Created Mythbuntu 14.04 Image

  1. Boot from live media that contains an image backup program.

    My personal preference is to boot from a CD-RW containing GParted Live.
  2. Locate a folder containing the image backup, or mount a the USB drive with the image backup.
  3. 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
  4. Boot from live media that contains MythBuntu 14.04.1.
  5. 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
  6. 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.
  7. Ensure correct display resolution.

    1. Start Applications -> Settings -> Display

      TIP:   If the menu is off-screen, you can right-click to access the menu.

    2. Choose a Resolution from the drop-down list.
    3. At the prompt Would you like to keep this configuration? click Keep this configuration.
    4. Close the window.
  8. Fix Networking [Required if different hardware].

    1. 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

    2. 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
  9. 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
  10. 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.
  11. Ensure /data is mounted and linux-swap is active.

    sudo mount -a
    sudo swapon -a
  12. Add new Mythbuntu 14.04 streaming directory.

    sudo mkdir /data/mythtv/streaming

Adjust Folder Ownership

  1. 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

  1. Stop the MythTV backend.

    In a terminal window enter the following command:

    sudo stop mythtv-backend
  2. 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.
  3. 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

  1. 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.
  2. Ensure new Mythbuntu storage group streaming exists and is set to /data/mythtv/streaming.
        7.  Storage Directories
              "Streaming" Storage directories
                   /data/mythtv/streaming
        
  3. Exit out of MythTV Backend Setup.

    Since you've been using MythTV previously I'm confident you know how to exit. ;-)
  4. 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.
  5. Check Themes are up-to-date.

    Setup -> Theme Chooser
  6. 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.
  7. 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
  8. Adjust MythTV web browser text size.

    Setup -> Info Center Settings -> Web Settings

    Text size: 1.3   # was 1.7
  9. 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.

  1. Exit to Mythwelcome screen.
  2. Press i key to bring up settings screen.
  3. Disable Automatically Start mythfrontend.
  4. 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:

The Medusa Deception novel - free first in series
News   Documentation     Copyright (c) 2013-2024 Curtis Gedak

Get GParted at SourceForge.net. Fast, secure and Free
	Open Source software downloads Valid HTML 4.01! Correct CSS!