RSS Feed
Jun 19

HowTo: Build a MythTV box from scratch using Ubuntu Jaunty 9.04

Posted on Friday, June 19, 2009 in Tutorials

MythTV is a project that brings analogue and digital television to your Ubuntu-powered PC. It primarily functions as your television and personal video recorder (PVR), but can be made to do many other things (refer to the official MythTV site for more information), however one thing that can catch people is actually building a MythTV box from scratch. Over the years, MythTV has been one of the largest causes of baldness in users who have torn out their hair in frustration.

Nowadays, tailored distributions such as Mythbuntu make the task pretty much trivial, but not everyone likes to use the tailor-made distributions. For one, Mythbuntu has a lot of its own branding across it which I personally don’t really like, and I’d prefer not to have it install all of that plus XFCE as the default desktop and then have to undo it all just to get back to a regular Ubuntu desktop.

Since I recently built a MythTV server for my folks, and on top of that connected it to their aging CRT television rather than the latest in visual technology, this makes for a perfect tutorial on how to take a vanilla Ubuntu Jaunty 9.04 installation and turn it into a simple, functional MythTV server without all the branding. We are going to just install only the components required to get MythTV up and running. Anything else you add is purely up to you.

Note: This tutorial covers installation of MythTV 0.21 as supplied with Ubuntu Jauty 9.04. It does not apply to the forthcoming 0.22 release which will sport a vastly different interface. It is not known yet whether Ubuntu Karmic 9.10 will still have 0.21 supplied or if 0.22 will be ready for release by then.

The system I built for my folks comprised of the following hardware:

  • Silverstone LC17 case (just to match the lounge gear, but you can use pretty much any case)
  • Gigabyte 500w PSU
  • 2GB of Kingston DDR2/800 RAM (should have bought two sticks instead of a single stick, so I could run it in dual-channel mode – ah well, it’s not really a performance killer for MythTV)
  • A Gigabyte S-Series EG41M-S2H motherboard (which has built-in optical out and HDMI based on an Intel gfx chipset)
  • An MSI NX8400GS (NVidia GeForce 8400GS) PCI-E graphics card (because it’s passively cooled for no noise and has Composite/S-Video output as well as VGA and DVI)
  • An Intel E5300 Pentium Dual-Core CPU
  • A Seagate 1TB hard-drive
  • LG SATA DVD-RW optical drive (for playing DVD movie discs)
  • Two Asus MyCinema-U3100-Mini DVB-T digital-only TV tuners
  • Digitech “generic” Windows Media Centre Compatible remote control and USB infra-red receiver (cheaper than the real thing and doesn’t have any Windows or Microsoft branding on it)

I won’t detail the hardware build process since it’s an ordinary PC at the end of the day, but here is how it looks in my folks’ AV cabinet (it’s on the bottom shelf):

Click for full size
Click for full size (126K)

I performed a vanilla Ubuntu Jaunty 9.04 with the following partition layout:

  • 100MB for /boot formatted as EXT2
  • 1GB for swap formatted as SWAP
  • 8GB for / (root) formatted as EXT4
  • Remainder of drive for /home formatted as EXT4

Since I also installed a UPS, I do not foresee any issues with the EXT4 file system and power-loss-related data corruption. I used EXT2 for /boot because, frankly, it doesn’t need journalling there. You’ll only ever write to that partition when you do a kernal update and having as a separate partition will make any future system recovery easier.

My folks are still using an old standard-definition widescreen CRT television. It comes equipped with SCART inputs which can accept Composite, S-Video and Amiga-style RGB signals, but not Component ability. I elected to connect the PC using S-Video, and it looks pretty sharp for what it is – certainly far more readable than Composite.

I came across a strange issue when I started the Ubuntu installation process – it couldn’t start X. Basically put, it cannot detect the “monitor” and thus cannot setup a suitable screenmode. I decided to do the initial installation via a traditional VGA monitor and once the NVidia drivers were installed, I’d switch back to the TV only.

I configured the primary login account, password and machine name to all be “htpc” and set it to auto-login. Once installation was complete and rebooted for the first time, I quickly installed the NVidia Binary driver and updated the system with any outstanding general system updates.

Setting up the TV

Once rebooted for the second time, I physically disconnected the VGA monitor and left only the TV connected. Ubuntu appeared quite cheerfully, though annoyingly it had switched to NTSC 60Hz mode, and I wanted PAL in 50Hz.

I opened up the xorg.conf configuration file into GEdit as follows:

$ sudo gedit /etc/X11/xorg.conf

…and located the “Screen” section which describes what the X screen to be used is. It looks something like this:

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "TwinViewXineramaInfoOrder" "TV-0"
    Option         "metamodes" "nvidia-auto-select +0+0"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

I added the following two lines into that section:

    Option         "TVOutFormat" "SVIDEO"
    Option         "TVStandard" "PAL-B"

