MythTV setup

Some post install configuration

Below are some notes about the Mandriva 2006
post install configuration.

urpmi configuration/Updates

Remove any existing rpms media, then add media for
main and contrib, then add update media
for updates, PLF free and non-free.
# urpmi.removemedia -a

# urpmi.addmedia main with ../media_info/
# urpmi.addmedia contrib with ../media_info/

# urpmi.addmedia --update updates with media_info/
# urpmi.addmedia --update plf-free with
# urpmi.addmedia --update plf-non-free with
Install any applicable updates.
# urpmi.update updates plf-free plf-non-free
# service mysqld stop
# urpmi --update --auto-select < /dev/null
# service mysqld start


The 2.6.12 based kernel from Mandriva 2006 can only support
a single VP7045 tuner device due a bug in the dvb-usb code.
This bug was fixed in Febuary 2006.
More recent kernels include this dvb-usb fix.
Mandriva Cooker contains recent stable kernels. kernels do not include bootsplash so
get the latest kernel-linus src rpm and the bootsplash patch,
then patch, build and install this more recent kernel.
# rpm -ivh

# cd /usr/src/RPM/SOURCES
# curl -o bootsplash-3.1.6-2.6.15.diff

# tar xjf linux-2.6.17.tar.bz2
# cd linux-2.6.17

# urpmi patch
# patch -p1 < ../bootsplash-3.1.6-2.6.15.diff

# cd ..
# tar cjf linux-2.6.17.tar.bz2 linux-2.6.17

# cd
# urpmi rpm-build automake1.7 < /dev/null
# perl -p -i -e "s/kname kernel-linus/kname kernel/" /usr/src/RPM/SPECS/kernel-2.6-linus.spec
# rpmbuild -bb --without smp /usr/src/RPM/SPECS/kernel-2.6-linus.spec


     * Bootsplash configuration
     Bootup splash screen (BOOTSPLASH) [N/y/?] (NEW) y


     Bootup splash screen (BOOTSPLASH) [N/y/?] (NEW) y


     Wrote: /usr/src/RPM/RPMS/i586/kernel-
     Wrote: /usr/src/RPM/RPMS/i586/kernel-source-


# rm -rf /usr/src/RPM/{BUILD,SOURCES,SPECS,SRPMS}/*

# rpm -ivh /usr/src/RPM/RPMS/i586/kernel-

# rpm -e kernel-i686-up-4GB-
Change lilo and bootsplash graphic.
# lilo-bmp2mdk mode:0x103 progress:397,190,14,11,64+35 timer:340,560,64+99,64+33 entry:170,190,64+33,64+126,12,52 clear:600,800,64+33 pos:0,0 < /path/to/message-graphic.bmp > /boot/message-graphic

# mv -f /path/to/bootsplash-800x600.jpg /usr/share/bootsplash/themes/Mandriva/images/bootsplash-800x600.jpg
# splash -s -f /etc/bootsplash/themes/Mandriva/config/bootsplash-800x600.cfg >> /boot/initrd-2.6.17-1mdv.img
Remove text output from /sbin/
# cd / && patch -p0 < /path/to/splash-patch.txt
Make /etc/lilo.conf look like the following
        append="resume=/dev/hda5 splash=silent"
Install the new boot loader
# lilo
Make /etc/modprobe.preload look like the following
Make /etc/modprobe.conf look like the following
alias eth0 via-rhine
alias sound-slot-0 snd-via82xx
remove snd-via82xx /sbin/modprobe -r snd-pcm-oss; /sbin/modprobe --first-time -r --ignore-remove snd-via82xx
install snd-via82xx /sbin/modprobe --first-time --ignore-install snd-via82xx && { /sbin/modprobe snd-pcm-oss; /bin/true; }
install usb-interface /sbin/modprobe ehci-hcd; /bin/true
The VP7045 tuners require firmware, the firmware file is
You can get this from or
from the dvb-firmware-usb PLF rpm.
# urpmi dvb-firmware-usb
When the system is restarted, ntpd will fail to drop root
privileges when it starts, this will cause ntpd to terminate.
This is because the /etc/init.d/ntpd script has the following :
	if [ -f "/lib/modules/`uname -r`/kernel/security/capability.ko" ]; then
                if ! grep -q "^capability " /proc/modules; then
                        modprobe capability
