Xbox Frontend on Xebian stable

From MythTV Official Wiki
Revision as of 16:18, 4 February 2008 by Pepsi max2k (talk | contribs) (Install MythTV)

Jump to: navigation, search

Installing an Xbox Frontend on Xebian Stable

Alex Fisher has recompiled Christian Marillat's mythtv 0.20 source package against debian stable and optimised for Pentium 3.

The advantage with this configuration is that you do not need to upgrade any part of your Xebian from stable (sarge) to unstable (sid).

The following will end you with a ratpoison window manager and autostarting mythfrontend, with information taken from mycampus' Xebian And Mythtv-frontend HOWTO and the xbox-linux MythTV on Xebian wiki, combined together and a few steps clarified / added.

Assumptions

1. Xbox has been modded (either soft or hard, following assumes Krayzie's Ndure) and boots to a modded dashboard of some kind.

2. You are NOT using HDTV output. RGB Scart and Composite are fine, others you may have to try additional things to get working.

3. You know what size drive is in your xbox (open it up and look, or install XBMC and check product IDs in there).

4. Mythbackend 0.20.2 is installed somewhere else on the network.

5. Xbox has access to the network, with an IP in the same subnet as your mythbackend PC.

6. Make sure your mythbackend is configured with an IP not the default 127.0.0.1. You change this in mythsetup.


Install Xebian 1.1.4

Download Xebian 1.1.4-xbox, named dist-1.1.4-xbox.tar.gz at http://sourceforge.net/project/showfiles.php?group_id=54192 then extract and burn the ISO to disc using the slowest available speed and Track-At-Once if available. AS the xbox's dvd drive has compatibility issues, you may have to try burning to a different DVDR/W or CDR/W until one works.

Before booting Xebian, connect all devices you wish to use to the xbox via USB to Xbox converter cables if needed, inc. mouse, keyboard, remote and Xbox control pad. This may or may not help with correct drivers being loaded during install, but it don't hurt to make sure does it?

Insert the disc in to the xbox, and depending on your mod method it may just run, or with the Ndure mod, power off the xbox with disc in drive, power back on and Xebian should just start to boot. If not, try another disc.

Now follow the Xebian And Mythtv-frontend HOWTO pdf, steps 4.1 through 4.5. They're reproduced below incase the PDF ever goes awol.

If no keyboard is available, open xvkbd from the Apps > Tools menu available when pressing B on the xbox controler.

Now start a bash shell from Apps > Shells and, using the virtual keyboard if necessary, type:

su
xebian
cd /etc/network
nano interfaces

Edit the "iface eth0 inet static" line to read

iface eth0 inet dhcp

and save / exit nano by using Ctrl-X, hit Y, and enter. Now restart your ethernet interface using:

ifdown eth0
ifup eth0

You should see printout confirming the assignment of a correct IP / gateway / subnet.


Now SSH in to the xbox, either via Linux or using Putty on a Windows PC. On linux, this is:

ssh root@(xbox ip)

And on windows just type the ip in to the first box in putty and connect. Click or type yes to any key queries, and use "xebian" as the password.


Now install Xebian using the following command:

XboxLinuxInstall

You have a few options now; check the pdf for more but if you have a 10GB Seagate hard drive in you box, you'll probably want to install to the unused 2GB hard drive space (or F:/ partition) as it seems quicker than installing on E:. If you only have an 8GB Western Digital drive, you'll have to install to E: (check the pdf for instructions), otherwise:

Choose the 2nd Install to free space option. Change the swap size to 512M (may or may not make much difference from 256M but it can't be bad).

When asked for IP / Netmask / Gateway, enter the xbox's current IP / Netmask / Gateway (that's the IP you're using to access over ssh, and your backend's netmask / gateway should be the same). Use whatever hostname you like but I kept default. Local network domain should proabably left at local.localdomain unless you know better. And that should be about it, once install is done you should see the text "Happy penguin" and you can type "shutdown -h now" to shutdown. Now power on with the eject button, remove the CD and boot in to your old dashboard.

You can boot xebian using the default.xbe file in E:/debian, which you should be able to access via your dashboard, in XBMC it's under Programs (you may have to add E:/debian as a source and chose the 2.3GB Linux program). Section 4.6 in the PDF gives more details on adding dashboard buttons to quick load the thing. Either way, it should take aprox 55 seconds to boot from F, and look identicle to the live CD.


Update Xebian

This is where I went a little wrong, but it worked and from my experience using Linux updates, doing anything different may mean it doesn't work, so best you do the same...

After logging in via SSH again, firstly add the following two lines to the end of /etc/sources.list (using "nano /etc/sources.list", Ctrl-X, Y, enter to save):

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

The other links should be *left* using the *stable* repos. Now, update Xebian using the following command, which includes installing the joe text editor as it a) is what I did (and it worked) and b) ensures your updates are working as they shoudl:

apt-get update
apt-get install joe
apt-get update
apt-get upgrade

