read my CV Curriculum Vitae

see all of my publications and conference talks Publications

learn how to make your computer into a video recorder Mythtv guides
How I installed linux on my Compaq Rpictures of friends, family, research, etc. links to my friends, where I work, linux sites, and more links

contact

back to the beginning home

Here are a the steps I took to get mythtv working on my Ubuntu Hardy system.

I upgraded to Hardy in order to get a new kernel working so that I could reliably compile newer v4l-dvb sources in order to get working drivers for my HVR-1250 tuner. In Feisty (7.10) I built my own custom kernels, but unfortunately the drivers wouldn't reliably compile even with the latest kernel from kernel.org because of the way Ubuntu arranges it source tree, which seems to be different from a lot of other distros. All of the custom kernels I used compiled without difficulty and easily booted and worked reliably - just the v4l-dvb code wouldn't compile uder them. I decided that the 2.6.24 kernel in Hardy was new enough, and I was able to compile v4l-dvb under that without issues. This guide is written for myself to remind myself what to do when I either reinstall things, upgrade the OS, or in the event of a system meltdown. Some sections borrow heavily from the documentation available at mythtv.org.

Package Preparation
Here are the packages needed for mythtv that are not installed in ubuntu by default:

  • build-essential
  • libfreetype6-dev
  • libqt3-mt-dev
  • liblame-dev
  • libasound2-dev
  • mysql-server
  • libxxf86vm-dev
  • libqt3-mt-mysql
The following are needed for various mythplugins:
for mythweb:
  • apache2
  • libapache2-mod-auth-mysql
for mythmusic:
  • libmad0-dev
  • libvorbis-dev
  • libflac-dev
  • libcdaudio-dev
  • libcdparanoia-dev
  • libtag1-dev
for mythgallery:
  • libtiff4-dev

Simply do sudo apt-get install <packages> at the command line. Note that dpkg will ask you to enter a root password for mysql during the package installation. Enter it and try to remember it, you will use it to access mysql later.

There were a few other packages that I needed to install on my system because my wife's webpage uses Drupal:

  • php5-gd
  • php5-mysql
  • phpmyadmin

If you plan on using LIRC, then there are now prebuilt binaries in ubuntu also:

  • lirc
  • lirc-modules-source
  • liblircclient-dev
For one of the tuner drivers I wanted to build, I needed:
  • mercurial

Installing mythtv:
There are two ways to install mythtv. One is to use the version found in the ubuntu repositories. Another way is to compile your own from the mythtv sources. I actually prefer the custom compile method because you can install newer versions any time you want. You don't have to wait for ubuntu packages to get updated.

1: download the mythtv sources:
    wget http://ftp.osuosl.org/pub/mythtv/mythtv-0.21.tar.bz2
    wget http://ftp.osuosl.org/pub/mythtv/myththemes-0.21.tar.bz2
    wget http://ftp.osuosl.org/pub/mythtv/mythplugins-0.21.tar.bz2

2: unzip with:
    tar xjf mythtv-0.21.tar.bz2

3: change to mythtv directory and build:
    ./configure
    make -j 2
    sudo make install

4: to install myththemes, unzip it as above, go into the myththemes directory and do
    ./configure
    make -j 2
    sudo make install

5: for mythplugins (mythmusic,mythvideo, etc.) go into the plugin directory and do
    ./configure --disable-mythphone
    make -j 2
    sudo make install
Note that if you're going to want to watch DVDs with your mythtv system, you'll need mythplugins, specifically you'll need mythvideo. It's a good idea to go ahead and install it now in case you want video support in the future, use the same steps as above in the mythplugins directory.
The "-j 2" flag tells the compiler to use multiple threads. This will speed things up on a multicore system. Note also that I optionally set the disable-mythphone flag because I never use that plugin.

6: Once you're done with the install go ahead and make a user called mythtv. You can do so using the users control panel under the gnome administration menu: system/administration/users.

7:
Add both the mythtv user and whatever user you will be logging in as on a regular basis to the mythtv group:
    sudo usermod -G mythtv <user>


Setting up the database:
The mysql database is a fundamental part of mythtv. It has to be set up and working, as well as accessible by the mythtv user before starting the mythtv program. If you want to start a new database do the following:
import the starter database into mysql (execute the following from within the mythtv directory where you just finished the make job):
    cd databse   
    mysql < mc.sql

