MythTV on Xebian HOWTO

From Xbox-Linux

Instructions to setup a mythtv frontend on a Xebian 1.1.4 Base. It will install 0.20.2 MythTV release.

Table of contents

E: Images

For those of you that are too lazy to follow these instructions and just want to boot into a mythfrontend enabled xebian install, you can download the E: Images that I put together at the following site. Download the 300MB image and then follow the installation instructions at the following site: http://mythtv.org/wiki/index.php/Xbox_Install_using_E_Images


Full Install Guide

A full, up to date (as of Feb 2008) guide on installing and configuring both Xebian and MythTV Frontend 0.20.2 is available in the MythTV wiki at http://mythtv.org/wiki/index.php/Xbox_Frontend_on_Xebian_stable which uses info from both the following guide and a HowTo (http://forums.xbox-scene.com/index.php?showtopic=493690) available on the xbox-scene website.

Assumptions

  1. Xebian has already been installed (xebian-xbox, xebian-basic is not sufficient).
  2. Mythbackend is installed somewhere else on the network.
  3. Xbox has access to the network.
  4. Make sure your mythbackend is configured with an IP not the default 127.0.0.1. You change this in mythsetup.

Xebian Post Install

Package Sources Configuration

Append the following to your /etc/apt/sources.list

 deb http://yoeu.net/debian sarge main
 deb http://alexfisher.me.uk/debian sarge main
 deb ftp://ftp.sunet.se/pub/os/Linux/distributions/debian-multimedia/ sarge main

Since the release of 'etch' you'll also want to change the references in the existing repositories from 'stable' to 'sarge' or 'oldstable' depending on the repository.

As of 3rd February 2008 the yoeu.net repository appears to be down. Instead you can use:

 deb http://debian-multimedia.fx-services.com/ sarge main

Time configuration

As root, run

 tzconfig

Actually, I think what we really want is to run ntpdate on startup:

 cd /etc/rc2.d/
 ln -s ../init.d/ntpdate S24ntpdate

Install MythTV


Use apt-get to install it

 apt-get update
 # There's a bug here in the installer
 mkdir /etc/mythtv/
 chmod 777 /etc/mythtv/
 apt-get install mythtv-frontend
 # Optionally you can install the plugins
 apt-get install mythgallery mythvideo mythmusic mythnews mythweather mythtv-themes

Now, you will probably want to make sure that your new xbox mythfrontend can connect to your master backend's sql server; this is critical. To test this, do the following:

 mysql -h <masterbackendhostname> -u live -p mythconverg

where <masterbackendhostname> is the hostname that you gave your master backend MythTV server, obviously. If you connect successfully, you should see a MySQL prompt. Type

 quit;

and move on. If you can't connect, you need to stop here and fix this problem on your MythTV master backend. Typically, you will need to add the "live" user from your <xboxhostname> as a permitted user on the backend sql server. You might also need to edit /etc/mysql/my.cnf on your backend server to bind to the server's IP, rather than the loopback address, and in that same file, make sure that skip-networks is not enabled. [A link is forthcoming to explain this more thoroughly]

More info on allowing a frontend to connect:

On the backend do this changing the apropos items-

[root@tv yum.repos.d]# mysql -u root -p -h localhost
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.16
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>  GRANT ALL PRIVILEGES ON *.* TO 'live'@'192.168.0.151' IDENTIFIED BY 'secretmagicpasswd' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye

If you have a recent version of MythTV on the backend with MySQL 5.0 installed, you may see the following error when connecting:

ERROR 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client

You can get around this by updating the password to the old style by running

mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('secretmagicpasswd') WHERE User = 'live';

Alternately, if that doesn't work, try:

SET PASSWORD FOR 'live'@'xbox_host' = OLD_PASSWORD('secretmagicpasswd');

I do not recommend simply updating the mysql client on your xbox as mythtv may be statically linked against the older version. For more information see http://dev.mysql.com/doc/refman/5.0/en/old-client.html