The capability module is now capability.ko.gz, so
# perl -p -i -e "s/capability.ko/capability.ko.gz/" /etc/init.d/ntpd
Now reboot into the new kernel.
# reboot


Get ndiswrapper from here.
Don't use the Netgear WG111 driver, it is very broken and lacks many features,
use the Sitecom WL-142 driver instead.
# tar xzf ndiswrapper-1.18.tar.gz
# cd ndiswrapper-1.18

# urpmi ncurses-devel
# rpm -ivh /usr/src/RPM/RPMS/i586/kernel-source-

# make distclean
# make
# make install

     mkdir -p /lib/modules/2.6.17-1mdv/misc
     install -m 0644 ndiswrapper.ko /lib/modules/2.6.17-1mdv/misc
     /sbin/depmod -a 2.6.17-1mdv
     install -D -m 755 loadndisdriver /sbin/loadndisdriver
     install -D -m 755 ndiswrapper /usr/sbin/ndiswrapper
     install -D -m 755 ndiswrapper-buginfo /usr/sbin/ndiswrapper-buginfo
     mkdir -p -m 0755 /usr/share/man/man8
     install -m 644 ndiswrapper.8 /usr/share/man/man8

# cd ..
# rm -rf ndiswrapper-1.18.tar.gz ndiswrapper-1.18

# unzip
# ndiswrapper -i Drivers/WlanUIG.inf

# rm -rf Driver Utility

# lsusb | grep NetGear
     Bus 005 Device 002: ID 0846:4240 NetGear, Inc.

# ndiswrapper -d 0846:4240 wlanuig
     Driver 'wlanuig' is used for '0846:4240'
# ndiswrapper -l
     Installed drivers:
     wlanuig         driver installed, hardware present

# ls -lh /etc/ndiswrapper/wlanuig
     total 352K
     lrwxrwxrwx  1 root root   16 Apr 28 17:36 0846:4240.F.conf -> 3574:907D.F.conf
     -rw-r--r--  1 root root  487 Apr 28 17:23 3574:907D.F.conf
     -rw-r--r--  1 root root  12K Apr 28 17:23 wlanuig.inf
     -rw-r--r--  1 root root 336K Apr 28 17:23 wlanuig.sys

# modprobe ndiswrapper
# dmesg | grep wlan0
     wlan0: vendor: 'Sitecom Wireless Network USB Adapter 140Mbps WL-142'
     wlan0: ndiswrapper ethernet device 00:0f:b5:dd:79:05 using driver wlanuig, 0846:4240.F.conf
     wlan0: encryption modes supported: WEP; TKIP with WPA, WPA2, WPA2PSK; AES/CCMP with WPA, WPA2, WPA2PSK
     wlan0: no IPv6 routers present

# iwlist wlan0 scan
     wlan0     Scan completed :
               Cell 01 - Address: 00:14:BF:0C:E1:E3
                         Protocol:IEEE 802.11g
                         Frequency:2.437 GHz (Channel 6)
                         Quality:0/100  Signal level:-55 dBm  Noise level:-256 dBm
                         Encryption key:on
                         Bit Rate:1 Mb/s
                         Bit Rate:2 Mb/s
                         Bit Rate:5.5 Mb/s
                         Bit Rate:11 Mb/s
                         Bit Rate:6 Mb/s
                         Bit Rate:9 Mb/s
                         Bit Rate:12 Mb/s
                         Bit Rate:18 Mb/s
                         Bit Rate:24 Mb/s
                         Bit Rate:36 Mb/s
                         Bit Rate:48 Mb/s
                         Bit Rate:54 Mb/s
			 (Unknown Wireless Token 0x8C05)

# echo 'alias wlan0 ndiswrapper' >> /etc/modprobe.conf
The wlan0 driver is ready.

The Access Point is a Linksys WRT54G, the following shows
the "Wireless Security" as "WPA Personal" or WPA-PSK.
The "ssid" is configured under "Basic Wireless Settings".