…so now the Screen section looked like this:

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "TwinView" "0"
    Option         "TwinViewXineramaInfoOrder" "TV-0"
    Option         "metamodes" "nvidia-auto-select +0+0"
    Option         "TVOutFormat" "SVIDEO"
    Option         "TVStandard" "PAL-B"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

This ultimately outputted a 1024×768 display on the TV, stretched horizontally (a 4:3 screenmode stretched to fit a physical 16:9 display). If your Ubuntu desktop is larger than the screen, just adjust your TV’s picture size until everything fits in. In my case, only the top and bottom panels got slightly chopped off which was fixed with a minor vertical size adjustment on the TV.

Installing MythTV

First we need to enable the system to access the Multiverse repository. Do this by going to System->Administration->Software Sources and place a check mark against all five boxes, click OK and acknowledge the prompt to reload your package lists.

We now set about installing the extra software I required to turn this box into a MythTV server (which was going to run both Backend and Frontend):

$ sudo apt-get install mythtv

That’s all you need to get the main MythTV stuff working – the “mythtv” metapackage installs the MythTV Frontend, MythTV Backend, MySQL Server, MySQL Client, MythTV database configuration, all the default MythTV themes, etc. In my case, however I also installed the following for extra video/audio codecs (such as MP3 for listening to music files or watching movie rips), Java, Flash, the Microsoft Fonts, the Compiz Configuration manager for doing desktop eye-candy, the SSH server daemon to remote control the box when my folks call for help, and finally the MythWeb add-on that allows you to look at the MythTV server’s TV guide and schedule programs to record using a web browser interface:

$ sudo apt-get install mythtv ubuntu-restricted-extras compizconfig-settings-manager ssh mythweb

…and from the Medibuntu repository, I installed the following for extra codecs and DVD decrypting/playback:

$ sudo apt-get install non-free-codecs libdvdcss2 mplayer mencoder

Note: I did not need to install lirc for the remote control because the Digitech remote is actually a USB keyboard in disguise, not a “proper” infra-red remote.

During the installation of these packages, you will be prompted for a few things, namely:

  1. Create a password for the root MySQL account. If this MythTV installation is purely for in-house use only, then just go with something simple like “password”. Many suggest leaving it blank, but I’ve personally seen this create authentication problems later on.
  2. Create the MySQL database. When prompted for the MythTV server address, change the default “localhost” to the IP address of the PC you are installing the Backend on. If the Backend Server has an IP address of 192.168.0.10, then type in 192.168.0.10 in place of “localhost”. If you only intend to run one machine only for everything, then you can leave “localhost” as is.
  3. When prompted for the name of the MySQL database, leave it as the default “mythconverg”.
  4. Make note of the password generated for the MythTV database. You will need this to configure your MythTV Frontend.
  5. Indicate whether or not you intend to have more than one Frontend client connect to your Backend server.
  6. If you elected to install MythWeb, then you will be asked a question as to whether or not you want your MythWeb site password protected.
  7. Acknowledge other prompts that tell you about creating the “MythTV” groups etc.
  8. Your PC now has a user and Home directory called /home/mythtv and we need to ensure that the “mythtv” group can write to it as well as the owner, so at a terminal, type in:
    $ sudo chmod -R g+w /home/mythtv

    …and hit Enter.

  9. Finally, if you intend more than one Frontend to access your Backend machine, we need to tell MySQL to allow other PC’s on your network to access the database, or those Frontends (other than the one on the Backend server) will not be able to start. To do this, type the following at the $ prompt. Everyone else can skip to Step 12.
    $ mysql mythconverg -u root -p
  10. When prompted, enter in the root MySQL password you specified earlier.
  11. You will then be shown a MySQL prompt. If your local network’s IP topology is 192.168.0.x, and the password that was generated for MythTV’s database was “8tSpxGiM” then type the following to grant access to all PC’s on your local network to the MythTV MySQL database, at the “mysql>” prompt:
    mysql> grant all on mythconverg.* to mythtv@"192.168.0.%" identified by "8tSpxGiM";
    mysql> flush privileges;
    mysql> quit
    

    …this will allow all PC’s with IP addresses starting with 192.168.0.x to access the MythTV database. If you are paranoid and only want to allow specific PC’s to access the database, then simply issue the “grant all” line for all explicit IP addresses only, by replacing the “%” wildcard character with the explicit IP address you want to allow, ie: to allow just 192.168.0.67 in, replace “192.168.0.%” with “192.168.0.67″. Repeat for all specific IP’s to allow. You only have to issue the “flush” command once at the end to make your changes take effect.

  12. Confirm that you can access the MythTV database as the MythTV user at the $ terminal prompt. If you are only using one machine, do this on the Backend server. If you are using multiple Frontends, test this on the remote PC’s that will be running the Frontend software (obviously replace the IP address with the actual IP address your Backend machine is using):
    $ mysql mythconverg -h 192.168.0.10 -u mythtv -p

    …when prompted, enter the MythTV password that was generated earlier. If successful, you should be looking at a “mysql>” prompt. If not, you will get an error, probably along the lines of “access denied”. NOTE: If you configured “localhost” to be the Backend Server in Step 2, then you must use the name “localhost” to connect to MySQL. Using “127.0.0.1″ instead will not work because you have not configured “127.0.0.1″ to have access to the mythconverg database. If you wanted these permissions, you would modify Step 11 to be the following commands:

    mysql> grant all on mythconverg.* to mythtv@"192.168.0.%" identified by "8tSpxGiM";
    mysql> grant all on mythconverg.* to mythtv@"127.0.0.1" identified by "8tSpxGiM";
    mysql> grant all on mythconverg.* to mythtv@"localhost" identified by "8tSpxGiM";
    mysql> flush privileges;
    mysql> quit
    

    …which will allow the “mythtv” user to connect from any IP on the 192.168.0.x network, from 127.0.0.1 and any host called “localhost”, all using the specified password.

     
  13. Quit the MySQL client by typing “quit” at the “mysql>” prompt:
    mysql> quit

