Installing Debian and MythTV

From LinuxNewbie

I got MythTV working pretty easy with MEPIS, which is Debian based. This was fine for a week until I found out no kernel source was available and so my ir remote was never going to work with lirq.

I used the business card installer from http://www.debian.org/devel/debian-installer/ to install. I used the boot option linux26 so that it would install a 2.6 kernel. My PC is an Athlon 1.33G (before the XP series), so I tried the 2.6.8-k7 kernel but it wasn't able to retrieve it so I chose 2.6.8-2-i386 and I will upgrade later. The install went smoothly as Debian always does.

After restarting I assigned the root password, chose the hostname freevo, and when it asked about package selection I chose manual and added gpm so consoles will have a mouse for select and paste. Then we wait...(about 10 minutes)

I installed kernel-image-2.6.8-2-k7 and kernel-headers-2.6.8-2-k7. I removed all exim4 components and installed nullmailer and bzip2. I set the smart host to my smtp server and gave it my email address so I will get root notifications.
next, apt-get install kde and wait 30 minutes...

I apt-get install lynx and went to www.mplayerhq.hu and downloaded the essential codecs from the download page. I used tar xjvf essential-20050115.tar.bz2 to unpack then then cd essential-20050115 and copied them to the codec directory mkdir /usr/lib/codecs then cp * /usr/lib/codecs/.

And I restarted...