Build wpa_supplicant.
# rpm -e wpa_supplicant
# urpmi openssl-devel < /dev/null
# tar xzf wpa_supplicant-0.4.9.tar.gz
# cd wpa_supplicant-0.4.9
# cp defconfig .config
# make
# cp wpa_supplicant wpa_passphrase wpa_cli /usr/sbin
# strip /usr/sbin/{wpa_cli,wpa_passphrase,wpa_supplicant}
# cd ..
# rm -rf wpa_supplicant-0.4.9.tar.gz wpa_supplicant-0.4.9
Configure wpa_supplicant via the /etc/wpa_supplicant.conf
configuration file to connect to this Access Point.

Make /etc/wpa_supplicant.conf look like the following

Connect wlan0 to the Access Point.
# wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf
     Trying to associate with 00:14:bf:0c:e1:e3 (SSID='secret' freq=2437 MHz)
     Associated with 00:14:bf:0c:e1:e3
     WPA: Key negotiation completed with 00:14:bf:0c:e1:e3 [PTK=TKIP GTK=TKIP]
     CTRL-EVENT-CONNECTED - Connection to 00:14:bf:0c:e1:e3 completed (auth)
wpa_supplicant using WPA-PSK is ready.
^C to terminate wpa_supplicant.

At the moment the MythTV system is connected to the Access Point via ethernet.
It's time to switch to the wireless network.

This will be the new MythTV network configuration.
wifi network

aDSL router  :
Linux system : eth0
Access Point :
MythTV       : wlan0
The MythTV eth0 connection will be configured so that if the
wireless connection has a problem, a cable can be connected
between the aDSL router (built in switch) and MythTV eth0.
The Linux system will then be able to connect to MythTV via

Change these values in /etc/sysconfig/network-scripts/ifcfg-eth0
Change this value in /etc/sysconfig/network
Make /etc/sysconfig/network-scripts/ifcfg-wlan0 look like the following
Restart the network.
# service network restart
Remove the ethernet cable between the MythTV system and the Access Point.
Use /usr/local/sbin/netswitch to switch between wlan0 & eth0.


Build the latest openChrome driver,
setup xorg.conf and restart graphics.
The openChrome driver provides hardware
acceleration (XvMC) for decoding MPEG2.
# rpm -ivh

# urpmi zlib-devel flex bison pam-devel libpng-devel libexpat-devel \
        freetype2-devel fontconfig-devel jpeg-devel glide_v3-dri-devel < /dev/null

# rpmbuild -bc /usr/src/RPM/SPECS/xorg-x11.spec

# urpmi subversion < /dev/null
# chkconfig xinetd off

# svn co openchrome

# cd openchrome/unichrome
# xmkmf /usr/src/RPM/BUILD/xorg-x11-6.9.0/xc
# make
# make install

     install -c -m 0444 /usr/X11R6/lib/modules/drivers

# cd ../..
# rm -rf /usr/src/RPM/{BUILD,SOURCES,SPECS,SRPMS}/* openchrome
Information about Via Unichrome TV Out is here.
Make /etc/X11/xorg.conf look like the following
Section "Files"
    FontPath "unix/:-1"

Section "Module"
    Load "dbe"
    Load "v4l"
    Load "extmod"
    Load "type1"
    Load "freetype"
    Load "glx"
    Load "dri"

Section "InputDevice"
    Identifier "Keyboard1"
    Driver "keyboard"
    Option "XkbModel"   "pc105"
    Option "XkbLayout"  "us"
    Option "XkbOptions" "compose:rwin"

Section "InputDevice"
    Identifier "Mouse1"
    Driver "mouse"
    Option "Protocol" "PS/2"
    Option "Device"   "/dev/mouse"

Section "Device"
    Identifier "device1"
    Driver "via"
    Option "TVType"       "PAL"
    Option "TVOutput"     "Composite"
    Option "EnableAGPDMA" "true"
    Option "ActiveDevice" "TV"

Section "Monitor"
    Identifier "monitor1"
    HorizSync   31.5-35.1
    VertRefresh 50-61
    DisplaySize 300 225
    Option      "noDDC"

Section "Screen"
    Identifier        "screen1"
    Device            "device1"
    Monitor           "monitor1"
    DefaultColorDepth 24
    Subsection "Display"
        Modes "800x600"

Section "ServerFlags"
    Option "BlankTime"   "0"
    Option "StandbyTime" "0"
    Option "SuspendTime" "0"
    Option "OffTime"     "0"