Configuring MythTV – the Backend

At this point, make sure your TV tuners are connected. In my case, the Asus U3100′s are connected into two free USB ports at the rear of the PC and have automatically been detected as Ubuntu carries full support for the U3100 already.

Now we need to start MythTV Backend Setup for the first time. Go to System->Administration->MythTV Backend Setup. When you do so, it will prompt you that your user (in my case “htpc”) needs to be added to the “mythtv” group. Acknowledge this and then accept being logged out for the change to take effect. Log yourself back in. Once logged back in, restart the MythTV Backend Setup again. You will be reminded that the MythTV Backend needs to be stopped before you can continue. Click OK.

You are presented with several options. Choose “General” (if you are using a remote, you should find the basic Up/Down and OK buttons work here already).

  1. Change the “Local backend” and “Master backend” addresses to be “localhost” (in lower case and one word). Leave all the “port” numerical figures alone.
  2. Click on “Next”. If you’re only using a keyboard, then press ALT + N to proceed. The screen content will change.
  3. Change the “TV format” to suit your local country. In my case, this is “PAL”. If you are in America or Japan, you’ll use “NTSC”. Check your local TV standards if you are not sure.
  4. Change the channel frequency table option to your local country. In my case, this is “australia”.
  5. The timezone for your guide XML data will ultimately depend on how you get your guide data. In my case, I just use Auto.
  6. Click on “Next” or ALT + N on the keyboard.
  7. We don’t need to change anything on this screen or the five screens that follow it, so click on “Next” again until you get to the last page where the button now says “Finish”.
  8. Click on the “Finish” button or press ALT + F on the keyboard. You will be returned back to the main menu.

Now choose the “Capture cards” option.

  1. Choose the “New capture card” option from the list.
  2. What you choose here will be dependent on what your tuner hardware is. In my case, I change the “Card type” until it says “DVB DTV Capture Card (v3.x)” and you will see that the “Frontend ID” will show “DiBcom 7000PC” and the “Subtype” will be “DVB-T” indicating a “Digital Video Broadcast – Terrestrial” device was found.
  3. Click on the “Recording Options” button and ensure that the “Max recordings” option is set to “2″ (most digital tuners can record two channels at once from the same network, thus two physical tuners effectively become four usable tuners within MythTV).
  4. Go back to the previous screen by clicking on Finish and then click on Finish again. You will be returned to the Capture card list and you will now see a new line for the card you just setup.
  5. Since I have two tuners, I repeat this whole process again – the system will pick up the second tuner and label it accordingly – you can’t setup a card more than once accidentally. In my case now I have two cards called DVB:0 and DVB:1 listed.
  6. Press ESC to return back to the main menu.

Now choose the “Video sources” option.

  1. Choose the “New video source” option from the list.
  2. Give your video source a name, eg: “Digital Free-to-Air”. This can be anything you want.
  3. For your Settings Grabber, just choose the “Transmitted guide only (EIT)” or “No grabber” option for now. If you already have a preferred grabber, then choose it here now.
  4. Click on Finish.
  5. We only need one source for both tuners, so we’re done here. Press ESC to return back to the main menu.

Now choose the “Input Connections” option. This is where we tie our source to the tuners.

  1. Choose the first tuner in your list. In my case I have “DVB: 0 (DVBInput) -> (None)”.
  2. Change the “Display Name (optional)” to be something that describes the tuner, eg: “Digital tuner 1″. This can be anything you want and will serve to highlight what tuner you are using to watch or record a particular show.
  3. Change “Video source” to the one you created in the “Video sources” earlier. In my case, I choose the only option I have – “Digital Free-to-Air”.
  4. Now press the “Scan for channels” button.
  5. Ensure that “Scan Type” is set to “Full Scan” and that your Country is correct.
  6. Make sure that your TV aerial is securely connected to your TV tuner and then click on “Next”. The tuner will begin looking for TV channels. This can take several minutes to complete. Do not interrupt the process, even if it looks like it has gotten stuck – it will finish eventually. Any channels found will be listed in the status window at the back.
  7. Once finished, press “Finish”.
  8. Now press “Next”. Don’t change anything here.
  9. Press “Finish”. You will be returned to the “Input Connections” list.
  10. Repeat steps 1 to 3 only for any additional tuners you have (in my case, I had to repeat for the second tuner). We don’t need to re-scan for channels because the tuners are using the same source and we’ve already populated it with channels in the first run. In this instance, once you have done steps 1 to 3, just click on “Next” and then “Finish”.
  11. Press ESC to return back to the main menu.