KDE didn't start. I needed to apt-get install x-window-system and I apt-get install kdm because it didn't install it. kdm is the login manager; xdm (x's) will work, but kdm is prettier.

After the restart I chose US and English, KDE System Behavior, Left the Eyecandy at default (2 from the top), and chose the KDE default style. I opened Konquerer and went to nvidia.com to get a binary driver. It informed me that I don't have flash, but I am going to wait till I have mozilla installed. Before I went further I copied a Konsole icon to the desktop, opened it, change the Settings-Schema to Linux Colors and set it to default.

I added a user called mythtv, changed /home directories I already had with videos to be owned and group by mythtv and change the contents of /dev to have the group mythtv and g+rwx

adduser --system --ingroup mythtv --shell /bin/bash mythtv
passwd mythtv
chown mythtv:mythtv /home/* -R
chgrp mythtv /dev/* -R
chmod g+rwx /dev/* -R

I also copied a config file /etc/network/interfaces from the previous configuration so the box has a static 192.168.0.9 address. Makes it easier to find on the network. I also add the following repositories to /etc/apt/sources.list:

# non-free
deb ftp://ftp.us.debian.org/debian testing main contrib non-free
#deb-src ftp://ftp.us.debian.org/debian testing main contrib non-free

# non-us
deb ftp://non-us.debian.org/debian-non-US testing/non-US main contrib non-free

# java
# this repository didn't work for me :P
#deb ftp://metalab.unc.edu/pub/linux/devel/lang/java/blackdown.org/debian unstable main non-free

# mplayer
deb ftp://ftp.nerim.net/debian-marillat/ testing main
# mythtv
deb http://dijkstra.csh.rit.edu/~mdz/debian unstable mythtv


I used aptitude and add mozilla, mozilla-calendar, flashplayer-mozilla. I selected auto on the mozilla-broswer sound daemon selection.

I removed the taskbar icons for Konquerer, KMail and Help.

Back at the ranch...I went to the NVidia site and dowloaded the Linux drivers. I logged out of KDE because the nVidia driver won't install with it running. I pressed ctrl+alt+f1 to switch to a console and logged in as root. I did /etc/init.d/kdm stop to stop the login so x would close, and cd /home/mythtv and then sh NV and I pressed tab to complete the filename.
It gave me a warning about the rivafb module conflict but since I don't use it and it won't be loaded I am not concerned about it. After it installed I moved /etc/X11/XF86Config-4 to XF86Config-4.orig and put an XF86Config from my previous box in place that is configured to display to TV only.
This is my video card section:

Section "Device"
        Identifier  "Videocard0"
        Driver      "nvidia"
        VendorName  "eVGA.com"
        BoardName   "GeForce4 MX 440"
        Option "TVStandard" "NTSC-M"
        Option "ConnectedMonitor" "TV"
        Option "TVOutFormat" "SVIDEO"
EndSection

I then ran init 5 and /etc/init.d/kdm start and it came back up on the TV. Note that up until now I was using a monitor.

I ran aptitude (ncurses frontend for apt) and selected ffmpeg, mplayer-k7, tvtime and dvdrip.

While it downloaded I went to setup the autologin. As an appliance I want it to act like the Playstation or VCR. I clicked K on the taskbar and opened the Control Center. Under System Administration I selected Login Manager and saw that I must press the Administrator Mode button to change settings. After pressing the button and entering the password I went to the "Convenience" tab and marked "Enable auto-login" and the user was default to mythtv. I also selected "Automatically log in again after X server crash" at the bottom. I applied, logged out and switched to a console with ctrl+alt+f1. I ran /etc/init.d/kdm stop and then started it again with /etc/init.d/kdm start and it went in to kde without entering a password as mythtv just as it should.

The download is finished now, so I hit enter and answer questions about how I receive TV (NTSC here) and such. I set tvtime to setuid when it asked. FreeType will handle my TrueType fonts.

I ran apt-get install mysql-client mysql-server and after it installed I set a mysql root password with mysqladmin -u root password 'newpassword'. This is different than the system password and while not strictly required I do it because I am paranoid. You also need to edit /etc/mysql/my.cnf and find the line that says "skip-networking" and change it to "#skip-networking" without the quotes of course. Otherwise mysql won't answer network connections from mythtv.
okay, now, apt-get install mythbrowser mythdvd mythgame mythtv mythvideo mythweater and wait...


It tells me:


mythtv-setup must be run in order to complete MythTV installation

You must run mythtv-setup as the 'mythtv' user in order to complete mythtv configuration. Note that this program requires an X display, so you must either login to an X session as the 'mythtv' user, or otherwise arrange for that user to have access to your X display.

You must complete all four steps presented in the program.

Once you have done this, you may start the backend by executing the following command as root:
/etc/init.d/mythtv-backend start



If you are in N. America, you should use DataDirect.
Quote from [1]:
If you wish to use Zap2It DataDirect, you'll need to establish a user account. Go to http://labs.zap2it.com and click on the "New User? Sign Up" link. Read the license terms, and if you agree with them click "Accept". The next screen is the subscription registration. In the "Certificate Code" field, enter ZIYN-DQZO-SBUT.

Create a directory /home/mythtv/cache for use shortly. I ran mythtv-setup, and tell it yes to both questions about clearing previous settings.

  • General

Default on first pane.
Next ->
recording directory to /home/mythtv/
Live-TV buffers to /home/mythtv/cache/
Next ->
Settings as appropriate...
Next ->
Next ->
Next ->

  • Capture cards

(New capture card)
Defaults...
Next ->
Escape

  • Video sources

Video source name: source1
Note that I already signed up at zap2it
Entered my username and password and Retrieve Lineups
Finish
Escape

  • Input connections

(Television)
Video source: source1
Starting channel: 4
Channel 4 is the first available channel I receive
Finish
Escape
Escape to close

Back at the prompt I ran /etc/cron.daily/mythtv-backend and it populated the tv listings and /etc/init.d/mythtvbackend start to startup the backend.

I ran mythfrontend next to open the interface. I know already that if I try Watch TV right off it will crash so I went to Utilities/Setup - Setup - TV Settings - Recording Profiles - Software Encoders (v4l based). I went through each and changed the RTjpeg to MPEG-4. Because of my box speed I also changed LiveTV and Low Quality to 320x320 resolution, otherwise I drop frames. I closed out of the interface for now.

I loaded kmix from K - Multimedia. I made sure the sliders are about 85% on the wave and main. Then click the Input tab and turn off all green lights, and turn on the Red (record) under line.

Right click on the desktop can Create New - File - Link to Application
I gave it the name MythTV, selected an icon and went to the Application tab. Under Command I put /usr/bin/mythfrontend.

I restarted at this point to be sure it all came up as designed.

After I restarted it didn't work as I planned. I noticed the mixer inputs again are all on, and the line slider is down.
Installing: alsa-base alsa-oss alsamixerfui libsdl1.2debian-all xmms-arts


Okay, I'm back on Sunday. Right before I left last night (err, 2am this morning) I could get MythTV to work and as part of the trip I installed alsa. When KDE came up it said /dev/dsp was inaccessible and so I tried to remove it. Unfortunately that didn't resolve the problem because appearantly a modified file didn't. You can read about another instance of a similar circumstance at Debian sound not working but suffice it to say that the real problem is the sound drivers not loading correctly. I ran alsaconf from a console and configured and updated the modules files, and since that process unloads and loads the modules I could then restart KDE and it worked. I tried restarting, and the same error came back.

The fastest way I know to fix it is to unload the drivers and modprobe the sound card back, so I guess I will do that. I would really like to know the REAL fix for the problem.

While I had KDE up I tried MythTV and didn't get any error, but the Watch TV only showed green with some fuzz at the top. I closed out and loaded up tvtime and had it scan for channels. Once I tuned it to a working channel I went back to MythTV. It worked, so I guess I probably could have just gone to a working channel and been fine. As a side note, the mixer keeps forgetting the input settings so I guess I will be working on that too.

These are the modules I had to remove then re-insert. This had to be done with KDE stopped, and obviously is based on my sound chipset.

#!/bin/bash
modprobe -r snd_via82xx
modprobe -r snd_pcm_oss
modprobe -r snd_mixer_oss
modprobe -r analog
modprobe -r gameport
modprobe -r snd_bt87x
modprobe -r snd_pcm
modprobe -r snd

modprobe snd_via82xx
modprobe snd_bt87x
modprobe bttv


As an intermediate fix for the sound modules, I created /root/sound.sh and put the above lines in it and chmod u+x /root/sound.sh. Since Debian doesn't include an rc.local I added one, the put /root/sound.sh in it.

Since I ran the shell script while creating it, I restarted KDE (logout, then back in) and set the mixer how I needed it with alsamixergui. Leave the Line muted, turn the volume up and set it as the input. Then I ran alsactl store 0 so it would store the mixer settings when I restart.

Then I restarted...

When it came up sound worked, and was the correct volume/settings. The freevo records and plays live TV. I am mostly done.

I would like to get lirc working so I will have a remote to control it with. A reciever and remote came with a Pinnacle card I bought way back when I started this (about 18 months ago). I have found a couple notes that it won't compile against 2.6 although that may be an old version, I do not know. Even after installing source and configured headers fo 2.4.27 I couldn't get it to compile against those so i will have to spend some time with lirc to make it work. Since I wiped from mepis for that reason I will come back to it, but I am out of weekend now. It is Sunday night and almost 10pm.

Post related to ir keyboard input

Well, I am back again. This is Thursday so you have a timeline. What I cat /dev/ttyS0 I don't see any remote activity. In theory kernels after 2.6.5 have an ir device. You can modprobe ir_kbd_gpio or ir_kbd_i2c and the remote will act like a keyboard. You can either create a custom keymap for mythtv or at that point you can interface lirc without additional kernel modules. This is good since there are mixed reports concerning lirc kernel modules compiling against 2.6. If I get it working later I will add how I did it.