Home / MythTV #4 MythBuntu 12.04 on Intel DZ68DB

MythTV #4 MythBuntu 12.04 on Intel DZ68DB




Introduction

This page will be used to document the development of my 4th Mythtv system which will be based on the Intel DZ68DB moherboard, i3 2120T Processor and Quad Hauppauge Tuner.
You can also find my previous mythtv build here in this wiki.

List of hardware

  • Motherboard: DZ68DB moherboard
  • CPU: Intel i3 2120T
  • Memory: Corsair Value Select 4 GB DDR3 (1333 MHz / PC3-10600) Ean's 0843591010061
  • Western Digital WD10EZRX 1G green HDD
  • PSU: DC-DC ATX 150W 20PIN ITX Motherboard/Micro-ATX Motherboard Power Supply + Universal 12V 8A 96W AC/DC Power Supply Adapter Charger for PC LCD monitor TV
  • Capture cards: 2 x Hauppauge PVR500 (total of 4 tuners)
  • Case: Silverstone GD07B
  • IR receiver: Philips OVU412000 USB IR
  • LCD display: 20X4 LCD Smartie USB display Sure Electronics
  • USB-CEC adapter for HDMI (Pulse Eight)

BIOS Update

The Intel DZ68DB came with an older BIOS. To update the BIOS (not having a Windows PC) you have the option to place the .BIO file on a USB thumb driver (FAT32), remote the yellow BIOS jumper from the motherboard and boot the system with te thumbdrive plugged in. I'll take a few minutes for the firmware to flash. The process is very simple, but you have to open the case to access the motherboard

installing mythbunty

Download MythBunty 64bits .iso file and use Unetbootin (or similar) to create a bootable USB stick
Boot from USB stick, place the A-Data USB3.0 stick in the machine and run "Install Mythbuntu 12.04"

Created  1 ext2 partition of the full 16G:
(data disk wil be added later.)

Note: we don't use SWAP as 4G is more than enough for mythtv and we don't wan to wear out the USB stick with the O.S.

username: myth (mythtv is reserverd)
Select: primairy backend w/Frontend
Select all additional services (vnc, ssh, samba, nfs and mythtv services)
Select "USB Y Serial Remote support via LIRC"
Select "Hauppauge TV card" and unselect Generate dynamic button mapping

update the system

apt-get update
apt-get upgrade
reboot the system (a new kernel is used)

modify grub.cfg

Add a rootdeley to the current kernel. This was necessary because the USB thumb drive took longer to initialize, causing fsck to fail, because the disk (stick) is not ready.
change /etc/default/grub

 

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
->
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rootdelay=10"

 

This is my complete /etc/default/grub (played a lot with all the options before it was stable in a USB3.0 port)

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash rootdelay=10" GRUB_CMDLINE_LINUX=""

update /boot/grub/grub.cfg:

update-grub

Network settings

Disable DHCP and set IP, NM, DG etc.
This can easily be done with the Gnome Nerwork manager (/usr/bin/nm-connection-editor)

Disk labels vs UUID

Mythbuntu uses UUID instead of disk labels. This means you can't simply create an image of a system and restore it on a new harddisk. I prever to use disk labels. 
# sudo e2label /dev/sdb1 mythtv


change /etc/fstab
LABEL=mythtv / ext2 defaults,noatime,nodiratime 0 0

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

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

USB flash drive precautions 

Flash drives die if the files are re-written over and over. Therefore we have to take some precautions so the flash drives doesn't wear out to soon:

- no acccess time
- reduce or no swap
- disable ext4 journalling (or choose a non journalling file system like ext2)
- no logging to disk (only in memory)

no access time

Add the noatime (no access time), no diratime (same for directories instead of files) and data=writeback options after the defaults parameters for each drive, except swap. Modified line should read something like:

 

/dev/sda2 / ext2 defaults,noatime,nodiratime 0 0

 

Reduce swappiness

Reduce swappiness to make the operating system avoid the use of the swap area and prefer to use the memory modules instead. Open your /etc/sysctl.conf file with the gedit text editor, make a new line at the bottom of the file and add this:

vm.swappiness=10

 

Because I didn't create a swap file at all, this action was not nessecary.

Use ramdisk

 

Using a ramdisk instead of the thumb drive to store temporary files will speed things up and will cause no writes in flash memory. Downside: it will cost you a few megabytes of RAM.

Open your fstab file:

sudo gedit /etc/fstab

Add this line to fstab to mount /tmp (temporary files) as tmpfs (temporary file system):

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

Reboot for the changes to take effect. Running df, you should see a new line with /tmp mounted on tmpfs:

 

tmpfs 513472 30320 483152 6% /tmp

same for /var/tmp

For /var/log it is a little more difficult. We use the aufs (AnotherUnionFS) filesystem for this, which allows you to join to mount points (in this case, one on disk/flash and one in memory)

Some daemons expect a certain directory structure in var log. It can't be an empty directory on system start.

First create a template directory structure based an the current directories in /var/log:

mkdir /var/log.template

cd /var/log

Copy all files en dirs from /var/log to /var/log.template preserving ownership and permissions

tar cvf - . | (cd /var/log.template/; tar xvf -)

Remove all files 

cd /var/log.templage

find . -type f -exec rm {} \;

edit /etc/fstab and add: 

tmpfs /var/log.memory tmpfs rw,noexec,size=64M 0 0
aufs /var/log aufs br=/var/log.memory:/var/log.template=ro 0 0

then

sudo mkdir /var/log.memory
sudo mount /var/log.memory
sudo mv /var/log /var/log.orig
sudo mkdir /var/log
sudo mount /var/log

If we ever need to add directories to the template, simply add them to /var/log.template

Add storage disk

For storage I added a 3.5" regular 1T disk. I chose the WD green drive for two reasons:
- less power, 0.4W idle (less heat)
- less noise

First add the disk and find out the device name
Check for old partitions and delete them:
fdisk /dev/sdb
p (to list the current parition table)
d (to delete partitions)
n (to add a new partition)
p (to create a primairy partition)
1 (to create the first partition)
(create 500G mythtvdata partition)
t (type)
83 (linux)
n (to add a new partition)
p (to create a primairy partition)
2 (to create the second partition)
(rest of the drive is voor other data storage)
t (type)
83 (linux)

w (write and quit)

Now format the partition:
mkfs.ext4 /dev/sdb1
mkfs.ext4 /dev/sdb2
add a label
e2label /dev/sdb2 mythtvdata
e2label /dev/sdb1 data

edit /etc/fstab and add:
LABEL=data /data ext4 defaults,noatime,nodiratime 0 1
LABEL=mythtvdata /data/mythtv ext4 defaults,noatime,nodiratime 0 1

create the mount point
mkdir /data
mount the filesystem
mount -all

Now lets move the mythtv data from /var/lib to /data
cd /var/lib
mv mythtv /data/mythtv
mv mythdvd /data/mythdvd
ln -s /data/mythtv mythtv
ln -s /data/mythdvd mythdvd

Wester Digital WD drive spin down