Section "ServerLayout"
    Identifier  "default"
    InputDevice "Keyboard1" "CoreKeyboard"
    InputDevice "Mouse1"    "CorePointer"
    Screen      "screen1"
With /etc/X11/xorg.conf, the via driver in place
and a window manager (not twm) start the display manager
# urpmi ratpoison
# echo "/usr/bin/ratpoison" > ~mythtv/.xsession
# mkdir ~mythtv/.mdk-folders
# chown mythtv.mythtv ~mythtv/{.xsession,.mdk-folders}
# [ -e ~mythtv/.desktop ] && rm -f ~mythtv/.desktop
# [ -e ~mythtv/.dmrc ] && rm -f ~mythtv/.dmrc
# service dm start
# chkconfig dm on

Remote control

Install lirc.
# urpmi lirc < /dev/null
Enter the following DRIVER and DEVICE entries in /etc/sysconfig/lircd
Make /etc/lircd.conf look like the following
begin remote

  name  DVICO_MCE
  bits            8
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   48
  pre_data       0x100460000
  post_data_bits  8
  post_data      0xFE
  gap          195843
  toggle_bit      0

      begin codes
          ok                       0x5e
          up                       0x51
          down                     0x53
          left                     0x5B
          right                    0x5F
          setup                    0x16
          tv_onoff                 0x46
          guide                    0x0A
          dtv                      0x02
          mp3                      0x0E
          dvd                      0x1A
          cpf                      0x1E
          back                     0x49
          more                     0x59
          dvd_menu                 0x4D
          alt_tab                  0x55
          replay                   0x0F
          skip                     0x12
          start                    0x42
          vol_up                   0x15
          vol_down                 0x05
          ch_up                    0x11
          ch_down                  0x09
          photo                    0x52
          live                     0x5A
          folder                   0x19
          1                        0x0B
          2                        0x17
          3                        0x1B
          4                        0x07
          5                        0x50
          6                        0x54
          7                        0x48
          8                        0x4C
          9                        0x58
          0                        0x03
          ratio                    0x13
          zoom                     0x1F
          rew                      0x43
          playpause                0x47
          ff                       0x4F
          mute                     0x57
          stop                     0x0D
          rec                      0x01
          power_onoff              0x4e
      end codes

end remote
With /etc/sysconfig/lircd and /etc/lircd.conf in place start lircd
# service lircd start
Test the remote using 'irw'.
The following will lauch an 'xterm' running 'irw' on
the TV screen via ssh from the Linux system.
linux $ echo $DISPLAY
linux $ xauth list $DISPLAY  MIT-MAGIC-COOKIE-1  f5ffd1eed233911045e526607a3e4762

linux $ ssh mythtv@mythtv
mythtv@mythtv's password:

mythtv $ su - root -c 'urpmi xterm'

mythtv $ xauth
Using authority file /home/mythtv/.Xauthority
xauth> add . f5ffd1eed233911045e526607a3e4762
xauth> exit

mythtv $ DISPLAY=:0 xterm -e irw
Press buttons on the remote and you will see
dumps of the decoded key.
^C to kill the xterm.
mythtv $  su - root -c 'service dm stop'

DVB-T tuners

MythTV 0.19 can use a channels.conf file instead
of scanning or manually entering tuning parameters.
# urpmi dvb-apps

# scandvb /path/to/au-Melbourne > /etc/channels.conf.full

# for i in 'ABC1' '7 Digital' 'Nine Digital' 'TEN Digital' 'SBS:'
do grep -m 1 "^$i" /etc/channels.conf.full >> /etc/channels.conf
Test the 3 tuners with mplayer as the mythtv user.
$ su - root -c 'urpmi mplayer < /dev/null'

$ mkdir ~/.mplayer
$ ln -s /etc/channels.conf ~/.mplayer/channels.conf

