Installing MythTV on Debian Etch

From MythTV Official Wiki
Revision as of 20:01, 23 September 2008 by Genseng (talk | contribs) (Sound)

Jump to: navigation, search

This is a Tutorial to install MythTV on a Debian GNU/Linux 4.0 ('etch') machine.

Debian GNU/Linux 4.0 ('Etch') Base System Installation

Download the netinst disk for your favorite platform from http://www.debian.org/CD/netinst/ or one of the mirrors.

  1. Boot the target PC from the Debian CD
  2. At the Debian Boot Screen, hit enter
  3. Choose your preferred language, Country or Region, and Keyboard Layout
  4. Choose a servername and domain
  5. Accept automatic partition changes
  6. Install GRUB to the MBR
  7. Reboot
  8. Debian starts its post install configuration routine
  9. Choose your Time Zone
  10. IMPORTANT: do not use the username "mythtv". The user "mythtv" is reserved for use by mythtv
  11. Enter your new root password and the information for your new user account
  12. Add ftp.debian.org
  13. Make sure that only Base or Standard System is checked
  14. The Debian Netinst installer should now leave you with a login screen

MythTV Installation and Configuration

MySQL

Become root

 su

Install the mysql server:

apt-get install mysql-server

Set the mysql root user password:

mysqladmin -u root password yourpasswordhere

Sound

Install ALSA:

apt-get install alsa-base alsa-utils libesd-alsa0

Configure your sound card by entering the command:

alsaconf

IvTV driver packages

This section is only necessary if you need ivtv for your TV Tuner. First, edit your /etc/apt/sources.list file by adding 'contrib' to the end of each relevant source line, so that the lines look something like this:

 deb http://ftp.debian.org/debian etch contrib
 deb-src http://ftp.debian.org/debian etch contrib

Then run (NOTE: The following command is one line long. The `uname -r` part is placing your specific linux kernel version, so you may run into trouble if you have compiled your own kernel, in which case you should run 'apt-cache search ivtv' and find the correct modules for your system. You will also need to keep an eye on the 'linux-source-2.6.18' package, and be sure that you are getting the correct version. This can be verified by running the 'uname -r' command and noting the version displayed.)

 apt-get install ivtv-utils ivtv-modules-`uname -r` linux-source-2.6.18 linux-headers-`uname -r` module-assistant

If you are using a Hauppauge PVR-150 TV Tuner, then get latest pvr-150 firmware from http://dl.ivtvdriver.org/ivtv/firmware/ and put the *.fw files (except the usb-related files, indicated by their filenames) in /lib/firmware, then run

 modprobe ivtv

Please note: Debian GNU/Linux 4.0 comes with IVTV version 0.8.2. If for some odd reason you need newer IVTV drivers, then the two options are:

1) Grab the latest greatest out-of-the-box packages from 'sid'.

2) Build the IVTV drivers from source as described on the IVTV wiki page

Both are not explained in detail over here.

If you've configured your own, newer, kernel, you might benefit from this thread over at linuxquestions.org: [1].

Linux Infra Red Remote Control lirc

Please see LIRC_on_Debian_Etch.

Graphical User Interface (GUI): X.org

In order to run X, I ran (The last entry, fluxbox, is the window manager. It is up to you to decide which window manager you want to run.)

 apt-get install xfonts-base xbase-clients xserver-xorg xfonts-75dpi fluxbox

After installing X, you will need to modify your /etc/X11/xorg.conf file.

Getting MythTV

Out-of-the-box packages

Add the MythTV sources to /etc/apt/sources.list accordingly (please use a nearby mirror):

Architecture : alpha | amd64 | hppa | i386 | ia64 | powerpc | sparc

Australia

deb http://deb.samad.com.au/multimedia/ stable main
deb-src http://deb.samad.com.au/multimedia/ stable main

Belarus

deb http://ftp.mgts.by/debian-multimedia/ stable main
deb-src http://ftp.mgts.by/debian-multimedia/ stable main
deb ftp://ftp.mgts.by/debian-multimedia/ stable main
deb-src ftp://ftp.mgts.by/debian-multimedia/ stable main

Belgium

deb ftp://mirrors.powersource.cx/pub/debian-multimedia/ stable main
deb-src ftp://mirrors.powersource.cx/pub/debian-multimedia/ stable main