For smoother video playback, you might also want to make the front end suid root:

 chmod +s /usr/bin/mythfrontend

There are security issues with doing this, but as my box is behind a hardware firewall, I don't worry about it too much. If my firewall has been breached, I have many worse things to worry about.

Install x11vnc (optional)

x11vnc will allow you to vnc into the xbox so that you can control the desktop.

 apt-get install x11vnc

Setup the Remote

If you are using the XBox DVD Kit remote, Xebian already has much of the support done for you. The only thing you will need to do is set up mappings between the remote keypresses and the appropriate keyboard strokes for MythTV. For instructions on getting the generic cheap remotes working see the reference section below.

To do this, download the appropriate lircrc file, and place it in the appropriate locations:

 cd /tmp
 mkdir lirc_temp
 cd lirc_temp
 wget http://bit.blkbk.com/mythtv-xbox.0.4.5-beta.tar.gz
 tar xpzvf mythtv-xbox.0.4.5-beta.tar.gz   
 cp live/lircrc /home/live/.lircrc
 mkdir /home/live/.mythtv
 chown live:live /home/live/.mythtv
 ln -s /home/live/.lircrc /home/live/.mythtv/lircrc

Thanks to bone450 at http://www.mythtv-xbox.org/phpBB/viewtopic.php?p=137&sid=16710226c1177c3d6dbae3af9753978b for the tip.

Configure AutoStartup

Here we are going to configure fluxbox to startup both the mythtv frontend and x11vnc automatically.

Edit your /home/live/fluxstartup.sh file, and add the following somewhere after the xtdesk line:

 # I don't think you need the dpms line since the frontend will do it for you
 /usr/bin/X11/xset -dpms
 /usr/bin/X11/xset s off
 irexec &
 mythfrontend &


Alternative Method

Create this file (as user live): /home/live/bin/go.myth

 #!/bin/bash -x
 (while true; do x11vnc; sleep 5s; done ) &
 (while true; do mythfrontend; sleep 5s; done ) &

Also remember to make it executable (chmod 755 /home/live/bin/go.myth).

Create this file: /home/live/.fluxbox/apps

 [startup] {/home/live/bin/go.myth}
 [app] (mythfrontend)
   [Deco]        {NONE}
 [end]

To test autofrontend startup, kill X and have it restart. If you install x11vnc, you should be able to VNC into the box to interact with the Xwindows desktop.

NOTE: In my testing, there seems to be a problem with the first startup of mythfrontend. I had to kill it at least once and rerun it to get the configuration to stick. I don't know what was the problem.

Configuring system to shutdown from frontend

If you are running as root, it should just work, however, if running as live you can do the following:

 chmod +s /sbin/halt

Then in mythfrontend: settings->general->halt command->/sbin/halt

Configuring xine to play DVDs and Videos

Personally, I don't like mplayer for usage as a DVD player, because it does not have support for DVD menus. Xine does. So, to use xine instead of mplayer, go to Utilities/Setup-->Setup-->Media Settings-->DVD Settings-->Play Settings, and type in

 xine -pfhq --no-splash dvd:// 

Similarly, I also set xine as the player for my video files; go to Utilities/Setup-->Setup-->Media Settings-->Videos Settings-->Play Settings, and put in

 xine -pfhq --no-splash %s

References

  1. http://bit.blkbk.com/
  2. MythTV wiki (http://mythtv.org/wiki/)
  3. Main MythTV website (http://mythtv.org/)
  4. Generic remote support (http://www.xbox-linux.org/wiki/LIRC#Recompiled_modules_to_get_to_work_with_the_cheap_remotes)
  5. Guide to compile mythtv 0.20 on Xebian: MythTV_0.20_on_Xebian_1.1.4
  6. Announcement of 0.20.2 pkgs for xebian (http://www.gossamer-threads.com/lists/mythtv/users/287032?search_string=0.20.2%20xbox;#287032)
  7. Guide to running xebian on vmware