The joe installation will print out a readme file, just type :q (colon, Q) to exit it, and ignore the errors about writing to readme files. The upgrade should ask a number of questions, namely asking whetehr to overwrite or keep a previous install file. Just chose be default N to keep it, :q out of any readmes, and generally follow the defaults. Once upgraded you'll be dumped at a normal command prompt and just type "shutdown -r now" to reboot, then start up again from the dashboard.


Update Sources

SSH in again, and again edit your sources.list to change all "stable" links to "sarge". The resulting sources.list file will look like this:

deb http://ftp.at.debian.org/debian sarge main contib non-free
deb http://non-us.debian.org/debian-non-US sarge/non-US main contrib non-free
deb-src http://non-us.debian.org/debian-non-US sarge/non-US main contrib non-free

deb http://security.debian.org sarge/updates main contrib non-free
deb-src http://security.debian.org sarge/updates main contrib non-free

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

If you do not do this, you will get dependency errors when trying to install mythtv-frontend.


Add Myth-Backend to Hosts

Use nano to edit /etc/hosts and add a line with the IP and host name of your mythtv backend server:

192.168.1.2   biggs

Frankly I don't know how important this bit is, but anyway...

Install MythTV

Due to a possible bug in the installer, make and chmod a mythtv folder yourself:

mkdir /etc/mythtv/
chmod 777 /etc/mythtv/

Now run the following commands to install mythtv-frontend 0.20.2:

apt-get update
apt-get install mythtv-frontend

This should install all needed dependencies for you. If not, you probably have the /etc/sources.list file wrong - make sure that all links contain "sarge" instead of "stable". When asked for confirmation, hit Y and enter and when asked for the IP of the backend server, enter just that.

You may also want to install aditional plugins for mythfrontend at this point, though I left it til later just to make sure all was working beforehand. Whenever you want to install, just type:

apt-get update
apt-get install mythvideo mythmusic mythtv-themes

Add or remove whichever plugins you want, and note that without mythtv-themes you'll only have the default GANT or some yucky blue theme available.

Xbox Remote Key Bindings