Now choose the “Channel Editor” option and review all the channels that were picked up in the scan. Optionally, you may also have MythTV automatically download what it believes are the correct network icons for those channels from the Internet using the “Download icons” button. Delete any channels you don’t want to review. Eg: in my case, I also picked up some digital radio channels. I’m not interested in those, so I could delete those if I so choose.

Press ESC to go back to the main menu.

Now choose the “Storage Directories” option. This is where we tell MythTV where to put all our TV recordings.

  1. Choose “Default” from the list.
  2. Choose the “/var/lib/mythtv/recordings” path already defined and change it to “/home/mythtv” (or whatever you prefer).
  3. Click the “OK” button.
  4. If you want to add more directories from other devices such as secondary hard-disks or network drives, just “Add directory” and specify them accordingly.
  5. Once done, press ESC to return back to the main menu.

We’re now done configuring the Backend, so press ESC again to close the MythTV Backend Setup application. If you get an error, review it and see if you can fix it based on the information provided. In particular, if it tells you that it couldn’t write a “.test” file to /home/mythtv, then you did not grant the “mythtv” group writer permissions to “/home/mythtv” (See Step 8 in “Installing MythTV” earlier in this article).

Upon exiting, after a couple of seconds a dialog box will appear asking if you wish to run “mythfilldatabase”. Say YES. Once this is done, the MythTV Backend should automatically restart in the background briefly and then its output window should disappear.

Configuring MythTV – the Frontend

We’re nearly there! Now to configure the Frontend! Go to Applications->Sound & Video->MythTV Frontend. After a brief delay, you will see the default MythTV menu.

  1. Choose “Utilities/Setup” from the menu.
  2. Now choose “Setup” in the next menu.
  3. Now choose “General” in the next menu.
  4. If the PC you are on now is the Backend server, then this should already show that the”Database Server Settings” hostname is “localhost”. If you are installing a laptop/desktop that is NOT the Frontend, then you need to have the IP or hostname of the Backend machine here instead so that Frontend client knows who to talk to. In the case of your installation example, I’m using 192.168.0.10.
  5. The port number can be left empty. It will use the MythTV default automatically.
  6. The database name should already be “mythconverg”.
  7. The user name should already be “mythtv”.
  8. The password should already be the one that was randomly generated during the installation process.
  9. Press “Next”.
  10. Nothing to change on this screen, so press “Next” again.
  11. Change the audio settings to suit your own configuration. If you are using an ordinary stereo setup, you can leave pretty much all of this unchanged, however I’d recommend adjusting the “Master Mixer Volume” to 100 and the “PCM Mixer Volume” to 80 or 90 (don’t set PCM to 100 as some motherboards will output scratchy/distorted audio depending on the quality of your on-board sound hardware).
  12. Press “Next” through the next four screens.
  13. Press “Finish”. You will be returned to the Setup menu.

Special setup: Configuring your MythTV Frontend to output digital audio via SP/DIF on the PC’s motherboard.

  1. By default, motherboards with on-board SP/DIF out generally have their output muted, and as a result you will not see any laser light from any toslink cable connected to the motherboard. Unless you’re lucky, 9 times out of 10, the SP/DIF controls will not appear in the graphical Volume Control applet. To get around this, open a terminal.
    .
  2. Now type in “alsamixer” and you will be presented with a terminal version of the Volume Control applet.
    Click for full size
    Click for full size (56K)
    .
  3. Now press the right-arrow key until you come across any “IEC958″ related options. There will generally be two or three entries. You will probably find they have “MM” above them which means they are Muted.
    Click for full size
    Click for full size (50K)
    .
  4. Press the M key on your keyboard to toggle the Mute status of that option so that it now shows “OO” instead. This means it is no longer muted.
    Click for full size
    Click for full size (51K)
    .
  5. If you’re looking at your toslink cable, you should now see the fibre optic line in it light up with red laser light as you unmute it. You’re done, so press ESC to close the Alsa Mixer interface.

Now choose “Appearance” from the menu.

  1. You can now choose a different theme from here which makes the interface look more attractive than the default theme. My personal favourite is “Blootube” and “Blootube Wide”.
  2. If you are using 3D-enabled video drivers such as the NVidia binary drivers, you can elect to change the Paint Engine to OpenGL which will do nice crossfade transitions from one menu to another (note that there are no 3D transitions).
  3. I also change the “Menu theme” here to “classic” as I believe it provides a more intuitive menu tree within MythTV. I encourage you to explore these options and choose what works best for you.
  4. Page the “Next” button until you get to the end and then click “Finish”.
  5. If you’ve chosen a new theme, it will now be scaled appropriately for your display and switched over.

