Home  »  Mythbuntu 9 10 on ASRock ION 330

Mythbuntu 9 10 on ASRock ION 330

Tags:  


introduction

For a few years now, I'm an happy user of MythTV. The First MythTV system I build (usering a Pundit-R and Fedora Core 2) took me 3 months to run smoothly. The second one (Fedora Core 5) was ready in about a week. This 3-tuner Mythtv system runs for three years now and I'm very happy with it. But there are some improvements to make:
  • The system uses to much (100 Watt) power.
  • I have a separate network harddisk for backup of my websites and storage of media and files that need to be accessible 24/7.
  • The systems makes to much noise (although it was selected as hardware that is quite).
  • My Linux knowledge can use a refresh. Building a MythTV system is always good for some extra knowledge.

criterea

So, before starting to buy hardware you need to consider what functions the system should have. This I my list:

  • Record analog (PAL) video. The system should be able to record 3 programs simultaneously and playback 2 at te same time.
  • Act as an FTP server for my web backups
  • Run a UPnP server for my kitchen webradio to stream mp3 files
  • Store presonal data for my home pc's
  • Run 24/7. (no more waiting for MythTV to startup).
  • Playback DVD and if possible Full HD content.

BIOS update

TIP: B
efore you start, unplug al the USB devices except your keyboard and USB stick with the BIOS update. After updating my ASRock, I spend hours to get rid of the "CMOS checksum error" because the keyboard didn't work with the USB tuners plugged in.

power up the ASRock Ion
If you can't read the menu that displays in a split second, here it is:
F2 is BIOS setup (from BIOS version > 1.60 you can also use the DEL key for setup)
F6 is BIOS flash tool
F11 boot menu

BIOS update
before starting to install the system, first check to see if there are any BIOS updates from the manufacturer. Mine got delivered with P1.50 but ASRock had P1.50 as latest stable BIOS so I flashed this one. The process of flashing a new BIOS is very simple:
Dowload the latest BIOS from the ASRock website (make sure you have the right one!!!)
  1. Save the BIOS files on a device such as USB disk, hard disk.
  2. Press during POST to get into BIOS setup menu.
  3. Select the utility under [Smart] menu to execute it.
  4. ASRock Instant Flash will automatically detect all devices and only list those BIOS versions which are suitable for your motherboard.
  5. Select the suitable BIOS version and flash.
WARNING: don't turn off the power when the flash process is busy or you'll end up with a brick.