The whole idea behind using an USB stick for the OS, was to be able to spin down de storage HDD when not in use. This saves energy, creates less heat and makes less noise. The  disk (although quiet silent) is the component that creates the most noise! The PSU is 100% silent, the large silverstone fans are very quiet.
Normally hdparm -S 1 will spin down the disk in 5 seconds. I used this method to test hdparm (didn't want to wait a whole hour for the disk to spin down) but it didn't work! Then I used hdparm -y wich immediately spins down the disk. So the disk is able to spin down. I also tried recording to a spinned down disk and this worked as well. The disk spun up, and was ready by the time the buffer was full. Googling around to find out why the WD disk didn't obey the -S 1, I came across some posts that the WD only accepts spin down time larger (or equal) to 10 minutes. Tested it out and YES! it worked. This applies to this Western Digital HDD (WD10EZRX) but I've read the same about the WD Raptor and other drives. They also only accepted values over or equal to 10 minutes.

I'm not sure if hdparm is persistent or not so I created a file /etc/hdparm.conf:
/dev/sda {
   spindown_time = 240
}

Another issue I have with this disk is the noise it makes. When the drive is spinning (not even moving it's head), it makes a high frequency sound. This is very disapointing. I have a 100% quiet PSU, fans that are very very quiet so the sound of this disk is 5 times more the all the rest together. Hopefully fixing the drive without touching the metal might help (some rubber banding setup) but I still have to try that....

Sudo setup

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

Display

Display setup didn't need anything special. De monitor was recognized by X and all settings worked without change.
xscreensaver was a little annoying. I disabled the screensaver function but after a suspend, it asked for a login password. I ended up with simply removing xsreensaver completely (why do you want a screensaver on your HTPC anyway...)
apt-get remove xscreensaver

After that, the screen turned black after a few minutes idle.
xset dpms 0 0 0 
solved this. 

The mouse pointer is shown. This can be hidden by the unclutter command:
sudo apt-get install unclutter 

./unclutter -root -idle 1 -reset -display :0 

Mythwelcome

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

Disable the auto start of mythfrontend (press i when the mythwelcome page is open, to enter the settings screen)

MythWelcome tweak

The Mythbuntu theme which I use, now has a bug (I think) in the Mythwelcome page. If you hit OK on the remote, the frontend will start. In previous versions of mythwelcome, you had visual feedback from the page that you had pressed the OK button (the text "start frontend" had a sort of butten behind it, which hilited when the OK button was pressed). This visual feedback is now gone, and because it takes one or two seconds for mythfrontend to show, you'll end up pressing the button a few times, wondering if the IR signal was received. I created a small workaround for this, so you'll get al little bit of feedback again.

First install the dzen2 package
# apt-get install dzen2
then run the mythwelcome setup and change the frontend startup line:
# mythwelcome --setup
mythfrontend command: /usr/local/bin/mythfrontend_osd

Create a little script /usr/local/bin/mythfrontend_osd:
#!/bin/sh
TIME=1
XPOS=375
YPOS=900
HEIGHT=60
FGCOLOR='yellow'
TITLEWIDTH=600
FONT='-bitstream-bitstream charter-medium-r-normal--48-0-0-0-p-0-iso8859-1' echo $MESSAGE | \
dzen2 -p $TIME \
-x $XPOS \
-y $YPOS \
-fg $FGCOLOR \
-tw $TITLEWIDTH \
-fn '-bitstream-bitstream charter-medium-r-normal--48-0-0-0-p-0-iso8859-1' /usr/bin/mythfrontend
MESSAGE="Starting Frontend..."

That's it. dzen2 can handle lots of options to create the text excactly on the place and with the size and font you want. I positioned the window just on top of the normal "start frontend" button.

(not needed for Mythwelcome version 25.30, so simply choose that theme now)

Sound

analog sound

strart alsamixer from the commandline
increase volume to max. 
Test plugin a headset and start:
# play /usr/share/sounds/alsa/*

/etc/asound.conf 
pcm.analog {
        type hw
        card 0
        device 0 
}
pcm.digital {
        type hw
        card 0
        device 1  
}
pcm.hdmi0 {
        type hw
        card 0
        device 3 
}
pcm.hdmi1 {
        type hw
        card 0
        device 7 
}
pcm.!default {
        type  plug
        slave.pcm "hdmi1"
}


hdmi sound

To get sound over HDMI I've installed pulseaudio:
apt-get install pulseaudio pavucontrol

Start pavucontrol en select the desired output on the config page. (Digital Stereo (HDMI) output + Analog Stereo Input)
TODO: I want both analog out (to receiver) *and* hdmi out (to TV)
Configure mythtv (to use Pulseaudio) Setup->Audio.

Sound over HDMI and Analog

First, users need to understand the system's audio layout. This is accomplished using aplay which is part of the alsa-utils package.
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

The key to a configuration like this is to understand that whatever is selected in pavucontrol under Configuration>Internal AUdio is the default device. Load pavucontrol>Configuration and select HDMI as the profile.
Add the following to /etc/pulse/default.pa to setup the analog as a secondary source:
### Load analog device
load-module module-alsa-sink device=hw:0,0
load-module module-combine-sink sink_name=combined
set-default-sink combined
Restart PulseAudio, run pavucontrol and select the "Output Devices" tab. You can now show the virtual Output devices.

Now start a program that will use pulseaudio such as mplayer, vlc, mpd, etc. and switch to the "Playback" tab. A pulldown should be available for the running program to select one of the three sources.
Make sure to set Alsa:pulse in the mythtv setup (setup->audio: "Audio output device"=ALSA:pulse)  

MySQL

By default the mythtv db user has a generated? password jbkYW23r
If you want to change this to something you can remember, change it in the followin places:

  1. sudo dpkg-reconfigure mysql-server-5.5
  2. New password for the MySQL "root" user: mythtv
  3. Repeat password for the MySQL "root" user: mythtv
 

In the apache config file:
/etc/apache2/sites-enabled/mythweb.conf
(look for db_password)

Remote Control

After testing the Hauppauge remote, it turned out that most of the key presses would get a double keypress making it very hard to navigate. Only sometimes I got a single key press.
Googled a bit and found a solution where every "config =.." line in the mythtv file (/home/myth/.lirc/mythtv) is preceded with this line "config = echo '' > /dev/null"

So for example the section of the Right button looks like this:

begin
    remote = Hauppauge_350
    prog = mythtv
    button = Right
    config = echo '' > /dev/null
    config = Right
    repeat = 0
    delay = 0
end

This does the trick, however the remote wasn't responding as quick as I was used to (on my previous mythtv, the menu's could follow my key presses no mather how fast I tried to navigate, now it's a little slower. Not as slow as the usual consumer electronics but also not as fast as I would like it to be).

I looked through the config files and noticed that the hauppauge config files (hauppauge_350) did not only contain my remote config, but also from some other hauppauge devices. This resulted sometimes in the same codes from different remotes. For example in the file /usr/share/lirc/extras/more_remotes/hauppauge/lircd.conf.hauppauge the code for Right (0x0000000000001797) was listed at the Hauppauge_350 and at the Hauppauge_WinTV_Nexus-S remote.
I removed the complete sections of all devices except from Hauppauge_350. After that, it worked like I was used to....

Most of the time I use the TV guide and the Recorded video's menu. So I created a few jumppoints to get there quickly with a single button:

configure jumppoints:
start mythweb en go to settings->mythtv->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

Installing Philips OVU412000 USB IR receiver

No special tweaks neede. Just plug it in, reboot and you're done.

Other settings

In Ubuntu disable the screensaver (who thought it was a good idea to turn this on default in MythBuntu?!)

In the MythtvFrontend:
setup->video>playback->next:
on playback exit: save position and exit

setup->video->Program Guide
1/1 Guide starts at channel: 6

disable jobs
setup->video->general->next->next
disable commercial detection
disable metadata lookup

Default always record some extra time
s etup->video->general
start recording -120sec
end recording +600secd

Mythtv General setup

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

configure tuners

Start mythtv setup
General:
- TV Format = PAL
- Channel freq. teable = europe west
- allow commercial detection jobs: off

Add capture cards

- new capture card
For PVR500 select MPEG-2 encoder card. We have 2 PVR500 so 4 caputercards (/dev/video0.../dev/video3) should be created.

add video source

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

create input connecions

[MPEG: /dev/video0] (Tuner 1) -> tvguide
[MPEG: /dev/video1] (Tuner 1) -> tvguide
[MPEG: /dev/video2] (Tuner 1) -> tvguide
[MPEG: /dev/video3] (Tuner 1) -> tvguide

set video default video profile
change the recording resoltions from 480 x 576 to 768 x 576 (or 720 x 576??)

import channel info

don't use the channel editor but import xmltv data
wget http://www.xxxx/mythtv/data.xmltv.gz
mythfilldatabase --file --sourceid 1 --xmlfile data.xmltv

fill in the rest via mythweb (settings->tv->channel info):
http://localhost/
add channel number, frequency and set all channels to commercial fee (I don't want commercial flagging)

Update program guide daily

create a cron job /etc/cron.d/getXmlTv

# /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  *   *   *  myth      [ -x /home/myth/xmltv/get_xmltv.sh ] && /home/myth/xmltv/get_xmltv.sh 2>/dev/null
install git
apt-get install git
mkdir /home/myth/xmltv
cd /home/myth/xmltv
git clone https://github.com/tvgrabbers/tvgrabnlpy/

create get_xmltv.sh script in /home/myth/xmltv
#!/bin/sh
# Name:     get_xmltv.sh
# Function: get XMLTV data from tvgids.nl and save it in a file to use with Mythtv
# Date:     2008/11/01
# Created:  
#
# Note: script is started from the cronjob
documentroot=`dirname $0`
if [ "${1}" = "-delay" ]
then
sleep 180
fi
# get the latest version of tv_grab_nl_py
cd ${documentroot}/tvgrabnlpy
git pull origin
cd ..
chmod 755 ${documentroot}/tvgrabnlpy/tv_grab_nl.py
# get XMLTV info
${documentroot}/tvgrabnlpy/tv_grab_nl.py --compat --days=4 --config-file ${documentroot}/tv_grab_nl_py.conf --cache ${documentroot}/cache-file --output ${documentroot}/data.xmltv  > ${documentroot}/err
.txt 2>&1
# import it into the MySQL database
mythfilldatabase --file --sourceid 1 --xmlfile data.xmltv

The tv_grab_nl_py.conf file contains a list of channels to grab

# encoding: utf-8
# These are the channels to parse. You can disable a channel by placing
# a '#' in front. You can change the names to suit your own preferences.
[tvgids.nl Channels]
1 NPO 1
2 NPO 2
3 NPO 3
4 RTL 4
.....


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.
The delay is to make sure all process are running like network and mythbackend before the scripts starts

sudo -H -u myth bash -c '/home/myth/xmltv/get_xmltv.sh -delay' & 

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 including the SureElec.so driver

d
apt-get install lcdproc

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

driver=SureElec
DriverPath=/usr/local/lib/lcdproc/
ServerScreen=blank
[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

Restart LCDd to read config file:
/etc/init.d/LCDd restart
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.

Now tell mythtv to use lcdproc:
Setup->Appearance Enable LCD device

Disk labels vs UUID

Mythbuntu uses UUID instead of disk labels. This means you can't simply create an image of a system and restore it on a new harddisk or in this case a new thumbdrive. I prever to use disk labels. 

# sudo e2label /dev/sda1 mythtv
change /etc/fstab
LABEL=mythtv / ext2 defaults,noatime,nodiratime 0 1
change /etc/default/grub
uncomment: #GRUB_DISABLE_LINUX_UUID=true
Change /etc/grub.d/10_linux (credits):
After line 122 add 2 lines:
auto_label="`e2label ${GRUB_DEVICE_BOOT} 2>/dev/null`"
linux_root_device_thisversion="LABEL=${auto_label}"
Change /usr/lib/grub/grub-mkconfig_lib:
  # If there's a filesystem UUID that GRUB is capable of identifying, use it;
  # otherwise set root as per value in device.map.
  echo "set root='`${grub_probe} --device ${device} --target=drive`'"
  #if fs_label="`${grub_probe} --device ${device} --target=fs_uuid 2> /dev/null`" ; then
    #echo "search --no-floppy --fs-uuid --set ${fs_uuid}"
  #fi
auto_label="`e2label ${device} 2>/dev/null`"
echo "search --no-floppy --label ${auto_label} --set root"
(3 lines are commented out, and 2 lines are added)

update /boot/grub/grub.cfg: 
# update-grub

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;

sudo chmod 755 /usr/local/bin/mythmon

sudo vi /etc/cron.d/mythtmon

#
# 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

recording Schedule


One of my favorite recordingschedules is the Formula 1 power search:

(program.title LIKE '%Formule%1%'
or
program.title LIKE '%Formula%I%'
or
program.subtitle LIKE '%Formule%1%'
or
program.subtitle LIKE '%Formula%I%')
AND
(channel.callsign = 'RTL4' OR
 channel.callsign = 'RTL5' OR
 channel.callsign = 'SBS6' OR
 channel.callsign = 'RTL7')

Set priority +10

upnp

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

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

samba

share data (music, videos, docs...) for Windows systems
# vi /etc/samba/smb.conf
[global]
workgroup = MYTHTV
server string = mythtv
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
[mythtv]
comment = MythTV Data
path = /data/mythtv
browsable = yes
read only = no
writable = yes
force user = userx

# share external disk
[data]
comment = MythTV 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

Make sure user 'userx' (or whatever you chose here) is present on the system.

MythWEB

Because my MythWEB is accessible through the internet, I wanted to protect it with a simple .htaccess file in /var/www/mythweb:
AuthName "MythTV login"
AuthType basic
AuthUserFile /var/www/mythweb/.htpasswd

<limit GET>
satisfy any
order deny,allow
deny from all
allow from 10.0.0.0/8 
allow from 172.16.0.0/12
allow from 192.168.0.0/16
allow from 127.0.0.1/32
allow from 127.0.1.1/32
require valid-user
</limit>
Create the password file:
cd /var/www/mythtv
htpasswd .htpasswd <username>

nfs

share data for linux systems
# sudo vi /etc/exports
add the export for example: 
/data/mythtv 192.168.2.8(rw,async,no_root_squash,no_subtree_check)
/extdata 192.168.2.8(rw,async,no_root_squash,no_subtree_check)

if nfs is already running, reread the config from /etc/exports by running:
# sudo exportfs -ra

Connecting to TV

All setup has been done with a small 17" monitor. Now it's time to make some final adjustments before hooking it up to a TV.
TV resolution for full HD: -x 1920 -y 1080

backup mysql database

cronjob
#
# backup mysql database
#
# 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
15 3 * * * root /usr/local/bin/mysqlbackup

/usr/local/bin/mysqlbackup
#!/bin/sh
mysqldump -u root -pmythtv --databases mysql mythconverg > /data/sqlbackup/mythtv`date +%u`.sql

HDMI CEC Adapter for USB

Because the Intel HDMI connector does not support CEC, I use an external adapter the filters the CEC signals from the HDMI connection and passes that to the USB port. A little driver than adds support for CEC to the MythTV system. 
For those who do not know the purpose of HDMI-CEC: It's a cool protocol that sends the singals of you TV remote control to the mythtv system. This way you will be able to control you mythtv without switching remotes.

Installing from the repository will result in version 2 cec witch does not work with my version of ubuntu... so I followed this:
https://github.com/Pulse-Eight/libcec
apt-get install pkg-config
apt-get install libudev-dev
sudo apt-get install automake
sudo apt-get install libtool
sudo apt-get install autoconf
apt-get install build-essential
apt-get install liblockdev1-dbg

Download version 1 from github:
https://github.com/Pulse-Eight/libcec/archive/libcec-1.9.0.tar.gz
# autoreconf -vif
# ./configure
# make
# sudo make install

sudo ln -s /usr/local/lib/libcec.so /usr/lib/libcec.so

backup usb stick

After all the work, we're going to create a copy of the USB stick, just in case....
Powerdown the machine and put the usb stick with OS and all settings in a different linux machine, or boot from another linux USB stick
Then:
create backup using dd. For example:
dd if=/dev/sdf1 of=/localdata/backup/mythtv20141012.dd (fill in the right device name and backup location)
create a backup of the master boot record:
dd if=/dev/sdf of=/localdata/backup/mythtv20141012MBR.dd bs=512 count=1 (again, fill in the right device name and backup location)
and if you want to save you extended partitions in a text file, so you can use it later with sfdisk:
sfdisk -d /dev/sdf > /localdata/backup/mythtv20141012.sfdisk

Contact

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



     RSS of this page