You are now ready to begin watching TV, but you may want to quickly duck back into Setup->Playback OSD and change the theme there to “Blootube” or whatever you prefer as well as the On-Screen-Display when watching TV has a separate theme setting to the menus.

To watch TV, simply choose “TV” and then “Watch TV” from the MythTV menu. Use the up and down arrow keys and Enter to change channels.

Examples of the Blootube-themed main menu and TV OSD (on a full high definition display):

Click for full size
Click for full size (135K)

Click for full size
Click for full size (384K)

Using MythWeb

MythWeb is completely automatically configured. Using our installation example Backend host IP of 192.168.0.10, you can access it by opening your web browser and surfing over to http://192.168.0.10/mythweb and you will be presented with the main menu of MythWeb.

Being a web site, MythWeb is obscenely easy and self-explanatory to get around, so I won’t detail any of its most common functions here. I encourage you to explore the interface.

Click for full size
Click for full size (99K)

One particularly useful feature of MythWeb is in getting the Digitech generic remote to work. Out of the box, I only found the direction and OK buttons to work right away. All the other buttons generate keyboard presses that do not coincide with MythTV’s default keys. For example, the Play/Pause key on the remote generates “CTRL + P” instead of just “P”, hence MythTV doesn’t act on the button press.

  1. To reconfigure key binds, all you have to do is click on the “Settings” option on the main menu.
    .
  2. Now click on “Key Bindings” in the presented options.
  3. Click for full size
    Click for full size (116K)
    .

  4. You are presented with all the available keybinds for various areas of MythTV. Scroll down the list until you find the keys pertaining to “TV Frontend” (first column).
    .
  5. Now locate the key bind related to “PLAYBACK – Play Program” (second and third columns). You will notice that the key assigned (in the fourth column) already is “P”.
  6. Click for full size
    Click for full size (135K)
    .

  7. To add the CTRL + P key combination without erasing the original “P” key, simply change the text box to read “P, Ctrl+P”. This binds both the P and CTRL + P key combinations to the Playback command.
  8. Change all the other keys you need to change or add.
  9. When done, scroll right to the very bottom of the key binds page and click on the “Save” button.
  10. Restart the Frontend to read in your new changes and test the remote.

This is what the Digitech generic MCE remote looks like:

Click for full size
Click for full size (116K)

OPTIONAL: Setting up the Shepherd Electronic Program Guide (EPG)

Shepherd is an amazing Perl script that enhances and keeps your EPG data up to date in Myth, always providing better information about programs than the networks themselves do. A typical example of a poor network-supplied program description might be “Late Movie: 10:30pm – Pirates of the Carribean starring Johnny Depp” and… that’s it. How boring! Shepherd will use a grading system as well as sourcing categories of data from different sites in order to provide you a comprehensive description of all your programs instead. In the case of the above example, it would go to the IMDB and get the official movie blurb to use instead.

NOTE: Shepherd is geared towards Australian MythTV users only. This is due to long-running (and petty) legal disputes over EPG supply and copyright in this country. If you are outside of Australia, you most likely already have a proper EPG provided for you and you should use that instead.