$ mplayer -vo null -ao null dvb://1@'7 Digital'
  mplayer -vo null -ao null dvb://2@'Nine Digital'
  mplayer -vo null -ao null dvb://3@'TEN Digital'

     Playing dvb://3@TEN Digital.
     dvb_tune Freq: 219500000
     TS file format detected.
     PROBING UP TO 2000000, PROG: 0
     VIDEO MPEG2(pid=512)AUDIO MPA(pid=650) NO SUBS (yet)!  PROGRAM N. 0
     Opened TS demuxer, audio: 50(pid 650), video: 10000002(pid 512)...POS=28200
     VIDEO:  MPEG2  704x576  (aspect 3)  25.000 fps  12000.0 kbps (1500.0 kbyte/s)
     AUDIO: 48000 Hz, 2 ch, s16le, 256.0 kbit/16.67% (ratio: 32000->192000)
     Starting playback...

  q to quit


XMLTV is an XML specification for television guide data.
Information about various ways to get Australian XMLTV data is here.

Note: If the grabber uses an external configuration file (d1 grabber),
MythTV will use ~/.mythtv/_video-source-name_.xmltv as the configuration file
with the same content as shown below instead of ~/.xmltv/tv_grab_au.conf.
MythTV also expects the grabber name to be tv_grab_au.
The MytvTV backend runs tv_grab_au via mythfilldatabase to populated the guide data.

The following shows configuring the "dug", "d1" and "ltd" grabbers.

The dug grabber