Brasil

deb http://www.las.ic.unicamp.br/pub/debian-multimedia stable main
deb-src http://www.las.ic.unicamp.br/pub/debian-multimedia stable main
deb http://linorg.usp.br/debian-marillat/ stable main
deb-src http://linorg.usp.br/debian-marillat/ stable main
deb ftp://linorg.usp.br/debian-marillat/ stable main
deb-src ftp://linorg.usp.br/debian-marillat/ stable main

Canada

deb http://debian.dc-uoit.net/debian-multimedia/ stable main
deb http://gulus.usherbrooke.ca/pub/distro/debian/debian-multimedia/ stable main
deb-src http://gulus.usherbrooke.ca/pub/distro/debian/debian-multimedia/ stable main
deb ftp://gulus.usherbrooke.ca/debian-multimedia/ stable main
deb-src ftp://gulus.usherbrooke.ca/debian-multimedia/ stable main

Denmark

deb http://debian.three-dimensional.net/debian-multimedia stable main
deb-src http://debian.three-dimensional.net/debian-multimedia stable main

El salvador

deb http://debian.ues.edu.sv/debian-multimedia/ stable main
deb-src http://debian.ues.edu.sv/debian-multimedia/ stable main

France

deb http://mirror.home-dn.net/debian-multimedia stable main
deb-src http://mirror.home-dn.net/debian-multimedia stable main
deb http://debian-multimedia.gnali.org stable main
deb-src http://debian-multimedia.gnali.org stable main
deb http://debian-multimedia.yolker.be stable main
deb-src http://debian-multimedia.yolker.be stable main

Germany

deb http://debian-multimedia.dfoell.org/ stable main
deb-src http://debian-multimedia.dfoell.org/ stable main
deb http://debian-multimedia.informatik.uni-erlangen.de/ stable main
deb http://mirrors.ecology.uni-kiel.de/debian/debian-multimedia stable main
deb-src http://mirrors.ecology.uni-kiel.de/debian/debian-multimedia stable main
deb http://debian-mirrors.sdinet.de/debian-multimedia stable main
deb http://debian.netcologne.de/debian-multimedia.org stable main
deb-src http://debian.netcologne.de/debian-multimedia.org stable main
deb ftp://debian.netcologne.de/debian-multimedia.org stable main
deb-src ftp://debian.netcologne.de/debian-multimedia.org stable main
deb http://honk.physik.uni-konstanz.de/mirror/www.debian-multimedia.org stable main
deb-src http://honk.physik.uni-konstanz.de/mirror/www.debian-multimedia.org stable main
deb http://debian.ids-services.de/debian-multimedia/ stable main
deb-src http://debian.ids-services.de/debian-multimedia/ stable main
deb http://ftp.uni-kl.de/debian-multimedia/ stable main
deb-src http://ftp.uni-kl.de/debian-multimedia/ stable main
deb ftp://ftp.uni-kl.de/debian-multimedia/ stable main
deb-src ftp://ftp.uni-kl.de/debian-multimedia/ stable main

Great Britain

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

Greece

deb ftp://ftp.hol.gr/pub/mirror/debian-multimedia.org stable main
deb-src ftp://ftp.hol.gr/pub/mirror/debian-multimedia.org stable main
deb http://ftp.hol.gr/pub/mirror/debian-multimedia.org stable main
deb-src http://ftp.hol.gr/pub/mirror/debian-multimedia.org stable main
deb http://ftp.duth.gr/debian-multimedia/ stable main
deb-src http://ftp.duth.gr/debian-multimedia/ stable main
deb ftp://ftp.duth.gr/debian-multimedia/ stable main
deb-src ftp://ftp.duth.gr/debian-multimedia/ stable main

Ireland

deb http://floating3.ucd.ie/debian stable main
deb-src http://floating3.ucd.ie/debian stable main
deb http://ftp.heanet.ie/mirrors/debian-multimedia/ stable main
deb-src http://ftp.heanet.ie/mirrors/debian-multimedia/ stable main

Italia

deb http://mi.mirror.garr.it/mirrors/debian-multimedia stable main
deb-src http://mi.mirror.garr.it/mirrors/debian-multimedia stable main
deb ftp://mi.mirror.garr.it/mirrors/debian-multimedia stable main
deb-src ftp://mi.mirror.garr.it/mirrors/debian-multimedia stable main