Setting up Shepherd is trivial (Shepherd was up to version 1.3.39 at the time of this writing – refer to the official installation page for any changes made to the installation process since).

  1. Open a terminal and type in the following:
    $ wget http://www.whuffy.com/shepherd/shepherd

    …and press Enter. This will grab the latest version of the Shepherd Perl script.
    .

  2. Before we run it, we need to install some dependencies:
    $ sudo apt-get install xmltv libxml-simple-perl libjavascript-perl \
    libalgorithm-diff-perl libgetopt-mixed-perl libcompress-zlib-perl \
    libdata-dumper-simple-perl libdate-manip-perl liblist-compare-perl \
    libdatetime-format-strptime-perl libhtml-parser-perl libxml-dom-perl \
    libgd-gd2-perl libdigest-sha1-perl libarchive-zip-perl \
    libio-string-perl libdbi-perl

    …and hit Enter.
    .

  3. Once all that is installed, now run the Shepherd setup script with the command:
    $ perl shepherd

    …and hit Enter.
    .

  4. Shepherd will initially re-install itself into the “mythtv” user’s home directory, ie: /home/mythtv, and re-run itself.
  5. Shepherd will then begin checking itself to ensure all its data grabbers are the latest versions and download any that are missing. It will then prompt you through the rest of the installation process, which is generally straight forward, but we’ll step through it here:
  6. First you are asked for a region code and are shown a giant list. Type in the number relevant to you and hit Enter. Eg: if you lived in Melbourne, Victoria, you would type in “94″ as the code associated with that region. If you were in Sydney, you’d type in “73″ instead.
  7. Next you are asked if you would like Guided Channel Selection. Say YES (or just hit Enter as the default response is yes anyway).
  8. You will then be asked if you have High-Definition TV. If you do use HDTV channels, you should say YES to this.
  9. You are then asked if you have PayTV. If you are only configuring MythTV for Free-to-Air TV, say NO to this.
  10. Now MythTV will ask you to match the known channels for your region to the channels that are setup in your MythTV installation. It will prompt you for each channel one by one. Simply enter the number corresponding to the guide data source you believe belongs to the currently displayed channel, eg: in some country areas, Channel Nine is known as WIN, so any references to “Channel Nine” you would tell Shepherd to use guide data provided by WIN. Repeat this until all channels have been prompted for. You may come across some doubled-up channels. This is normal.
  11. When finished, Shepherd will list all your selections so you can verify them. When you are happy, respond YES.
  12. You will then be asked about transitioning from an old grabber. Since this is a fresh installation, choose the zero (“do not transition”) option.
  13. You will be given one more review and will then be asked if you’d like Shepherd to create a configuration file and update MythTV. Say YES.
  14. When prompted about allowing Shepherd to auto-configure MythTV, say YES.
  15. When prompted for Shepherd to create a symbolic link, say YES.
  16. When prompted about the cron job Shepherd sets up, say YES.
  17. Respond YES to the review question.
  18. Shepherd will then begin testing its components and will eventually ask if you would like to install channel icons. This is not necessary (though you can complete it if you really like), so say NO to this.
  19. Shepherd will finish.
  20. Now we need to populate the EPG using Shepherd for the first time. Note that the initial run can take potentially an hour or more to run depending on your connection and quantity of channels in MythTV to find data for. Once finished, however, each subsequent run (once per hour, 24 hours) should be much faster. To run it for the first time manually, simply type in:
    $ mythfilldatabase

    …and hit Enter.
    .

  21. Depending on the minute that Shepherd setup for the cron job, you may find that as you try to run it manually, Shepherd advises that “another instance is running” and will abort itself. That’s fine – the job’s already started then automatically.
  22. When Shepherd has completed its run, you will find that your EPG within MythTV is now nicely populated with highly descriptive blurbs and will remain so for at least 7-8 days ahead as long as the PC has a connection to the Internet.
12 people like this post.