The "dug" grabber uses data from JRobbo's EPG Guides
and is the following file.
The JRobbo guide can use "DW", "MY" or "OZ".
Configuring the dug XMLTV grabber is done within the script.
     my $GUIDE = '';


     my $url = $URL->{DW};

     my $REMAP = {
             'ABC' => '',
             'Nine' => '',
             'Seven' => '',
             'Ten' => '',
             'SBS' => '',


     my $url = $URL->{MY};

     my $REMAP = {
             'ABC-VIC' => '',
             'Nine-Mel' => '',
             'Seven-Mel' => '',
             'Ten-Vic' => '',
             'SBS-Vic' => '',


     my $url = $URL->{OZ};

     my $REMAP = {

The d1 grabber

The "d1" grabber uses data from
and is the following 2 files.
Configuring the d1 XMLTV grabber follows.
$ [ -d ~/.xmltv ] && rm -rf ~/.xmltv
$ tv_grab_au-d1 --configure
        tv_grab_au - (version 0.6.2 - release 2005-05-31)

using config filename /home/mythtv/.xmltv/tv_grab_au.conf
Grab listings for which region?
0: ACT - Canberra
1: NSW - Regional
2: NSW - Sydney
3: NT - Darwin
4: NT - Regional
5: Queensland - Brisbane
6: Queensland - Regional
7: SA - Adelaide
8: SA - Regional
9: Tasmania - Hobart
10: Tasmania - Regional
11: Victoria - Melbourne
12: Victoria - Regional
13: WA - Perth
14: WA - Regional
Select one: [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14 (default=3)] 11
Grab listings for which service?
0: Austar Analogue
1: Austar Digital
2: Foxtel Analogue
3: Foxtel Digital
4: Free to Air
5: Free to Air Digital
6: Free to Air Digital (High Definition)
7: Optus
Select one: [0,1,2,3,4,5,6,7 (default=4)] 5
ERROR! - no channel icon found for freesd.Melbourne.9!
ERROR! - no channel icon found for freesd.Melbourne.9-EPG!
add channel: TEN Digital? [yes,no,all,none (default=yes)] yes
add channel: TEN Digital 1? [yes,no,all,none (default=yes)] no
add channel: TEN Digital 2? [yes,no,all,none (default=yes)] no
add channel: TEN Digital 3? [yes,no,all,none (default=yes)] no
add channel: TEN Guide? [yes,no,all,none (default=yes)] no
add channel: TEN Guide? [yes,no,all,none (default=yes)] no
add channel: TEN Digital? [yes,no,all,none (default=yes)] no
add channel: ABC TV Melbourne? [yes,no,all,none (default=yes)] yes
add channel: ABC TV 2? [yes,no,all,none (default=yes)] no
add channel: ABC TV 3? [yes,no,all,none (default=yes)] no
add channel: ABC TV 4? [yes,no,all,none (default=yes)] no
add channel: 7 Digital? [yes,no,all,none (default=yes)] yes
add channel: 7 Olympic Extra? [yes,no,all,none (default=yes)] no
add channel: 7 Digital 2? [yes,no,all,none (default=yes)] no
add channel: 7 Digital 3? [yes,no,all,none (default=yes)] no
add channel: 7 Program Guide? [yes,no,all,none (default=yes)] no
add channel: Nine Digital? [yes,no,all,none (default=yes)] yes
add channel: Nine Guide? [yes,no,all,none (default=yes)] no
add channel: SBS DIGITAL 1? [yes,no,all,none (default=yes)] yes
add channel: SBS DIGITAL 2? [yes,no,all,none (default=yes)] no
add channel: SBS EPG? [yes,no,all,none (default=yes)] no
All done, run with no arguments to grab listings.
This creates ~/.xmltv/tv_grab_au.conf as follows
# tv_grab_au 0.6.2 config file
region Melbourne
service freesd
# "channel name" and "frequency" can be changed to suit
# [+yes/-no] [channel ID] [channel name] [frequency]
+channel freesd.Melbourne.10 "TEN Digital" 1
-channel freesd.Melbourne.10-1 "TEN Digital 1" 13
-channel freesd.Melbourne.10-2 "TEN Digital 2" 14
-channel freesd.Melbourne.10-3 "TEN Digital 3" 15
-channel freesd.Melbourne.10-EPG "TEN Guide" 11
-channel freesd.Melbourne.10-EPG2 "TEN Guide" 100
-channel freesd.Melbourne.10a "TEN Digital" 10
+channel freesd.Melbourne.2 "ABC TV Melbourne" 2
-channel freesd.Melbourne.2-2 "ABC TV 2" 21
-channel freesd.Melbourne.2-3 "ABC TV 3" 22
-channel freesd.Melbourne.2-4 "ABC TV 4" 23
+channel freesd.Melbourne.7 "7 Digital" 7
-channel freesd.Melbourne.7-1 "7 Olympic Extra" 71
-channel freesd.Melbourne.7-2 "7 Digital 2" 72
-channel freesd.Melbourne.7-3 "7 Digital 3" 73
-channel freesd.Melbourne.7-EPG "7 Program Guide" 77
+channel freesd.Melbourne.9 "Nine Digital" 9
-channel freesd.Melbourne.9-EPG "Nine Guide" 99
+channel freesd.Melbourne.SBS "SBS DIGITAL 1" 3
-channel freesd.Melbourne.SBS-2 "SBS DIGITAL 2" 33
-channel freesd.Melbourne.SBS-EPG "SBS EPG" 31

The ltd grabber

The "ltd" grabber is the following file.
Configuring the ltd XMLTV grabber is done within the script.

     $y7w_time_offset = 0;

     $y7w_channel_id{"ABC1"} =                  "";
     $y7w_channel_id{"Seven"} =                 "";
     $y7w_channel_id{"Nine"} =                  "";
     $y7w_channel_id{"TEN"} =                   "";
     $y7w_channel_id{"SBS"} =                   "";


logrotate(8) fails because both syslog (sysklogd) and
syslog-ng are configured to rotate the same files.
# rpm -e syslog-ng
Reduce the syslog (/etc/syslog.conf) noise.
# cd /etc
# patch -p0 < /path/to/syslog.conf-patch.txt
# service syslog restart
Remove some cron.daily jobs.
# rm -f /etc/cron.daily/{certwatch,rpm}
No need for virtual consoles.
# sed /mingetty/s/respawn/off/ < /etc/inittab > /etc/inittab2 && mv -f /etc/inittab2 /etc/inittab
# telinit q
Setup an NFS server for /mythtv
# urpmi nfs-utils < /dev/null

# echo -e /mythtv\\t\\t\*\(rw,sync,all_squash,anonuid=500,anongid=500\) > /etc/exports

# service nfslock start
# service portmap start
# service nfs start
Stop the processes that mythtv autologin starts (/etc/init.d/dm).
# cd /etc/init.d
# patch -p0 < /path/to/dm-patch.txt
Remove the autofsck thing from /etc/rc.d/rc.sysinit and /etc/rc.d/init.d/halt.
# cd /etc/rc.d
# patch -p0 < /path/to/rc.sysinit-patch.txt
# cd /etc/rc.d/init.d
# patch -p0 < /path/to/halt-patch.txt
# [ -e /.autofsck ] && rm -f /.autofsck