Note: This section assumes you are using the official Xbox DVD remote kit and that you had it connected during the installation process (it may or may not work if not, check "more /etc/lirc/lircd.conf" for Xbox remote info if you didn't).


You now want to download and copy a key binding file for the Xbox remote to use with MythTV and Mplayer via a Lircrc and mplayer.config file. The Xbox remote should already be working with Lirc so you just need to copy a few files from a mythtv-xbox package. You might wanna check the file is still available for download at bit.blkbk.com first, and then continue with the install. You can also edit the lircrc file if you so wish / know how to, but you're on your own there.

cd /root
mkdir temp
wget http://bit.blkbk.com/mythtv-xbox.0.4.5-beta.tar.gz
gunzip mythtv-xbox.0.4.5-beta.tar.gz
tar xvf mythtv-xbox.0.4.5-beta.tar.gz
cd live
cp lircrc /usr/share/lirc/
cp mplayer.config /usr/share/mplayer


MCE User

Note: a number of the following steps differ from mycampus' pdf. You MUST follow the steps below for the the lircrc and .config files otherwise they will not link correctly, and you should also use the chown steps below to avoid chowning the whole /home directory which causes problems if you want to use any other user in the furture.


You can continue to use the default live user if you wish, and keep a nice fluxbox gui, but if you're just gonna be running mythfrontend then there's no need for this as it takes up a little memory which you could betetr use elsewhere. The below will setup the inbuilt mce user to be logged on by default and run mythfrontend automatically.

First up you need to link the copied lircrc and mplayer.config files to the mce users home directory, but you must also remove any current version of these files from there before you do so, so...

cd /home/mce
rm .lircrc
rm .mplayer/config
ln -s /usr/share/lirc/lircrc .lircrc
ln -s /usr/share/mplayer/mplayer.config .mplayer/config
mkdir .mythtv
ln -s /usr/share/lirc/lircrc .mythtv/lircrc


Database Conenction

You also now need to create a mysql.txt file within the .mythtv directory containing the mysql database info for mythfrontend. Without doing this, I found that mythfrontend would not start, and trying to start it via a command line on the xbox showed it had problems connecting to the database. The following steps resolved this for me.

First up, know what to put in mysql.txt. You should see what you need in either /etc/mythtv/mysql.txt or /home/(user)/.mythtv/mysql.txt on your backend, otherwise using the below defaults with the IP address of your backend and password found on the Setup > General page of mythfrontend on your backend machine should work.

cd /home/mce/.mythtv
nano mysql.txt

Use nano to enter the following (changing what's needed) and Ctrl-X, Y, enter to save.

DBHostName=192.168.1.2
DBUserName=mythtv
DBName=mythconverg
DBPassword=mythtv

Even after this you may have connection problems, so run the followin ON YOUR BACKEND MACHINE to allow access. Note that during my attempts to fix my problems, I did each of these three lines for the live, mce and mythtv users. Presumably only mce or mythtv is actually needed, but you're best just doing the same as I did. Just hit enter after the first command when asked for password.

mysql -u root -p -h localhost

GRANT ALL PRIVILEGES ON *.* TO 'live'@'192.168.1.3' IDENTIFIED BY 'secretmagicpasswd' WITH GRANT OPTION;
UPDATE mysql.user SET Password = OLD_PASSWORD('secretmagicpasswd') WHERE User = 'live';
SET PASSWORD FOR 'live'@'192.168.1.3' = OLD_PASSWORD('secretmagicpasswd');

Make sure to change 192.168.1.3 to your XBOX's IP, the secretmagicpasswd to the same as the one used in the mysql.txt file (your nomal mysql password) and iterate through live, mce and mythtv for all three lines.


Finishing Up

Now you just have two more things to do for the xbox's mce user. SSH back in if you aren't already, and...

nano /home/mce/.xinitrc

Edit the file to read:

exec /usr/bin/ratpoison &
exec /usr/bin/mythfrontend

Basically you just change freevo to mythfrontend. Ctrl-X, Y, enter.


Now, this is another bit that differs from the PDF guide as I'm sure it's wrong in there. You basically just want to chown all the files you just created to belong to the mce user, not root. Do a "cd /home/mce" then "ls -a -l" to see the current permissions, then:

cd /home/mce
chown mce:mce .lircrc
chown mce:mce .mplayer/config
chown mce:mce .mythtv
chown mce:mce .mythtv/mysql.txt
chown mce:mce .xinitrc

Do "ls -a -l" again and you should see all files belong to mce now. Note that I actually followed the guide's version which is:

cd /home/mce
chown mce:mce * -R
chown mce:mce .* -R

but this chown's the whole contents of the /home directory to the mce user and caused me to then have problems using the live user. But, if you have any problems getting Myth to work, you may wanna try this as a last resort as it's what's working on my system.


Auto Login

Just one more thing left, and that's to enable auto login.

nano /etc/inittab

What you want to do is change the "live" user in the following line to "mce":

1:12345:respawn:/sbin/mingetty --noclear --autologin live tty1

But while you're at it you should also comment out four or so of the extra teminals as these take up memory and unless you know better you'll never use them. So, edit the file so it looks as follows, then Ctrl-X, Y, enter to save.

1:12345:respawn:/sbin/mingetty --noclear --autologin mce tty1
#1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6

And that should be it. Type "shutdown -r now" to restart, boot your regular dashboard, run Linux, and you should see the Ratpoison gui load after 55 odd seconds, and Mythfrontend should load around 10 seconds later with no extra configuration needed. You'll probably wanna go through the setup and change things to your liking though, and if you know how there's plenty of stuff like extra optimization (eg. free up some more memory), installing a better remote and altering lircrc key bindings but I've not got that far myself yet so we'll leave that for another day.

Also, you'll notice it's not the fastest frontend ever. Recordings / TV should take around 20 seconds to start up, maybe 5 or so seconds to stop a video, and changing menu options via the OSD will also take 10 or so seconds. Paging will help, so after doing something once it should be quicker, but you'll probably just have to put up with it.

And if you're viewing on a CRT, you probably want to enable Bob(2x) deinterlacing. Unfortunately if you want/need to watch subtitles (like my father) then any live subtitling will either cause Bob to stutter on every word update, or may be barely visible due to constant flickering on and off. Regular (non-live) subtitling seems much better though as it only updates once every few seconds.

And general picture quality seems pretty good (better than XBMC's major contrast issues), if not quite as bold and vivid as my STB, but then I am currently using a composite scart socket and haven't touched display settings, either resolution or contrast/brightness/hue etc.

Known/Possible Issues

Jack Lowry has had a problem with his backend (Slackware 10.2, myth .19, mysql to 4.1.4) and his upgrading his xbox (xebian + mythtv 0.18 -> 0.19) with a mysql problem

But now I have a mysql version issue, when myth tries to make a 
connection to the mysql database I get a message in the .xsession-errors 
file that says:
ERROR 1251: Client does not support authentication protocol requested by 
server; consider upgrading MySQL client
I've also tried the mysql client and got the same error message.

It seems newer versions of mysql use a new password scheme that's compatible with the mysql client compiled into myth packages I was using. The following link provides several methods to work beyond this problem. I created a new user for my xbox frontend using the old format password.

http://dev.mysql.com/doc/refman/4.1/en/old-client.html

Another alternative is to check the my.cnf file on the server. It may contain an option to enable old-scheme passwords. Also, if you are unable to connect to the database check the my.cnf file to see if mysql is bound to an actual network address and not 127.0.0.1.

A simpler (MythTV) related solution to this problem can be found at the following link:

http://www.xbox-linux.org/wiki/MythTV_on_Xebian_HOWTO

Bear in mind that MythTV on the X-Box will run under the userid "live" and the instructions in the link above assumes the X-Box MySQL userid is also "live", so make sure you use this userid when configuring via mythtvsetup (runs by default first time) or by editing /home/live/.mythtv/mysql.txt.