Bring on the comments!

  1. dono says:

    Brilliantly described, many thanks

  2. Olaf says:

    Great write up. Thanks!

    Can you post your lirc configuration files?

    I initially got a Antec box with a IMON remote and it is just a PITA (non-IR standard, etc…). So I bought a Digitech generic MCE remote. I don’t want to reinstall Myth, but just copy in the /etc/lircd.conf and ~/.mythtv/lircd files and be done with it. Can you help?

  3. HyRax says:

    Re-read my article, especially the “Using MythWeb” part. The Digitech generic remote does not use LIRC. It’s seen by the system as a generic USB keyboard.

    What you need to do is reconfigure MythTV to use the generated keystrokes from the USB receiver.

    If you need to determine what other key combinations the remote generates, use the “xev” tool in a terminal and start punching keys on the remote to see what they generate.

  4. Olaf says:

    Doh! Thanks for the help. Will try it out tonight. Hadn’t heard of ‘xev’. So I’ve learned a few new things today!

  5. Sootie says:

    Hey mate great write up I will be setting up soon and this is of great help (and its for aussies yay) just a question about mythtv, can it play your erm legally acquired TV shows that arent broadcast in australia? if so do you just put them in with your other TV recordings or something?

  6. HyRax says:

    Heya Sootie,

    Your “legally acquired” shows will either be on DVD or in a compressed downloadable format. Neither of which will be regarded by MythTV as a “recorded show” because it isn’t.

    What you can do is use MythTV’s in-built DVD player or install the “MythVideo” plugin which will allow you to browse a specified directory of video files and play them back with your favourite player (which by default is MPlayer).

    As a side note, MythTV can handle almost any type of consumer-available tuner and that includes Satellite and Cable TV cards too. You could happily tune into worldwide TV shows that are broadcast via Satellite and even natively decode Foxtel or Austar with the appropriate hardware and decoder cards.

  7. Doug says:

    Hi,
    I just thought I’d let you know that my Norton Utilities reports that your site contains a Trojan Horse virus.

    Thanks for putting up this data. It was a big help last weekend. Now I just need to get my NVidia stuff going…

  8. HyRax says:

    Hahaha – you’re using Norton’s – ’nuff said. ;)

  9. Lilo says:

    Configured for jaunty using the info beautifully. Great Post.

  10. Pablo says:

    Hi Hyrax,

    This is a great article. Really helpful for me as I’m doing a clean install of Ubuntu 10.04 with MythTV (I bought a new Hard Disk and Blu-Ray drive, so thought I may as well upgrade the whole system at the same time – I did have Myth on 8.04).

    Anyway, the only issue I’m having is, when I’m watching TV, if I try to switch to one of the HD channels (One HD, Gem or 7 Mate), MythTV exits and logs me out automatically. I’m using the Asus U3100 dongles. If you’ve got any idea what might be happening, I’d appreciate your advice …

    Kind regards,

    Pablo.

  11. HyRax says:

    Open a terminal window on your Frontend and monitor the MythTV log with:

    tail -f /var/log/mythtv/mythfrontend.log

    Then startup the MythTV Frontend and try to change channels. Examine the log output to see if there are any obvious clues as to what is failing.

    Also, what version of MythTV are you using? The one supplied in the Ubuntu repositories or MythTV Trunk (latest and greatest)?

  12. Pablo says:

    Thanks for getting back to me so quickly.

    So I thought I’d give Mythbuntu 10.10 a whirl to see if that might do any better. But I’m still getting the same problems with the HD channels.

    Here’s the last few lines from the tail command:

    2010-12-30 19:22:14.011 TV: Changing from None to WatchingLiveTV
    2010-12-30 19:22:14.011 TV: State is LiveTV & mctx == ctx
    2010-12-30 19:22:14.011 New DB connection, total: 3
    2010-12-30 19:22:14.012 Realtime priority would require SUID as root.
    2010-12-30 19:22:14.012 Connected to database ‘mythconverg’ at host: localhost
    2010-12-30 19:22:14.013 TV: UpdateOSDInput done
    2010-12-30 19:22:14.013 TV: UpdateLCD done
    2010-12-30 19:22:14.013 TV: ITVRestart done
    2010-12-30 19:22:14.015 Video timing method: USleep with busy wait
    2010-12-30 19:22:15.124 ProgramInfo(): Updated pathname ”:” -> ’1010_20101230192214.mpg’
    2010-12-30 19:22:15.672 [mp3 @ 0x53df120]Header missing
    2010-12-30 19:22:16.530 VideoOutputXv: XVideo Adaptor Name: ‘NV17 Video Texture’
    2010-12-30 19:22:16.600 AFD: Opened codec 0xb11d85d0, id(MPEG2VIDEO) type(Video)
    2010-12-30 19:22:16.600 AFD: codec MP2 has 2 channels
    2010-12-30 19:22:16.600 AFD: Opened codec 0xabae1e80, id(MP2) type(Audio)
    2010-12-30 19:22:16.709 Opening audio device ‘spdif’. ch 2(2) sr 48000 (reenc 0)
    2010-12-30 19:22:16.710 Opening ALSA audio device ‘spdif’.
    2010-12-30 19:22:16.744 mixer unable to find control Master 1
    2010-12-30 19:22:16.745 NVP(0): Enabling Audio
    2010-12-30 19:22:23.053 ProgramInfo(): Updated pathname ”:” -> ’1001_20101230192222.mpg’
    2010-12-30 19:22:23.057 ProgramInfo(): Updated pathname ”:” -> ’1001_20101230192222.mpg’
    2010-12-30 19:22:23.085 msg: On known multiplex…

    So now I’m using the version of Myth that comes with Mythbuntu 10.10. When I first posted, I had followed your instructions above, so it was the version from the repositories.

    Thanks again!

    Pablo.

  13. Pablo says:

    Oh yeah – the only obvious thing to me from the tail command is that perhaps it’s a sound problem. But why wouldn’t it be able to find ‘control Master 1′?

  14. HyRax says:

    Disable SPDIF output and try normal stereo output. If that works, then we know that it’s trying to open something that doesn’t exist or is under a different name. I would also switch to PulseAudio output rather than pure ALSA.

    I would go back to Ubuntu 10.04 mainly for the reason that it’s an LTS release. 10.10 is only going to be supported for 18 months while 10.04 will be supported for three years on the desktop, thus making the need to rebuild later than sooner. It’s also easier to use MythTV Trunk as there are packages more readily available for Lucid than Maverick.

  15. Pablo says:

    I changed to the following in the settings menu:

    Audio output device: ALSA:analog
    Speakers configuration: Stereo
    Mixer Device: ALSA:default
    Mixer Controls: PCM

    I also muted the SPDIF in alsamixer for good measure.

    Still the same problem (I get logged out when I try to change the channel to the HD channels). Here’s the output from the tail command:

    2010-12-30 20:08:54.984 TV: Changing from None to WatchingLiveTV
    2010-12-30 20:08:54.985 TV: State is LiveTV & mctx == ctx
    2010-12-30 20:08:54.985 New DB connection, total: 3
    2010-12-30 20:08:54.985 Connected to database ‘mythconverg’ at host: localhost
    2010-12-30 20:08:54.986 TV: UpdateOSDInput done
    2010-12-30 20:08:54.986 TV: UpdateLCD done
    2010-12-30 20:08:54.986 TV: ITVRestart done
    2010-12-30 20:08:54.986 Realtime priority would require SUID as root.
    2010-12-30 20:08:54.989 Video timing method: USleep with busy wait
    2010-12-30 20:08:56.378 ProgramInfo(): Updated pathname ”:” -> ’1001_20101230200855.mpg’
    ICE default IO error handler doing an exit(), pid = 5027, errno = 11

    I should have noted that I’m dumping the tail command into a file on my Desktop (i.e. tail -f /var/log/mythtv/mythfrontend.log > ~/Desktop/debug) because of the fact that MythTV logs me out before I get a chance to see the output in terminal.

    Kind regards,

    Pablo.

  16. Pablo says:

    I will give 10.04 a shot. Hopefully this error will go away when I do. Could you direct me to reliable instructions on how to do this install from Trunk?

    Kind regards,

    Pablo.

  17. HyRax says:

    Change the MythTV Frontend audio output to use PulseAudio:Default instead of ALSA.

    The mixer device by default should be /dev/mixer and the Mixer controls set as PCM.

    The best Trunk source is from Jean-Yves Avenard’s repository at http://avenard.com/media/Ubuntu_Repository/Ubuntu_Repository.html

    You do not need to tell the tail command to dump to a file – it’s already reviewing the most recent lines of the original log file located at /var/log/mythtv/mythfrontend.log – if you want to go back and review the entire log in a non-live manner, then use the command:

    less /var/log/mythtv/mythfrontend.log

    The above command will allow you to scroll up and down the log (but not see newly added info until you quit and reopen the log file). Use the forward slash key to search for something eg: /error will search for the word “error”, typing slash and then enter again will search for the next occurrence of “error”, and use Q to quit back to the prompt. Alternatively use gedit to view the file instead of less which will open it into the graphical text editor in read-only mode.

  18. Pablo says:

    Thanks so much for all your help. I’ve now got Myth 0.24 going (used the trunk version) with Ubuntu 10.04. All the channels are working perfectly. So thank you.

    One thing I’m trying to do now (which I had working in previous setup) is ACPI wakeup. I’ve followed the directions found at http://www.mythtv.org/wiki/ACPI_Wakeup#Manually_test_wakealarm very closely, but it just doesn’t seem to shut itself down when I log out. One of the methods for debugging they mention is running mythbackend in the terminal and see what’s happening. When I do, I get output like this repeating itself over and over again for each tuner:

    2011-01-02 00:30:28.115 DVBChan(1:/dev/dvb/adapter0/frontend0) Warning: Opening DVB frontend device failed.
    eno: Device or resource busy (16)

    And at the end of the output it says:

    2011-01-02 00:30:33.849 MythBackend, Warning: No valid capture cards are defined in the database.
    2011-01-02 00:30:33.850 New DB scheduler connection
    2011-01-02 00:30:33.850 Connected to database ‘mythconverg’ at host: localhost
    2011-01-02 00:30:33.852 Enabled verbose msgs: important general
    2011-01-02 00:30:33.853 Failed to bind port 6543. Exiting.
    2011-01-02 00:30:33.853 Backend exiting, MainServer initialization error.

    Have you got any idea what might be happening? It looks like a problem with the tuners, but all the tuners are working fine when I got into the Frontend.

    Thanks again!

    Pablo.

  19. HyRax says:

    Glad to hear it’s all working.

    As for the ACPI issue, I can’t really help you there as I don’t bother putting my system to sleep. Both my Frontend and Backend stay on 24/7 as my Frontend uses less power than a lightbulb anyway and repeatedly starting and stopping my Backend server will use more power than just leaving it on anyway (mostly due to the fact I have six HDD’s in there to spin up and down).

    In general it appears that the tuners are still initialised when the system goes to sleep (ie: control of the USB device is not being released), thus when the system comes back and tries to re-initialise the tuners, it can’t because they are effectively still in use. I used to have a similar problem with my very first Pentium 4 based Backend MythTV server. Turned out there was something wrong with the USB controller on that system and the only way to release USB even with a manual reboot was to perform a physical shutdown and then power on, or to manually unplug and re-plug the tuners back in.

  20. Pablo says:

    That could be the problem here. Even when the computer is off, the U3100s still have their LEDs on (that has always been the case – even with Ubuntu 8.04 and Myth 0.21). Would these errors be causing significant problems with my Backend, or can I just leave it as is and not worry about it? Would it mean the Backend doesn’t enter ‘idle’ mode and therefore would block the ACPI shutdown?

    Cheers,

    Pablo.

  21. HyRax says:

    Well, under normal circumstances, you can just reboot the system and the U3100′s will re-init just fine because the USB sub-system releases them just before reboot.

    In my case I don’t have ACPI sleep enabled, so my system idles fine. Just go turn it off if you have it enabled in BIOS. Of course in general there should be no need for you to reboot. The only time I ever reboot is if I install a newer kernel.

  22. Pablo says:

    I’m wondering … how do you view the name of the files in MythTV 0.24?

    I used to use 0.21 (I think – maybe 0.22) and when I went to the programme details screen, it would show the file name for the program I was looking at. But now when I go to that screen, it’s no longer there. Any idea where I can find it?

    Thanks!

  23. HyRax says:

    Press the Info key twice then scroll down.

  24. Pablo says:

    Legend! Thanks!

Leave a Reply

Spam Protection by WP-SpamFree