BIOS settings
One of the settings I made was that this system starts after the power is switched in (you don't want to shut down a server after a short power loss)

Mythtv 0.22 on my ASRock ION 330 system using Mythbuntu 9.10

This manual give's an overview of how I installed Mythtv 0.22 on my ASRock ION 330 system using Mythbuntu 9.10
Besides the ASRock ION 330 I use
  • 3 Hauppauge USB tuners
  • 1 Hauppauge remote control
  • 1 Silvershield powerswitch with USB
  • 1 fast USB hub with external power supply and
  • 1 USB IR receiver
The idea behind using the Silvershield (and extra IR receiver and USB hub) is to switch off the 3 tuners when they are not recording and when the MythFrontend (liveTV) is not used. This saves about 45Watt (3 x 15Watt).

Read also these separate pages:
introduction
criteria
hardware selection
silencing the ASROck ION 330
BIOS update

installing mythbuntu 9.10

Download Mythbuntu and check MD5SUM
burn to CD or use UNetbootin to create a bootable USB stick from the iso (this saves you a CD :-)

/dev/sda1 ext3 /boot 200 MB
/dev/sda2 ext4 / 20000MB
/dev/sda3 swap 3000MB
/dev/sda4 ext4 /data rest

name : asrock
computername: asrock

installation type: Prim. backend with frontend

services:
enable
VNC
SSH
Samba
NFS
Mythtv

Enable a remote control:
Hauppauge TV card

Selected video dirver: Nvidia

install....
shutdown system, remove USB stick and power on.
----
Setup screen apears
language: English

host: localhost
db: mythconverg
user: mythtv
password: MLW6EkdS

networking

network

First, check out what your current settings are.

ifconfig -a

Take a note what your current broadcast, subnet mask, and gateway settings are. Also, have you decided on an IP address for your Mythbuntu box yet?

Next, issue this command to modify the Mythbuntu box its network settings.

sudo vi /etc/network/interfaces

You probably only see a set of "lo", or loopback, settings. Add a new set for "eth0" so that the whole content of the file looks something like the following. Note your addresses may be different.

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.2.6
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1

Finally, restart the network card with the following command.

sudo /etc/init.d/networking restart

--

update system

Use update manager to update all software

reboot

udev setup

When you hook up multiple pvrusb2 tuners to your ASRock they show up as /dev/video0, /dev/video1, /dev/video2..... etc.
I've had some problems with tuners not unregistering themselves correctly. For example /dev/video1 was still there even if all three tuners were powered down. After the tuners got powered on again I ended up with
/dev/video0
/dev/video1
/dev/video2
/dev/video3

When mythbackend started to record from /dev/video1 it produces an error (from the mythbackend log):
Channel(/dev/video1)::Open(): Can't open video device, error "Input/output error"

I've googled the Internet and found a solution from Steve Gudmundson:
He shows how to use fixed device names based on the serial numbers of the USB device instead of creating a 'random' number. Below is a (slightly modified) copy of his files:

create a file:
/etc/udev/rules.d/pvrusb2.rules:
KERNEL=="video[0-9]*", PROGRAM="/usr/local/bin/udev-pvrusb2.sh %m", SYMLINK+="video_%c", OWNER="mythtv", GROUP="mythtv"

and a script:
/usr/local/bin/udev-pvrusb2.sh
#!/bin/bash

# author: Steve Gudmundson

pvrusb2=/sys/class/pvrusb2
search=$pvrusb2/sn-*
timeout=15

# find the serial number for this device #
count_seconds=0
minor_num=-1
until [ $count_seconds -gt $timeout ]
do
   sleep 1
   count_seconds=`expr $count_seconds + 1`
   for file in $search
   do
      minor_num=`cat $file/v4l_minor_number`
      if [ $minor_num -eq $1 ]
      then
         serial_num=.${file//$pvrusb2//}.
         echo $serial_num
         exit 0
      fi
   done
done

echo unknown_$1
exit 0

Power on the tuners and look for the device names. You need these in the next step
ls /dev/video-sn*

tuner setup
connect al 3 tuners and check if you get /dev/video0..2

Start mythbuntu control center from the Applications->System menu
Startup behavior
- automaticly login asrock
- disable frontend startup (we are going to use mythwelcome)
Services
- enable ssh, samba, nfs and vnc
MySQL
- enable daily optimaize repair
- enable perf. tweaks
Start mythtv setup
General:
- TV Format = PAL
- Channel freq. teable = europe west
Capture cards
- new capture card

WARNING:
If you follow this installation consecutive than you're find.
If you have installed the Silvershield switch and then perform this action you're in trouble. Starting mythtv-setup will close down Mythbackend AND power down the tuners. With no tuners attached there are no /dev/video* devices and you can't install them.

capturecard setup
(plug in the Hauppauge USB devices before adding capture cards!)
card type: IVTV MPEG-2 encoder card (The card type is a little strange since it's no ivtv card but an v4l card but it works :-))
tuner 1: /dev/video_.sn-8086011. (default input=television)
tuner 2: /dev/video_.sn-8038312. (default input=television)
tuner 3: /dev/video_.sn-7771497. (default input=television)

add video source
video source name: tvguide
listings grabber: no grabber (we use direct db import)

input connection
[MPEG: /dev/video_.sn-8086011.] (television) -> tvguide
[MPEG: /dev/video_.sn-8038312.] (television) -> tvguide
[MPEG: /dev/video_.sn-7771497.] (television) -> tvguide

(I accidentally set the Preset Tuner To Channel to 4 in stead of the Starting Channel and could not record or play live TV. In the mythbackend.log I got:
2009-11-13 19:55:08.882 TVRec(1) Error: Failed to set channel to 4. Reverting to kState_None
After removing the Preset Tuner To Channel value it worked fine)

don't use the channel editor but import xmltv data
wget http://domain/mythtv/
mythfilldatabase --file 1 data.xmltv

fill in the rest via mythweb (settings->tv->channel info):
http://localhost/
add channel number, frequency and comm. flag

setup cron job to get tvlistings

getting TV guide info:
# /etc/cron.d/getXmlTv: get TV guide info for MythTV
#
# m   = minute           (0-59)
# h   = hour             (0-23)
# dom = day of the month (1-31)
# mon = month            (1-12)
# dow = day of the week  (0-7)
#
# m h dom mon dow user    command
  0 5  *   *   *  root      [ -x /usr/local/bin/getXmlTv.sh ] && /usr/local/bin/ge
tXmlTv.sh 2>/dev/null

you can also add one line to your /etc/rc.local so that after a reboot, the data gets imported (so you don't have to wait for the cron job to kick in.
/usr/local/bin/getXmlTv.sh &



create a script: /usr/local/bin/getXmlTv.sh
#!/bin/sh
#
# Name: getXmlTv.sh
# Function: get xml tv data as one gzip file from external site
# Date: 2009/09/06
# Created:
# Modified:

xmltvURL=http:.....

cd /tmp

# get the data
wget ${xmltvURL}data.xmltv.gz

# unzip it
gunzip -f data.xmltv.gz

# import it into the MySQL database
mythfilldatabase --file 1 data.xmltv

rm data.xmltv

graphics setup

edit /etc/X11/xorg.conf file:
configure widescreen (Acer AT3202 1360x768 60Hz)
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 1.0 (pbuilder@www.hydrix.com) Sun Oct 4 01:58:07 UTC 2009

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "Module"
Load "dbe"
Load "extmod"
Load "type1"
Load "freetype"
Load "glx"
EndSection

Section "ServerFlags"
Option "Xinerama" "0"
EndSection

Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "kbd"
EndSection

Section "Monitor"
# HorizSync source: edid, VertRefresh source: edid
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 31.0 - 60.0
VertRefresh 55.0 - 75.0
Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "Unknown"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "TwinViewXineramaInfoOrder" "CRT-0"
Option "metamodes" "1360x768_60 +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection

start nvidia settings
X server display configuration
Save to X config file (do not use old settings)

Sudo setup

setup sudo so that asrock user doesn't need a password to use sudo
# sudo visudo
add this as the last line:
asrock ALL=NOPASSWD: ALLasrock ALL=NOPASSWD: ALL

MythWelcome

Use the Session and Settings tool (in XFCE menu) to configure startup applications
Uncheck:
- Bluetooth
- network manager
- Update notifier
- XFCE Volume daemon
Add:
/usr/bin/mythtwelcome


create /usr/local/bin/myMythFrontend

#!/bin/sh

sudo /usr/local/bin/silvershield.sh -o &

/usr/bin/mythfrontend


Start mythwelcome setup:
# mythwelcome -s
Frontend: /usr/local/bin/myMythFrontend
Start reboot en shutdown with sudo (user asrock has no permission to shutdown)

Do not start mythfrondend when mythwelcome is started:
hit i in mythwelcome to configure not to start the frontend whent mythwelcome is started

Sound

I use the analog Sound output on my ASRock.

Open Mixer (Applications->MultiMedia->Mixer
Click select controles and select Front
Increase to max.
Test plugin a headset and start:
# play /usr/share/sounds/alsa/*

HDMI Sound

Open Mixer and unmute HDMI
For audo to HDMI and line out at the same time, create /home/asrock/.asoundrc
pcm.!default {
type plug
slave {
pcm "both"
}
}

pcm.both {
type route
slave {
pcm multi
channels 6
}
ttable.0.0 1.0
ttable.1.1 1.0
ttable.0.2 1.0
ttable.1.3 1.0
ttable.0.4 1.0
ttable.1.5 1.0
}

pcm.multi {
type multi
slaves.a {
pcm "tv"
channels 2
}
slaves.b {
pcm "receiver"
channels 2
}
slaves.c {
pcm "analog"
channels 2
}
bindings.0.slave a
bindings.0.channel 0
bindings.1.slave a
bindings.1.channel 1
bindings.2.slave b
bindings.2.channel 0
bindings.3.slave b
bindings.3.channel 1
bindings.4.slave c
bindings.4.channel 0
bindings.5.slave c
bindings.5.channel 1
}

pcm.tv {
type hw
card 0
device 3
channels 2
}

pcm.receiver {
type hw
card 0
device 1
channels 2
}

pcm.analog {
type hw
card 0
device 0
channels 2
}

Remote Control

Hauppauge remote works without any modifications
configure jumppoints:
start mythweb en go to settings->key bindings
Program Guide: Ctrl+g
TV Recording Playback: Ctrl+p
Main menu: Ctrl+m

edit /home/asrock/.lirc/mythtv and add:
begin
remote = Hauppauge_350
prog = mythtv
button = Videos
config = Ctrl+p
repeat = 0
delay = 0
end

begin
remote = Hauppauge_350
prog = mythtv
button = Guide
config = Ctrl+g
repeat = 0
delay = 0
end

begin
remote = Hauppauge_350
prog = mythtv
button = Go
config = Ctrl+m
repeat = 0
delay = 0
end
begin

# add delete button to the remote
remote = Hauppauge_350
prog = mythtv
button = red
config = d
repeat = 0
delay = 0
end

# add two buttons to solve the "Allow Channel Jumping in Guide" bug in 0.22
# key 1 and 7 don't go one day back/forward so we use two extra buttons for that
begin
remote = Hauppauge_350
prog = mythtv
button = yellow
config = Home
repeat = 0
delay = 0
end

begin
remote = Hauppauge_350
prog = mythtv
button = blue
config = End
repeat = 0
delay = 0
end

# add button to get the menu back in the Watch Recording page that displays several options
# Before 0.22 you would get this menu by hitting the right key on a recording.
begin
    remote = Hauppauge_350
    prog = mythtv
    button = Prev.Ch
    config = I
    repeat = 0
    delay = 0
end


Path Settings

The default location for mytthv files is /var/lib/mythtv. I want to store all data on a separte /data/ partition:

# sudo cp -R /var/lib/mythtv /data/
# sudo rm -rf /var/lib/mythv
# sudo ln -s /var/lib/mythtv /data/mythtv
# sudo chown -R asrock.asrock /data/mythtv

mkdir /data/video
mkdir /data/music
mkdir /data/photo

chown asrock:asrock /data/*

You can modify the recording location with mythtv-setup (Option 6. Storage directories)

frontend settings:
video settings->general->path that holds videos: /data/video/

Other settings

utilities->setup->tv settings->playback->next:
on playback exit: save position and exit

utilities->setup->tv settings->Guide
2/2 Guide starts at channel: 6

Default always record some extra time
utilities->setup->tv settings->general
start recording -120sec
end recording +600sec

vdpau

enable vdpau for tv In mythfrontend
utilities / setup-> Setup -> TV Settings -> playback -> next -> next
Select video playback profile VDPAU Normal

connecting the ASRock to the TV

My TV doesn't have a HDMI plug, only some scart plugs, analog audio/video and a PC VGA + audio plug.
The use the menu's in high res, I choose to use the VGA and audio.

The TV resolutions is 1366 x 768 (also called HD-Ready)
The prefered frequency for the VGA input is 60Hz

widescreen playback
recordings
utilities->setup->tv settings->playback->next: zoom=full

videos
utilities->setup->media-video->player: replace -fs -zoom with -x 1360 -y 768 (HD Ready) 
or, for full HD: -x 1920 -y 1080
In the old days, X could be restarted by CTRL ALT BCKSP, now use Right Alt + PrintScreen (SysRq) + k

saving power with the Gembird silvershield SIS-PMS


start the external tuners when
- a program needs to be recorded
- the frontend is started

Install the software to control the Gembird Silver Shield SIS-PMS:
# sudo apt-get install sispmctl

test it
# sudo sispmctl -o 1 (switch port 1 on)
# sudo sispmctl -f 1 (switch it off)
... see man sispmctl for all options

install mythtv-status:
apt-get install mythtv-status
remove the cronjob /etc/cron.d/mythtv-status or comment out the mythtv-status line (we are building our own monitoring tool).

create script:
#!/bin/sh

# name:     silvershield.sh
# function: power the tuners on and off for mythtv to save energy
#           when powering on all tuners after myhthtv is fully working
#           not all tuners are regognized all the time. Sometimes /dev/video*
#           is not created or mythtv says the tuner is asleep. Because of this
#           I've added a high speed USB hub, and switch the power of that
#           a few seconds after powering on the tuners. This works better.
# language: sh
# date:     2009/09/14
# author:   GJW
# modified:
#
# - start this script with the -o at boot time so mythtbackend will 
#   initialize the tuners correctly
# - start this script with the -o option when mythfrontend is started 
#   (for live TV or instant recording
# - start this script with the -c option from a cron job every 10 minutes
# - add sleep commands between tuner shut off to let the system unregister
#   the tuners properly
LOGFILE=/var/log/mythtv/silvershield.log
nrMinutes=999
if [ "$1" = "-h" ]
then
cat <<EOF
silvershield.sh usage:
======================
silervershield.sh -[h|o|f|g|c]
 -h (print this help)
 -o (which ports on)
 -f (switch ports off)
 -g (check port status)
 -c (check if ports should be on or off)
EOF
fi
silvershield_on()
{
   sispmctl -b off
   # power on tuners
   sispmctl -o 2
   sispmctl -o 3
   sispmctl -o 4
   # power on USB hub
   sleep 3
   sispmctl -o 1
 echo `date` : ON >> $LOGFILE
   sleep 2
}
silvershield_off()
{
   sispmctl -b off
   # power off the tuners (wait a few seconds before powering down the next one to let the system unregister the device properly
   sispmctl -f 1
   sleep 3
   sispmctl -f 2
   sleep 3
   sispmctl -f 3
   sleep 3
   # power off the USB hub
   sispmctl -f 4
   echo `date` : OFF >> $LOGFILE
}
silvershield_status()
{
   sispmctl -b off
   sispmctl -g 1
   sispmctl -g 2
   sispmctl -g 3
   sispmctl -g 4
}
minutesToNextRecording()
{
   mythStatus=`/usr/bin/mythtv-status \
                          --noschedule-conflicts  --nototal-disk-space \
                          --nodisk-space --noguide-data --noauto-expire \
                          --nostatus --noscheduled-recordings`
   echo $mythStatus >> /tmp/silvershield.log
   echo "" >> /tmp/silvershield.log
   
   isRecording=`echo $mythStatus | \
      grep 'Recording Now:'`
   if [ "$isRecording" = "" ]
   then
      # Now that we have the mythtv-status we will check if all three tuners
      # are up and running. If not, restart the backend. This has nothing to do
      # with the silvershield script but is just a quick hack to have the tuners
      # ready at all time. We only do this if there are no recordings active
      tuner1status=`echo $mythStatus | grep 'asrock (1) -'`
      tuner2status=`echo $mythStatus | grep 'asrock (2) -'`
      tuner3status=`echo $mythStatus | grep 'asrock (3) -'`
      # if a tuner status is missing, that tuner is not seen by mythbackend
      if [ "$tuner1status" = "" -o "$tuner2status" = "" -o "$tuner3status" = "" ]
      then
         echo `date` >> /tmp/silvershield.log
         echo "" >> /tmp/silvershield.log
         echo "$tuner1status" "$tuner2status" "$tuner3status" 
         echo " -> restarting backend" >> /tmp/silvershield.log
         echo `date` >>  /tmp/silvershield.log
         /sbin/stop mythtv-backend  >> /tmp/silvershield.log 2>&1
         /sbin/start mythtv-backend >> /tmp/silvershield.log 2>&1
         echo `date` >>  /tmp/silvershield.log
         echo " -> backend restarted" >> /tmp/silvershield.log
         exit
      fi 
      # end of quick hack
      nrMinutes=`echo $mythStatus | \
         grep 'Next Recording In:' | \
         sed 's/.*Next Recording In: //' | \
         awk '{ if ( $2 == "Minutes" ) print $1; else print "999" }'`
      # if this doesn't result in a valid nr. of minutes, fill in 999
      if [ "$nrMinutes" = "" ]
      then
         nrMinutes=999
      fi
   else
      nrMinutes=0
   fi
}
if [ "$1" = "-o" ]
then
   silvershield_on
fi
if [ "$1" = "-f" ]
then
   silvershield_off
fi
if [ "$1" = "-g" ]
then
   silvershield_status
fi
# check recording status and switch on or off
if [ "$1" = "-c" ]
then
   frontendRunning=`ps -ef | grep mythfrontend.real | grep -v grep`
   # if frontend is running, power is on no need for further testing
   if [ "$frontendRunning" = "" ]
   then 
      # frontend is not running
      # check if mythtv is recording or about to start a recording
      minutesToNextRecording
      if [ "$nrMinutes" -le 11 ]
      then
         silvershield_on  
      else
         silvershield_off
      fi
   fi
fi


Add Pre and Post script to upstart conf file of mythtv-backend (/etc/init/mythtv-backend.conf)
pre-start script
# power on the tuners before staring mythbackend
/usr/local/bin/silvershield.sh -o
sleep 5
end script

post-stop script
# power off the tuners after stopping mythbackend
/usr/local/bin/silvershield.sh -f
end script


Other powersavings


I don&apos;t want MythTV to waste it's time on commercial flagging (creating heat and sound).
Disable commercial flagging:
It&apos;s in Utilities/Setup->Setup->TV Settings->General. On the third screen,
labeled "General (Jobs)", there are checkboxes for default JobQueue settings
for new recordings. The very first one is "Run commercial flagger".


power saving options:
/etc/sysctl.conf
add
# calm down swappiness
vm/swappiness=0

recommended reading:
http://www.spencerstirling.com/computergeek/powersaving.html
http://www.linuxjournal.com/article/7539

the HD led flashes every second (only in Mythbuntu 9.04):
disable mtd
# sudo vi /usr/share/mythbuntu/session.sh
comment the lines:
#If we have mtd around (and not running), good idea to start it too
#if ! `pgrep mtd>/dev/null`; then
# if [ -x /usr/bin/mtd ]; then
# /usr/bin/mtd -d
# fi
#fi

after that every 2 seconds the led flashes
This is caused by the hal daemon. It probes for a SATA dvd.

The haldaemon polls any cd/dvd drives for inserted media, every 2 seconds.
If you have a cd/dvd drive on the same controller as the hard drive, that will
also cause the light to flash, even though it isn't the hard drive being accessed.

To disable polling of the cd/dvd drive, run
"lshal |grep info.udi|grep storage>hal.txt" In the hal.txt file, find the line
for your cd/dvd and run (as root)
# hal-disable-polling --udi '/org/freedesktop/Hal/devices/storage_model_DVD_RW__DVR_111D'
replace the udi string, with the one for your cd/dvd.

Note you&apos;ll have to manually mount/umount the cd/dvd, after this change.
If you want to re-enable the device polling, delete the file it created from
/etc/hal/fdi/information/

If you remove the swap partition from the /etc/fstab, the system won&apos;t access the disk for swap. (Linux sometimes swaps even if it has enough memory). The system has 2G which is MORE than enough for a MythTv system.

Installing Philips OVU412000 USB IR receiver

During the installation process of mythbuntu we have chosen for the Hauppauge remote. That created a set of lirc config files. These work for the Hauppauge PVRUSB2 tuners. We cat 3 ir devices (/dev/lirc0 .. lirc2). The problem with saving power by switching off the tuners is that you can&apos;t use the build in ir receivers to start mythfrontend with your remote. So we need an USB IR receiver that is not switched off. I use the Philips OVU412000 for that. It&apos;s a good looking device which is very sencitive so you don&apos;t need to point your remote excactly to the device for a good reception.

After connecting this device you get an extra (/dev/lirc3) device. The problem is, that after switching of the tuners, lirc crashes. And if you restart lirc, the device now has a new device number (/dev/o lirc0). This results in unpredictable behavior. One solution is to disable the Hauppauge IR receivers by not loading the kernel modules. Therefore /etc/lirc/hardware.conf file was modified:
REMOTE_MODULES="lirc_dev lirc_i2c"
was changed to:
REMOTE_MODULES="lirc_dev lirc_mceusb"
After that, the IR of the build in tuners no longer work and we only have one /dev/lirc file that won't change.

Monitoring backend

sudo vi /usr/local/bin/mythmon

#!/bin/bash
#
# /usr/local/bin/mythmon
# This is run from cron every 10 minutes.
#

# check for mythbackend running
ps -C mythbackend > /dev/null && exit 0;

# also check for mythtv-setup running (it closes the backend)
ps -C mythtv-setup > /dev/null && exit 0;

# append message to log files ...

echo "`date +%Y-%m-%d %T.%-3N` /usr/local/bin/mythmon: mythbackend not running!!!"
>> /var/log/mythtv/mythbackend.log;
echo "`date +%Y-%m-%d %T.%-3N` /usr/local/bin/mythmon: mythbackend not running!!!"
>> /var/log/mythtv/mythmon.log

service mythtv-backend start > /dev/null
exit 1;

(be sure that you&apos;ve modified the mythtv-backend upstart file to power on the tuners before starting mythbackend)

sudo chmod 755 /usr/local/bin/mythmon

#
# monitor the mythbacked service and restart it if it exists
# reboot weekly to clean up
#
#
# m = minute (0-59)
# h = hour (0-23)
# dom = day of the month (1-31)
# mon = month (1-12)
# dow = day of the week (0-7)
#
# m h dom mon dow user command
01,11,21,31,41,51 * * * * root /usr/local/bin/mythmon
0 3 * * 7 root /usr/local/bin/weekly_reboot

# sudo vi /usr/local/bin/weekly_reboot
#!/bin/bash
#
# /usr/local/bin/weekly_reboot
# reboot the system once every week to clean up
# (only reboot if no recordings are busy)
#

minutesToNextRecording()
{
mythStatus=`/usr/bin/mythtv-status --noencoders
--noschedule-conflicts --nototal-disk-space
--nodisk-space --noguide-data --noauto-expire
--nostatus --noscheduled-recordings`
#echo $mythStatus >> /tmp/silvershield.log
isRecording=`echo $mythStatus |
grep 'Recording Now:'`
if [ "$isRecording" = "" ]
then
nrMinutes=`echo $mythStatus |
grep 'Next Recording In:' |
sed 's/.*Next Recording In: //' |
awk '{ if ( $2 == "Minutes" ) print $1; else print "999" }'`
# if this doesn't result in a valid nr. of minutes, fill in 999
if [ "$nrMinutes" = "" ]
then
nrMinutes=999
fi
else
nrMinutes=0
fi
}

# check recording and frontend status
frontendRunning=`ps -ef | grep mythfrontend.real | grep -v grep`
# if frontend is running do nothing (try again next week :-)
if [ "$frontendRunning" = "" ]
then
# frontend is not running
# check if mythtv is recording or about to start a recording
minutesToNextRecording

if [ "$nrMinutes" -gt 5 ]
then
reboot
fi
fi


upnp


Mythtv UPNP does not work with Lenco IR-2100
The mythtv backend uses UPNP to stream video to the frontend, so don&apos;t disable mythtv upnp

install ushare (geexbox lightweight UPNP server)
# apt-get install ushare
# vi /etc/ushare.conf
USHARE_DIR=/data/music
# /etc/init.d/ushare start


mythmusic

Before you start playing music it is highly recommended that you configure the MythMusic Player to show your entire music tree. This is probably the single biggest reason that people struggle with MythMusic GUI. You can set this in Utilities/Setup->Setup->Media Settings->Music Settings->Player Settings->show entire music tree
create music dir /data/music
copy mp3 files to /data/music
Point MythMusic at the directory in which your music collection is, by changing the location of your music library:
* Utilities/Setup → Setup →Media Settings-> Music Settings → General settings.
Then:
* Utilities/Setup → Music tools → Scan for New Music.
MythTV will then scan for music and add the information into the MythTV database.

You can change the way MythMusic displays your music collection, goto Utilities/Setup->Setup->Media Settings->Music Settings->General Settings->Tree Sorting.

Possible values here are space-separated list of genre, splitartist, splitartist1, artist, album, and title OR the keyword "directory" (without the quotes) to indicate that the onscreen tree mirrors the file system.

samba


share data (music, videos, docs...) for Windows systems
# vi /etc/samba/smb.conf
[global]
workgroup = MYTHTV
server string = ASRock
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
dns proxy = no
security = share
hosts allow = 192.168.2.
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = no

# share Mythtv data
[data]
comment = ASRock Data
path = /data
browsable = yes
read only = no
writable = yes
force user = userx

# share external disk
[extdata]
comment = ASRock External Data
path = /extdata
browsable = yes
read only = no
writable = yes
force user =  

# media share is read only accessible  for guests. This is done because XMBC (wich is used as one of the MythTv clients, does nog support encrypted passwords anymore
# The other alternative is to set "encrypt passwords = no" in the /etc/samba/smb.conf file but this has the disadvantage of having to modify M$ XP installations to be able to connect using plain text passwords.

[media]
comment = Public Shares
browsable = yes
path = /extdata/media
public = yes
writable = no
write list =  
guest ok = yes

nfs

share data for linux systems
# sudo vi /etc/exports
add the export for example: /data 192.168.2.4(rw,async,no_root_squash,no_subtree_check)
if nfs is already running: reread /etc/exports
# sudo exportfs -ra

Disk labels vs UUID

Mythbuntu uses UUID instead of disk labels. This means you can&apos;t simply create an image of a system and restore it on a new harddisk. I prever to use disk labels. First we list our current partitions:
asrock@mythtv:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 19228276 2922252 15329276 17% /
/dev/sda1 186663 47207 129819 27% /boot
/dev/sda4 285359900 31075884 239788568 12% /data

# sudo e2label /dev/sda5 root
# sudo e2label /dev/sda1 boot
# sudo e2label /dev/sda4 data

change /etc/fstab
LABEL=root / ext4 relatime,errors=remount-ro 0 1
LABEL=boot /boot ext3 relatime 0 2
LABEL=data /data ext4 relatime 0 2
/dev/sda3 none swap sw 0 0

change /etc/default/grub
uncomment: #GRUB_DISABLE_LINUX_UUID=true

update /boot/grub/grub.cfg:
sudo grup-mkconfig > /boot/grub/grub.cfg

installing mplayer

Mythtv now uses an internal player for most parts. If you want to be able to use mplayer, install it whith the command:
#sudo apt-get install mplayer

20X4 LCD Smartie USB display

I found it very annoying to always turn on the tv to check the mythtv status or to listen to mythmusic. After buying a new tv and AV surround receiver that where connected with HDMI, it was more than annoying! To select your music, you need to turn on the TV. If you've selected your music to play, you can power off the TV but the HDMI signals the receiver to turn off as well, so you need to power up the reciever again. This is why I purchased a nice external (USB connected) LCD device from Sure Electronics.

The USB device is listed by lsusb as:
ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x Composite Device 
lcdproc now days contain the driver for the Smartie display. However the binary package does not contain the driver so here are the steps to download and compile lcdproc

download the source from cvs:
cvs -z3 -d:pserver:anonymous@lcdproc.cvs.sourceforge.net:/cvsroot/lcdproc co -P lcdproc
download and install the following packages:
sudo apt-get install libusb-dev autogen automake
compile source code
sh ./autogen.sh
./configure –enable-drivers=SureElec
make
sudo make install

change the file /usr/local/etc/LCDd.conf

driver=SureElec
DriverPath=/usr/local/lib/lcdproc/

[SureElec]
# Port the device is connected to  (by default first USB serial port)
#Device=/dev/ttyUSB0
Device=/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0

Edition=3
Contrast=200
Brightness=480
Execute /usr/local/sbin/LCDd, and you should get a Clients: 0 and Screens: 0 on the LCD display.

To see something more interesting, start a client application. For example, start 'lcdproc -f' on the command line.

backup

now is a good time to create a backup of the boot and root partition. We created a ext4 root partition so we can't use partimage for that.
You CAN use fsarchiver for that.
Reboot from a sysrescue cd, plug-in a backup USB disk and mount it. For example:
mkdir /mnt/usbdisk
mount /dev/sdc2 /mnt/usbdisk

create the backup
fsarchiver -j3 savefs /mnt/usbdisk/root.fsa /dev/sda5 (check what device contains your root)
fsarchiver -j3 savefs /mnt/usbdisk/boot.fsa /dev/sda1 (check what device contains your boot)

Adding an extra frontend

I wanted to use my old mythtv as an extra frontend to use elsewhere in the house. Besides installing the frontend I had to change this to the ASRock mythtv backend:

Start mythtv backend setup from the control center
Set local backend IP address 192.168.2.6 (your IP may be different)
Set security pin to 0000
Set master backend IP address to 192.168.2.6

Read this page 
for the installation of this frontend

Bugfixing

 

Mythtv-status gives an error:

Unable to find any value for drive_total_total while looking at Total Disk Space
Unable to find any value for drive_total_used while looking at Total Disk Space
Something is wrong calculating the disk space percentage. These same messages are mailed by cron every 10 minutes. Running mythtv-status as root gave the expected output except for the
total space area, where this text was inserted: Total Disk Space: Total space is __drive_total_total__ MB, with
__drive_total_used__ MB used (unknown) The problem seems to be at line 246, this test is succeeding and the
total space calculation is trying to run expecting the older XML file
format.:

'protocol_version' => [ ">= 32" ],

I have changed the line to this and it appears to be fixed:

'protocol_version' => [ ">= 32 && < 39" ],

contact

If you want to send me an email send it to gacmb5 at gmail dot com.




 RSS of this page