If you want to restore a previous database from an earlier setup you need to do the following:
    $ mysql -u root
    mysql>create database mythconverg;
    mysql>exit
    $ mysql -u root -p<passwd> mythconverg < mythtv_backup.sql

Grant access to the database for multuiple machines on our network, and simultaneously create the mythtv user inside mysql:
    $ mysql -u root mythconverg
    mysql> grant all on mythconverg.* to mythtv@"localhost" identified by "<password>";
    mysql> flush privileges;
The above lines work if you wish the databse to be accessible only from the local machine that will run mythbackend. If you plan on having more machines access the database, such as multiple frontend machines throughout the house, then you can restrict access to your local network with something like:
    mysql> grant all on mythconverg.* to mythtv@"192.168.1.%" identified by "<password>";
    mysql> flush privileges;
where "%" means that any ip address on your local network is an allowed client machine. Replace 192.168.1 with whatever IP address range your DHCP server uses.

Lastly, run mythtv-setup. You should probably get the drivers working for at least one of your tuners first so that you can add a tuner card to mythtv inside mythtv-setup.


TV Tuner driver installation:
I have three different types of tuners, four tuners total. I outlined how I installed the drivers fo each below.

1: PVR-150's now "just work" with the latest kernel and v4l, no need to configure this card. The drivers for these cards, IVTV, is included in the latest linux kernels now. Whenever this is true, driver configuration becomes a whole lot easier.
The only important thing you need to do is add a tuning command in the input connection setup inside mythtv-setup.
    ivtv-tune -d /dev/video0 -c %
The string "/dev/video0" is a device node that represents your tuner card. "video<x>" device nodes are for analog tuners, like the PVR-150. If you have multiple tuners, yours might have a different device node, it could be video1, etc. Do
    ls /dev/video*
to see how many you have. If the output shows video0, video24 and video32, those all belong to the PVR-150, and you would use video0.  If you have only one tuner and it is a PVR, you can leave out the -d option.

2: HVR-950 and Pinnacle HD pro stick:
update:
these tuners should now work out of the box with linux kernel 2.6.26 and higher. If you want to avoid the configuration below, install a distro with the mentioned kernel version. You will only need to do the firmware steps outlined in method 2a below. No compiling of driver trees is necessary.

There are two ways to install drivers for these two usb tuners. They are both digital tuners that can record over the air ATSC in North America. The do not record clear QAM. The first way to install the drivers is to use the em28xx drivers from Markus Rechberger.
    wget http://mcentral.de/empiatech/distris/ubuntu/hardy/empia-2.6.24-16 generic-2_i386.deb
    sudo dpkg -i empia-2.6.24-16-generic-2_i386.deb
The only thing to look out for with these drivers is that they are built for kernel 2.6.24-16. If you are using a later kernel you will want to copy these over to the current kernel after installation:
    sudo rm -r /lib/modules/`uname -r`/kernel/drivers/media/video/em28xx
    sudo cp -a /lib/modules/2.6.24-16-generic/empia /lib/modules/`uname -r`/
Power down, connect the tuner, and reboot.
Markus is updating these drivers fairly rapidly, so there would be no point for me to coninutally update this page with updated versions of his drivers. Your best bet is to go to www.mcentral.de and check what the latest version is, and install that. His work on these drivers has been very digilent. I was able to use these tuners long before they became functional with v4l-dvb, thanks to Markus.

2.a: Altnerate install method:
Download and install the latest v4l-dvb drivers from linuxTV. This is where you need to have mercurial installed. The command "hg" is included in the mercurial package. It's simply yet another source code management program like cvs or svn.
    hg clone http://linuxtv.org/hg/v4l-dvb
    cd v4l-dvb
    make -j 2
    sudo make install
reboot and connect the tuners.
Also, install dvb-apps:
    hg clone http://linuxtv.org/hg/dvb-apps
    cd dvb-apps
    make
    sudo make install
This method was advantageous for me becuase it also included the driver for my HVR-1250 tuner above. However, if you go this route, you also need to install the firmware for these cards, as outlined on the dvb wiki.
    wget http://www.steventoth.net/linux/xc5000/HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip
    unzip -j HVR-12x0-14x0-17x0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys
run the extract_xc3028.pl script found in linux/Documentation/video4linux:
    ./extract_xc3028.pl
Copy the newly extracted firmware to the firmware directory so the driver can find it:
    cp xc3028-v27.fw /lib/firmware
That's it! It should work now if you plug in the tuners and do depmod -a, or just reboot. All I can say is, thanks to the guys at linuxTV and v4l-dvb. I've had personal contact with them and tested a patch for one of the developers. They are fast at patching things and are willing to help you debug things very quickly and efficiently. I'm grateful for the whole linuxTV project.

HVR-1250:
The good news is, if you used method 2.a above, then this card is already functional and working! If you didn't, the install is very easy, simply do the following:
    hg clone http://linuxtv.org/hg/v4l-dvb
    cd v4l-dvb
    make -j 2
    sudo make install
That's it!

Caveats:
Warning: if you are using Markus Rechberger's driver for em28xx, then you want to install the v4l-dvb drivers for your HVR-1250 card first. Otherwise, if you install Markus's, and then install v4l-dvb for the HVR-1250, you will overwrite the mcentral.de drivers with the v4l-dvb ones. Be advised that the two different driver versions use slightly different firmwares.

LIRC Configuration:
If you've never had LIRC working before, go to lirc.org and read the short documentation on how to get it working. It's very simple, and there's no point in me reproducing it.
if using the serial IR receiver then load module lirc_serial
if using the PVR_150 IR receiver then load module lirc_i2c
put the module in /etc/modules to get the module loaded on startup
Then install the lircrc generator:
    sudo apt-get install mythbuntu-lirc-generator
    mythbuntu-lircrc-generator
Note the subtle difference in program and package name. This will install an lircrc file for mythfrontend inside the .lirc directory in your home directory. I've edited this and another file for irexec for running scripts manually. I made an lircd.conf file long ago. Here are a couple of examples: lircd.conf, lircrc


Pulse Audio in Ubuntu:
I found this bit of useful information online on the mythtv wiki. Unfortunately I didn't copy the web address and cannot find it again, hence am unable to give proper credit. However, it's important for me to preserve this info here for myself.
As many of you have probably heard, Hardy will be using PulseAudio by default to get a unified sound server going. MythTV does not yet work with PA; however, here's a configuration file you can change to make it.
Open up your /etc/pulse/default.pa and on line 32 make the following change:
    #load-module module-alsa-sink
to
    load-module module-alsa-sink device=plug:dmix
After logging out and back in, you should be able to get sound out of MythTV again. This did workl for me as well as the original person who posted this info.

Get mythweb working:
In the mythplugins directory, there is a subdirectory called mythweb. Copy it to /var/www
    sudo cp -r mythweb /var/www
    sudo chgrp www-data /var/www/mythweb/data
    sudo chmod g+rw /var/www/mythweb/data
Then make a .htaccess file in the base mythweb directory with the following in it (check if it isn't there
already from old installs):
        #  Here is my own section that password protects mythweb:
        AuthUserFile    /etc/apache2/apache-passwords
        AuthName        MythWeb
        AuthType        Basic
        require         valid-user
Then creat a valid password file to log into mythweb:
     sudo htpasswd -c /etc/apache2/apache-passwords <user>


system configuration:
  • Distro: Ubuntu Hardy (8.04)
  • myth version: 0.21
  • cpu: AMD Athlon X2 3800+
  • mobo: Asrock 939 dual sata2
  • RAM: 2 GB DDR400
  • video: Nvidia FX5200 (fanless); using VGA output
  • sound: onboard realtek AC97
  • NIC: Sis 900 ethernet card (PCI)
  • storage: WD 640GB + Maxtor 80GB drives
  • tuner1: Pinnacle PCTV HD Pro USB Stick (usb tuner)
  • tuner2: Hauppauge WinTV HVR-950 (usb tuner)
  • tuner3: Hauppauge WinTV HVR-1250 (PCIe tuner)
  • tuner4: Hauppauge PVR-150 (PCI tuner)
  • case: Antec Sonata 2
  • remote: Sony universal learning remote with IR keyboard receiver