Portugal

deb http://ftp.eq.uc.pt/software/unix/Linux/debian-multimedia/ stable main
deb-src http://ftp.eq.uc.pt/software/unix/Linux/debian-multimedia/ stable main
deb ftp://ftp.eq.uc.pt/software/unix/Linux/debian-multimedia/ stable main
deb-src ftp://ftp.eq.uc.pt/software/unix/Linux/debian-multimedia/ stable main
deb http://neacm.fe.up.pt/debian-multimedia/ stable main
deb-src http://neacm.fe.up.pt/debian-multimedia/ stable main
deb ftp://neacm.fe.up.pt/debian-multimedia/ stable main
deb-src ftp://neacm.fe.up.pt/debian-multimedia/ stable main

Russia

deb http://debian.nsu.ru/debian-marillat/ stable main

Slovakia

deb http://ftp.tuke.sk/debian-multimedia/ stable main
deb-src http://ftp.tuke.sk/debian-multimedia/ stable main
deb ftp://ftp.tuke.sk/debian-multimedia/ stable main
deb-src ftp://ftp.tuke.sk/debian-multimedia/ stable main

Sweden

deb http://ftp.sunet.se/pub/os/Linux/distributions/debian-multimedia stable main
deb-src http://ftp.sunet.se/pub/os/Linux/distributions/debian-multimedia stable main
deb ftp://ftp.sunet.se/pub/os/Linux/distributions/debian-multimedia stable main
deb-src ftp://ftp.sunet.se/pub/os/Linux/distributions/debian-multimedia stable main
deb http://ftp.acc.umu.se/mirror/debian-multimedia stable main
deb-src http://ftp.acc.umu.se/mirror/debian-multimedia stable main

Taiwan

deb http://ftp.tw.debian.org/debian-multimedia/ stable main
deb-src http://ftp.tw.debian.org/debian-multimedia/ stable main

Architecture : i386 only France

deb http://www.dedale.eu.org/mirror/debian-multimedia/ stable main
deb-src http://www.dedale.eu.org/mirror/debian-multimedia/ stable main

Switzerland

deb http://debian.mxchange.org/debian stable main

Ukraine

deb ftp://ftp.linux.kiev.ua/pub/mirrors/www.debian-multimedia.org/ stable main
deb-src ftp://ftp.linux.kiev.ua/pub/mirrors/www.debian-multimedia.org/ stable main

Main Repository

deb http://www.debian-multimedia.org etch main
deb-src http://www.debian-multimedia.org etch main

Before we can use apt, we must import the gpg keys for the site by installing the debian-multimedia-keyring package. The "apt-get update" command will give a warning about missing GPG key. Type 'yes' if prompted to install "untrusted" package for the "apt-get install" command:

apt-get update
apt-get install debian-multimedia-keyring
apt-get update

Now you can instal mythtv:

apt-get install mythtv

and if you want extras you can search for them with

apt-cache search mythtv

Building from source

If you really insist on building MythTV yourself:

add your user to the staff group so you get write permission to usr/local now after logging in as a user (DON'T USE ROOT) do this:

svn co http://cvs.mythtv.org/svn/trunk/mythtv

This creates a folder called mythtv where the actual sources are in.

cd mythtv

and compile it with something like:

 ./configure --prefix=/usr/local --arch=athlon-xp --enable-dvb --enable-dvb-eit
make
make install

The configure line above is only an example. In this example, the installation is configured to be under /usr/local. If you want to put it somewhere else, you can alter the --prefix argument. Run ./configure --help to see what options are available and necessary for you.

You will probably want to be root to run the "make install" part, though, because that target invokes ldconfig to set up shared library paths, and usually nobody but root can do this.

Starting MythTV

Set the mythtv user's password:

 passwd mythtv

Log in as the mythtv user, then start an X session:

 startx

Open up XTerm and run the MythTV Setup program:

 mythtv-setup

After configuring MythTV, you can start the MythTV Backend:

 sudo /etc/init.d/mythtv-backend start

You will then need to pull your channel information:

 mythfilldatabase

Additional (and Optional) MythTV System Configuration

Can't watch tv?

  1. Try cat /dev/video0 >/tmp/somefile.mpg
  2. Try cat /var/log/dmesg |grep tv
  3. Do you need to put the ivtv firmware in /usr/lib/hotplug/firmware
  4. Check MySQL ports used by MythTV. Like the guides say, you will probably not need to change this. Don't worry that the ports listed in MySQL setup is different from the ones here.
  5. Check MythTV directory permissions.
  6. Did you change the mysql password for root or mythtv?
    1. rm ~/.mythtv -rf && rm /home/mythtv/.mythtv -rf && rm /var/lib/.mythtv -rf
    2. sudo dpkg-reconfigure mythtv-database
    3. sudo dpkg-reconfigure mythtv-common
  7. Did you import the default table: mysql -u root -p < /usr/share/mythtv/mc.sql

Reduce GRUB boot time

Edit the file /boot/grub/menu.lst and find the section:


Script.png /boot/grub/menu.lst

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry define).
timeout 5

