tulrich.com
☰ Menu+  instagram  tuffy  ringing ear  rentals 

geekstuff | gameswf | Textweb | Chunked LOD | dumbuild

Cheat sheets: CVS | cygwin | Debian | Emacs | MythTV

MythTV Notes

MythTV is Personal Video Recorder software that I've been running on the family TV since late 2004. Sort of a free homebrew Tivo (for a very twisted definition of "free").

Anyway, here are some notes on setting up and using MythTV. A lot of these notes have less to do with MythTV per se than running wacky hardware/software under Debian.

\comment{http://www.rokulabs.com/products_soundbridge_specs.php|


7 Apr 2006

DVD Eject

(BTW I'm up to version 0.19 of MythTV, using Debian packages.)

Myth and DVDs have always been problematic for me. One problem is that scratched DVDs (e.g. rented from Netflix) can effectively hang my Linux box when trying to play a damaged section. From trawling mailing lists, I believe this is a fairly long-standing kernel bug, though it could also be a DVD drive problem. Anyway, my solution for this is to only play rented DVDs on my Playstation2 (complete with incomprehensible UI, FBI warning, etc), and try not to scratch my own DVDs. A few very popular Hazel DVDs get ripped to hard disk for easy replay.

Anyway, another extremely irritating problem is that after accessing a DVD, Myth somehow locks the drive shut, so it's impossible to eject the disc! I found a solution on the web, particularly on this guy's page. Adapted like so:

# as root, edit /usr/share/mythtv/optical_menu.xml, add these lines:

   <button>
         <type>DVD_EJECT</type>
	 <text>Eject DVD</text>
	 <action>exec eject -r /dev/dvd</action>
   </button>

16 Jan 2006

MythTV / Debian Kernel Upgrade Notes

I recently upgraded my myth box from MythTV 0.16 to 0.18, and the Linux kernel from 2.6.8 to 2.6.12. Sounds easy, right? Just a little jump of 4 minor revisions. Ha! It was a raft of pain! I can't even remember now why I needed to upgrade; I got so caught up in trying to recover a base level of functionality. Notes, for posterity:

# module retardation: neither the network nor the mouse was working
# after the kernel upgrade.  This has got to be a bug, who knows in
# what though?  The solution was to add these lines to /etc/modules:
modprobe 3c59x
modprobe mousedev

# Needed to update the nvidia kernel module (for the good display
# drivers), and alsa (for sound).  Fairly straightforward, using
# module-assistant and following the menus.

# Needed to update the ivtv kernel module (i.e. the driver for my
# PVR-250 video capture card).  module-assistant did not work for some
# reason.  Also there seems to be a bug in either the ivtv Makefile or
# the linux Makefile, or something -- the Makefile was installing the
# built ivtv.so in the wrong place.  After much diagnosis, here's what
# I did to work around the problem:
... download and untar ivtv-0.4.l
cd /usr/src/ivtv-0.4.1/driver
make install EXTRAVERSION=-1-386

# Also needed to get the updated firmware for the PVR-250:
# Download and unzip Hauppage firmware archive, then:
cp HcwFalcn.rom /lib/firmware/
mv /lib/firmware/HcwFalcn.rom /lib/firmware/v4l-cx2341x-enc.fw
cp HcwMakoA.ROM /lib/firmware/v4l-cx25840.fw

# Endless problems getting MythTV 0.18 going.  One problem is that
# MySQL changed its authentication defaults for the new version
# (4.1.15).  Here's the workaround I used:
root# mysql
SELECT Host, User, Password FROM mysql.user;
SET PASSWORD FOR 'mythtv'@'localhost' = OLD_PASSWORD('mythtv'); 

# More MythTV upgrade mess-ups: part of mythtv-setup is a function
# that upgrades the existing database schema to the current version.
# For some reason this thing didn't work correctly the first time, and
# left my db in an inconsistent state.  I had to go through the source
# code and figure out what the final schema was supposed to look like,
# and manually alter my MySQL tables to match.  I.e.:

# Diagnose schema problems with:
tail -f /var/log/mythtv/mythbackend.log
mysql -u mythtv -p mythconverg
> show columns from record;   # to see schema

# go through mythtv source code
#  (e.g. http://www.cuymedia.com/doxygen-dev-docs/html/dbcheck_8cpp-source.html#l00481)
# to see what the intended schema is, and do SQL operations to fix; in this case:

ALTER TABLE program ADD COLUMN manualid INT UNSIGNED NOT NULL DEFAULT 0;
ALTER TABLE program DROP PRIMARY KEY;
ALTER TABLE program ADD PRIMARY KEY (chanid, starttime, manualid);
ALTER TABLE recordmatch ADD COLUMN manualid INT UNSIGNED;

# Also, clear out existing schedules with:
DELETE FROM record;


# There was yet more retardation related to the udev/kernel upgrade.
# udev is the fancy new userspace program to manage the /dev
# filesystem; i.e. access to hardware drivers.  In theory it's a big
# improvement over what we had before.  However, the transition
# process has been botched pretty badly.  As far as I can tell, the
# kernel/udev developers didn't really account for real-world
# migration problems.  Or else it's the fault of the Debian
# maintainers.  I'm not really sure.  I am sure it has lowered my
# opinion of the kernel development process.
#
# Anyway, here's what it meant for me:
#
# Symptom: many things very broken, such as Gnome login for user
# mythtv.  Looking at logs, it appears that /dev/null and /dev/zero
# and other important devices are only accessible to root!
#
/etc/init.d/mythtv-backend start   # --> would segfault before writing any
                                   # logs, but only under user mythtv, not root...
# diagnosis:
strace mythbackend  # --> showed a failure to open "/dev/zero".  Consarnit.
chgrp users /dev/zero  # --> fixed the segfault
# Furthermore, there is no /dev/cdrom symlink, and /dev/hdc (my cdrom
# device) is only accessible to root.  Clearly something is rotten in /dev.
#
# The solution, for me:
cd /etc/udev/rules.d
ln -s ../permissions.rules z70_permissions.rules
ln -s ../cd-aliases.rules z80_cd-aliases.rules

# The root cause was probably some bugs in udev install scripts.  See
# this wonderful email thread for some flavor/background about why
# udev upgrade is such a disaster, and the personalities involved:
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=325484

tu@tulrich.com |