Mythbuntu12.04
This page records the setup of Mythbuntu [1] a standalone media PVR suite based on MythTV [2]
Hardware
- Streacom FC9 Black Full Aluminium Fanless Chassis
- Gigabyte GA-Z87MX-D3H LGA1150 Micro ATX Motherboard
- Intel 4th Gen Core i7 4770 3.4GHz 84W HD4600 8M Quad Core CPU
- Corsair 16GB (2x8GB) Vengeance LP DDR3 Memory
- picoPSU 160W picoPSU and AC/DC adapter block
- Intel 80GB 335 Solid State Drive SSD
- 2 off WD Green Power WD20NPVX 2TB 2.5in HDD OEM
- Streacom ST-OB2 Slot-Load Blu-ray Drive for Streacom Chassis
- Streacom Internal IR Receiver and Remote Control
- TBS 6280 Dual Freeview HD Low-profile PCIe TV Tuner Card DVB-T2
- TBS 6981 Dual Satellite HD Low-profile PCIe TV Tuner Card DVB-S2
This machines memory and CPU is overkill even for HD TV, the important things are that there is at least one TV tuner source and ample storage space for recordings.
Installation
Firstly identify the architecture of your PC, most CPUs these days (2013) are 64Bit. Head over to the download page [3] and download the required iso file. This guide covers the installation of Mythbuntu12.04 on to a vanilla system, that is an entirely fresh install using mythbuntu-12.04.3-desktop-amd64.iso. Basic Installation is straightforward but is somewhat dependent on you hardware and BIOS settings. This system is connected to a SHARP Aquos TV via an HDMI cable with a USB keyboard and mouse and connected to the internet and my network via an ethernet cable.
- Burn the ISO to a DVD
- Install and boot the PC from the ISO
- Select 'Install Mythbuntu'
- Select the Drive to install the OS too. I used the SSD drive and disabled LVM so i can mount the main storage myself later.
- Select country, timezone, keyboard etc. This is all the normal questions, pay special attention to the following
- enable the check box to install 3rd party software that is not Open Source.
- if you intend to remotely connect to your system during setup, ensure VNC and SSH service are enabled
Once installation is complete the PC will ask you to remove the DVD and press Enter
to reboot the machine.
System Setup
Objectives
- Demonstrate HD TV, both live recording
- Configure TV listings using XMLTV
- Control the system with the IR Remote
Since this system is replacing my currently deployed HD-PVR I will also be transfering existing MythTV database and SD recordings to the new system.
Update the System
Once your PC has rebooted it should autologin with the default user and launch the MythTV Frontend. Note
Using the Update Manager or Terminal update the system, you will need to authenticate using the password of the user created during installation.
$ sudo apt-get update $ sudo apt-get upgrade $ uname -a Linux BlueMidget 3.8.0-30-generic #44~precise1-Ubuntu SMP Fri Aug 23 18:32:41 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Mythbuntu Control Center
Launch the Control Center from Applications/System/Mythbuntu Control Center
Work through each of the sections selecting the prefered options, in this first pass I'm only interested in
- Graphics Drivers, this wizard will assist in the installation of proprietary drivers for your GPU which can significantly improve performance. On my systems i'm using the embedded Intel GPU which isn't identified so I'm using the stock drivers.
- Repository. This is where you can select which version of MythTV you want to run, the default is v0.25. V0.26 is stable and V0.27 is experimental. I selected V0.26 and added both the Mythbuntu and XMLTV repos.
- Infrared, this allows you to select enable any remotes for your system. I have a Windows Media Center compatable Receiver and Remote.
After applying any changes it is important to update the system again if you've changed MythTV versions.
$ sudo apt-get update $ sudo apt-get dist-upgrade
If you use the above SSH you will be presented with the following prompts
After a further reboot, the database will be updated.
My system requires access to a NAS for media files, backup etc. I use the method defined here Accessing_Network_Shares.
$ sudo apt-get install autofs cifs-utils
don't forget
- create creds file
$ nano ~/cifs.cred
- add NAS IP and hostname to
/etc/hosts
Mounting Addition HardDrives
There are numerous methods for doing this but the follwing is my prefered solution.
Use UUID To Mount Partitions
Identify the hard drive device in you PC.
$ sudo lshw -class disk *-disk description: ATA Disk product: WDC WD20NPVX-00E vendor: Western Digital physical id: 0.0.0 bus info: scsi@0:0.0.0 logical name: /dev/sda version: 01.0 serial: WD-WXB1AA3V5194 size: 1863GiB (2TB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 signature=11a7d569 *-disk description: ATA Disk product: WDC WD20NPVX-00E vendor: Western Digital physical id: 0.0.0 bus info: scsi@2:0.0.0 logical name: /dev/sdb version: 01.0 serial: WD-WXB1AA3V2082 size: 1863GiB (2TB) capabilities: partitioned partitioned:dos configuration: ansiversion=5 signature=11a7d565
Mine are /dev/sda /dev/sdb
Use fdisk
to manually create single large partitions and format to ext4 [4].
Find the UUID of each partition
$ sudo blkid -o full -s UUID /dev/sda1: UUID="dd3e3288-eb4a-48f3-a1c4-42043b96f645" /dev/sdb1: UUID="61d71482-8a81-469c-ae12-d0b539335fc2"
Add the mountpoints
$ sudo mkdir /media/disk01 $ sudo mkdir /media/disk02
Add the following to the end of fstab. [5]
UUID=dd3e3288-eb4a-48f3-a1c4-42043b96f645 /media/disk01 ext4 rw 0 0 UUID=61d71482-8a81-469c-ae12-d0b539335fc2 /media/disk01 ext4 rw 0 0
Mount the drives and make the writable.
$ sudo mount -a $ sudo chown jack:jack /media/disk01/ $ sudo chown jack:jack /media/disk02/
Restoring Old Database
This is only required if your porting a database from and existing system or restoring after a rebuild, see Database Backup and Restore for details. [6]
Backup the existing database in case anything goes wrong
$ /usr/share/mythtv/mythconverg_backup.pl
Check the database is created
ls -l /var/lib/mythtv/db_backups/ -rw-r--r-- 1 root mythtv 39832 Sep 6 19:09 mythconverg-1299-20130906190902.sql.gz -rw-r--r-- 1 mythtv mythtv 47373 Sep 7 14:36 mythconverg-1299-20130907133615.sql.gz -rw-rw-r-- 1 mythtv mythtv 49280 Sep 7 14:36 mythconverg-1307-20130907133652.sql.gz -rw-rw-r-- 1 mythtv mythtv 50022 Sep 7 18:41 mythconverg-1307-20130907184143.sql.gz
Copy the original database from its location to the default '/var/lib/mythtv/db_backups/'
$ cp /media/nfsshares/mythtv_db_backups/mythconverg-1264-20130907185125.sql.gz /var/lib/mythtv/db_backups/
Stop the backend:
$ sudo stop mythtv-backend
Obtain the mythtv password from here:
$ grep DBPassword /etc/mythtv/config.xml <DBPassword>JHxeUhn0</DBPassword>
Restore the original system database to the new system using:
/usr/share/mythtv/mythconverg_restore.pl --drop_database --create_database --directory /var/lib/mythtv/db_backups --filename mythconverg-1264-20130907185125.sql.gz
At this stage your system is fragile. You must do the following
- Run
mythtv-setup
and allow the schema to be upgraded - Check the setting in mythtv-setup, in particular the IP address of the backend etc.
If you reboot the system and the frontend get stuck in a crash / reload loop, Kill the frontend using
$ sudo killall mythfrontend $ sudo killall mythfrontend.real
Ensure both the front and backends are at version 75 shown by:
$ mythfrontend --version xprop: unable to open display '' Please attach all output as a file in bug reports. MythTV Version : v0.26.1-14-gdbdd455 MythTV Branch : fixes/0.26 Network Protocol : 75 Library API : 0.26.20130225-1 QT Version : 4.8.1 Options compiled in: linux profile use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_bindings_php using_crystalhd using_dvb using_firewire using_frontend using_hdhomerun using_ceton using_hdpvr using_iptv using_ivtv using_joystick_menu using_libcec using_libcrypto using_libdns_sd using_libxml2 using_lirc using_mheg using_opengl_video using_qtwebkit using_qtscript using_qtdbus using_v4l2 using_x11 using_xrandr using_xv using_bindings_perl using_bindings_python using_bindings_php using_mythtranscode using_opengl using_vaapi using_vdpau using_ffmpeg_threads using_live using_mheg using_libass using_libxml2 $ mythbackend --version Please attach all output as a file in bug reports. MythTV Version : v0.26.1-14-gdbdd455 MythTV Branch : fixes/0.26 Network Protocol : 75 Library API : 0.26.20130225-1 QT Version : 4.8.1 Options compiled in: linux profile use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_bindings_php using_crystalhd using_dvb using_firewire using_frontend using_hdhomerun using_ceton using_hdpvr using_iptv using_ivtv using_joystick_menu using_libcec using_libcrypto using_libdns_sd using_libxml2 using_lirc using_mheg using_opengl_video using_qtwebkit using_qtscript using_qtdbus using_v4l2 using_x11 using_xrandr using_xv using_bindings_perl using_bindings_python using_bindings_php using_mythtranscode using_opengl using_vaapi using_vdpau using_ffmpeg_threads using_live using_mheg using_libass using_libxml2
After the database schema is updated, the hostname needs to be changed.
/usr/share/mythtv/mythconverg_restore.pl --change_hostname --old_hostname="mr-flibble" --new_hostname="BlueMidget"
If there are other changes to file and folder structures these need to be all changed before any fronends are connected to the restored backend. I can never get this to work satisfactorily.
Alternative Approach to Database Backup
It seems I can never port an old system and the database sucessfully, usually there's a conflict with some setting or I've restructured the support systems. Either way, one possible way to export all your recording and reimporting them as videos without changing the can done using mythlink.pl[7].
- run mythlink to create simlinks on our old backend.
- cp the simlinks to a backup drive, NAS or other external media with plenty of space. When copied the simlink will retain the folder and name structure from mythlink making the filenames user readable.
- Import the old recording into the video folder
Install TV Card Drivers
The TV cards in the system require drivers to be compiled in to the kernel, which means this needs to be repeated each time theres a kernel update.
$ lspci | grep media 01:00.0 Multimedia video controller: Conexant Systems, Inc. CX23885 PCI Video and Audio Decoder (rev 04) 02:00.0 Multimedia controller: Philips Semiconductors SAA7160 (rev 03)
Installing the drivers [8].
$ cd ~ $ wget http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v130802.zip --2013-09-07 20:58:24-- http://www.tbsdtv.com/download/document/common/tbs-linux-drivers_v130802.zip Resolving www.tbsdtv.com (www.tbsdtv.com)... 143.95.60.2 Connecting to www.tbsdtv.com (www.tbsdtv.com)|143.95.60.2|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 16296304 (16M) [application/zip] Saving to: `tbs-linux-drivers_v130802.zip' 100%[======================================>] 16,296,304 1.27M/s in 22s 2013-09-07 20:58:46 (731 KB/s) - `tbs-linux-drivers_v130802.zip' saved [16296304/16296304] $ mkdir tbs-linux-drivers $ cd tbs-linux-drivers $ sudo apt-get install unzip $ sudo apt-get install build-essential $ unzip ../tbs-linux-drivers_v130802.zip
The instructions for the continued installation are in the readme file README_TBS6981
.
Extract linux-tbs-drivers.tar.bz2 archive:
$ tar xjvf linux-tbs-drivers.tar.bz2
The permissions of the tarball are wrong, this can be corrected using
chmod -R 755 .
The build script needed is depending on your kernel version. Determine the kernel version using:
$ uname -a 3.8.0-30-generic #44~precise1-Ubuntu SMP Fri Aug 23 18:32:41 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
for any x86_64 kernel (x86 64 bit installations of Linux):
$ cd linux-tbs-drivers/ ~/tbs-linux-drivers/linux-tbs-drivers $ ./v4l/tbs-x86_64.sh TBS drivers configured for x86_64 platform.
Build and install the driver:
$ make $ sudo make install
Reboot in order to load the newly installed driver:
$ shutdown -r now
After reboot check that the newly installed driver is loaded correctly:
$ dmesg | grep frontend
If everything is OK, the output from the above command lists the registered frontends for your card model and their number is equal to the number of tuners on the card, for example:
DVB: registering adapter 0 frontend 0 (TurboSight TBS 6981 DVBS/S2 frontend)... DVB: registering adapter 1 frontend 0 (TurboSight TBS 6981 DVBS/S2 frontend)...
If its not ok you'll get something like
[ 1.355497] videobuf_dvb: disagrees about version of symbol dvb_frontend_deta ch [ 1.355498] videobuf_dvb: Unknown symbol dvb_frontend_detach (err -22)
To fix it...
sudo rm -R /lib/modules/$(uname -r)/kernel/drivers/media sudo make install sudo reboot
Try again!
$ dmesg | grep frontend [ 2.087311] DVB: registering adapter 0 frontend 0 (TurboSight TBS 62x0 DVBT/T2 frontend)... [ 2.174999] DVB: registering adapter 1 frontend 0 (TurboSight TBS 62x0 DVBT/T2 frontend)... [ 2.676974] cx23885_dvb_register() allocating 1 frontend(s) [ 2.760952] DVB: registering adapter 2 frontend 0 (TurboSight TBS 6981 DVBS/S2 frontend)... [ 2.787563] cx23885_dvb_register() allocating 1 frontend(s) [ 2.867740] DVB: registering adapter 3 frontend 0 (TurboSight TBS 6981 DVBS/S2 frontend)...
Success.
Audio and Video Setting
In the MythtvFronend selection the Setup/Setup Wizard, follow the simple instructions to select and test your audio and video.
My system which uses an Intel GPU supports Audio over HDMI and VA-API[9]
Adding Tuner Cards
Application/System/MythBackendSetup
, the backend will have to be stopped before you can continue, agree to the prompt and authorise it with your password.
General
Follow the wizard, the defaults are fine, just make sure you set the IP address and select the correct TV Format for the region.
Capture Cards
Follow the prompts and add your cards, these should be auto detected if the drivers were properly installed Mythbuntu12.04#Install_TV_Card_Drivers
Video Sources
My prefered video source is to use XMLTV, use the following [10]
Figure Gallery
Epinephelus lanceolatus (Giant grouper)
Pterois volitans (Red Lionfish)
Macropodus opercularis (Paradise fish)
Psetta maxima (Turbot)
References
- http://www.mythbuntu.org/
- http://www.mythtv.org/
- http://www.mythbuntu.org/download-type
- http://www.yolinux.com/TUTORIALS/LinuxTutorialAdditionalHardDrive.html
- http://www.cyberciti.biz/faq/linux-finding-using-uuids-to-update-fstab
- http://www.mythbuntu.org/upgrading
- http://linuxtv.org/wiki/index.php/TBS6280
- http://linuxtv.org/wiki/index.php/TBS6280
- http://en.wikipedia.org/wiki/Video_Acceleration_API