and change this to read:


Script.png /boot/grub/menu.lst

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry define).
#timeout 5
timeout 1

Auto Login

NOTE: Newer (0.20.2 and later?) versions of MythTV seem to put the mythtv user's home directory in /var/lib/mythtv ... please check this (run 'pwd' immediately after logging in to note your current directory), and change the appropriate entries below accordingly.

If you would like the mythtv user to automatically log in, but don't want to use gdm, then follow these simple instructions. First you will need to install rungetty which will allow you to enable the automatic login of the mythtv user.

 apt-get install rungetty

Then, you will set the first screen to automatically log the mythtv user in, instead of displaying a login prompt and waiting for user input. To do this you will edit the /etc/inittab file to change the line:

 1:2345:respawn:/sbin/getty 38400 tty1

to read

 1:2345:respawn:/sbin/rungetty tty1 --autologin mythtv

You will then need to set up the mythtv user account to automatically start X, and also automatically restart X in the event of any type of exit. To do this you will modify the file /home/mythtv/.profile to read:


Script.png /home/mythtv/.profile

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
while [ 1 == 1 ]
        do
                startx
                sleep 10
        done
fi

At this point, X will start, but it will just sit there waiting for user input. In order to automatically start mythfrontend when X starts, you will need to edit /home/mythtv/.xinitrc to something like:

 exec irexec &
 exec xset s off &
 exec fluxbox & wmpid=$!
 exec mythfrontend 2>> /home/mythtv/MYTHERRORS &
 wait $wmpid

A few notes on the above suggestion:

  1. The irexec line is starting the IR interpreter program. This is useful if you have edited your lirc configuration files to allow button presses on your remote to operate things outside of MythTV. This line is optional according to whether or not you use irexec.
  2. The xset line is disabling your screen saver and/or screen blanking. This is completely optional.
  3. The fluxbox line is starting the chosen window manager (Fluxbox, in this case), and noting its pid. The window manager that you choose is optional, however the 'wmpid=$!' is not optional without reworking this file.
  4. The mythfrontend line is starting mythfrontend, and appending the MYTHERRORS file with any errors that would normally be lost in the console. This might be helpful for debugging, but please note that it appends to this file, meaning it will continue to grow and should be watched over. The '2>> /home/mythtv/MYTHERRORS' part is optional (the & is NOT optional).
  5. The wmpid line is waiting for Fluxbox to close. This line is not optional without reworking this file.

IMDB Fetch Problems?

The original source of this section is (this is more or less a word-for-word copy): http://fauxzen.com/2007/04/03/mythtv-020-02ubuntu2-imdb-fetch-problems/

If you have trouble with the getting all of a movie's information pulled from IMDB (plot, director, ratings, etc), then follow these steps to correct the issue.

First create a backup of the original script

 sudo cp /usr/share/mythtv/mythvideo/scripts/imdb.pl /usr/share/mythtv/mythvideo/scripts/imdb.pl-orig

Download the SVN Copy

 wget http://svn.mythtv.org/trac/browser/trunk/mythplugins/mythvideo/mythvideo/scripts/imdb.pl?format=raw

Rename the script

 mv imdb.pl\?format\=raw imdb.pl

Replace the old script with the new one

 sudo cp imdb.pl /usr/share/mythtv/mythvideo/scripts/imdb.pl