Home / MythTV #5 MythBuntu 16.04 on Intel DZ68DB DVB - C

MythTV #5 MythBuntu 16.04 on Intel DZ68DB DVB - C



Introduction

This page will be used to document the development of my 5th Mythtv system which will be based on the Intel DZ68DB moherboard, i3 2120T Processor and 3 Dual Terratec DVB-C tuners. It is not THE most perfect setup but just a documented setup of my system and preferences.

List of hardware

  • Motherboard: DZ68DB moherboard
  • CPU: Intel i3 2120T
  • Memory: Corsair Value Select 4 GB DDR3 (1333 MHz / PC3-10600) Ean's 0843591010061
  • Seagate 4TB ST4000DM005 Barracuda
  • PSU: Seasonic 80 PLUS Gold
  • Capture cards: 3 x Cinergy PCI HD Terratec (total of 6 recordings)
  • 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

Download and install mythbuntu

Download mythbuntu 16.04 and use unetbootin to put it on a USB stick
Boot from USB stick and install myhtbuntu

/dev/sda is large 4TB data disk
/dev/sdc1 is smaller 2.5" hdd for the OS

/dev/sda data disk
/dev/sdc1 mythbunty 16G ext4
/dev/sdc2 swap 8G

Remote Hauppauge TV (nothing selected)

mythbackend draait onder de user mythtv en maakt dus bestanden aan onder deze gebruiker
zorg er dus voor dat de data directory waarin myhthtv mag schrijven van mythtv.mythtv is.
mkdir /mythtv_data (holds mythtv Data)
mkdir /data (holds all my other file as a NAS server)
chown mythtv.mythtv /mythtv_data

Update system

sudo apt-get update
sudo apt-get upgrade

create initial backup

reboot and create backup using  sysrecue
chreate backup of root partition

mkdir /data
mount /dev/sda3 /data
mkdir /data/backup
dd if=/dev/sda1 of=/data/backup/mythbuntu16.04_update.dd
backup MBR
dd if=/dev/sda1 of=/data/backup/mythbuntu16.04_updateMBR.dd bs=512 count=1 

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. 
You can use e2label or gparted, a grafical tool to do the same in a user friendly way

LABEL=MythTVBoot /               ext4    errors=remount-ro 0       1
LABEL=mythtv_data /mythtv_data           ext4    defaults        0       2
LABEL=data /data           ext4    defaults        0       2
LABEL=Swap none            swap    sw              0       0

change /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="root=LABEL=MythTVBoot quiet splash"
uncomment: #GRUB_DISABLE_LINUX_UUID=true

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

Mythtv-setup

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

add video capture cards 
card type: dvb-T/S/C, ATSC or ISDB-T Tuner card
Frontend ID STV0367 DVB-C DVB-T syptype DVB-C
/dev/dvb/adapter0/frontend0
repeat for:
/dev/dvb/adapter1/frontend0
and
/dev/dvb/adapter2/frontend0

Kies recording options:
Max recordings: 2
v wait for SEQ start header
0 open DVB card on demand
v Use DVB card for active EIT scan 


video source name: tvguide
listings grabber: Transmitted quide only (EID)
Channel frequency table: default
Network ID: 4444 (werkt voor alle FTA kanalen)



input connections
=================
input name: dvbinput
video source: tvguide

Scan for channels=>
Desired Services: TV

v unencrypted only

Scan Type: Full Scan (Tuned)

Frequency: 474000000

Symbol Rate 6875000

Modulation QAM 64

(currently scanning fails /dev/dvb/adapter1/frontend0 has crw-rw---- should this be crw-rw-rw- as myth is the user that starts mythtv-setup? TODO)

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)

Mythfrontend settings

setup audio:
Setup->audio-> test -> finish (without this no sound?!)

General
screenshot path /data/screenshots (user mythtv, perm. 777)

setup->video->playback groups->default:
Skip Ahead: 30 sec
Skip Back: 15 sec

Mythwelcome

Use the Session and Settings tool (in XFCE menu) to configure startup applications
Uncheck:
- Update notifier
- screen saver
- XFCE Volume daemon
- Mythtv Frontend
Add:
/usr/bin/mythtwelcome
(press i when the mythwelcome page is open, to enter the settings screen)

Disable update notification

settigns->software & updates -> updates -> automatically check for updates: Never

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.
/usr/bin/xset dpms 0 0 0; /usr/bin/xset -dpms
(one of the xset commands should do, but just to be sure, I did both)
solved this. Add this as start up application

After powering off my TV and switching it back on, MythTV gave a black screen. Only after restarting X

 sudo service lightdm stop

 sudo service lightdm start

The screen came back. After some googling and trying different options this is what worked for me:

 

In the directory /usr/share/X11/xorg.conf.d

create a file "20-intel.conf" with this content:
Section "Device"
   Identifier  "Intel Graphics"
   Driver      "intel"
   Option     "Hotplug" "false"
EndSection

MySQL

You can find your root db password here:
In the apache config file:
/etc/apache2/sites-enabled/mythweb.conf

(look for db_password)

Remote Control

There seems to be a bug in the Lirc config. To fix it open:
/etc/lirc/hardware.confg
change
REMOTE_MODULES="lirc_dev lirc_i2c"
to
REMOTE_MODULES="lirc_dev"
(the kernel module lirc_i2c is not present, and with this configuration lirc will not work)
After this change reboot your system.

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

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 Digital Stereo (HDMI 2) + Analog stereo input.
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)  

Until this point this used to be enough, but now this didn't work so I had to pass an extra option to the kernel:
Edit /etc/default/grub and add the i915.disable_power_well=0 option.
GRUB_CMDLINE_LINUX_DEFAULT="i915.disable_power_well=0 root=LABEL=MythTVBoot"
recreate grub.conf by update-grub and restart your system.

somethings audio stops working and Pavucontrol switches back to default on the Configuration page.
Not loading the module-suspend-on-idle seems to fix this:
edit /etc/pulse/default.pa
comment the line:
#load-module module-suspend-on-idle

Installing Philips OVU412000 USB IR receiver

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

Frontend settings


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

MythWeb

After the default installation MythWeb had some errors. For example hen I selected the program list it gave a fatal error. The solution was found here.

A solution to the SQL Fatal Error mentioned above is a tweak to the /etc/mysql/conf.d/mythtv.cnf file. Add "sql_mode=NO_ENGINE_SUBSTITUTION" (without the quotation marks) to the end of the /etc/mysql/conf.d/mythtv.cnf file. I believe the error was caused by an incompatibility between mysql 5.7 and databases from older versions of mysql.

There may be other and better solutions (I imagine the problem will be fixed by the devs), but this one works for now.

Backup mysql database

/etc/cron.d/mysqlbackup
#
# 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

create directory to hold backups
#mkdir /data/mysqlbackup
/usr/local/bin/mysqlbackup
#!/bin/sh
mysqldump -u root -pmythtv --databases mysql mythconverg > /data/mysqlbackup/mythtv`date +%u`.sql
(this will create 7 backup files 1=Monday, 2=Tuesday.... and overwrite the files every week to save space)

#chmod 755 /usr/local/bin/mysqlbackup



Optimize database

To regularly optimize the database create a scipt /usr/local/bin/optimize_mythdb.sh

#!/bin/sh

OPT_MYTHDB='/usr/share/doc/mythtv-backend/contrib/maintenance/optimize_mythdb.pl'
LOG='/var/log/mythtv/optimize_mythdb.log'

echo "Started ${OPT_MYTHDB} on `date`" >> ${LOG}
${OPT_MYTHDB} >> ${LOG}
echo "Finished ${OPT_MYTHDB} on `date`" >> ${LOG}


and a cron job: etc/cron.d/optimize_mythdb

#
# 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 3 * * 1 root /usr/local/bin/optimize_mythdb.sh > /dev/null 2>&1

Full backup

Boot from USB rescue disk (e.g. Ubuntu live)
# sudo su - (become root)
# mkdir /data (create mount point)
# mount /dev/sda1 /data (mount MythTV data disk on /data, this is where we will store the backup of the boot disk sdb1)
# mkdir /data/mythtvbackup
# dd if=/dev/sdb of=/data/mythtvbackup/yyyymmddMythtv16_04MBR.dd bs=512 count=1 (backup master boot record of mythtv disk)
# dd if=/dev/sdb1 of=/data/mythtvbackup/yyyymmddMythtv16_04Root.dd status=progress (backup root file system of mythtv disk)

The dd backups can be a good backup if your disk crashes. If you just need one file, you can also make a file backup
# mkdir /mythtvroot (create mount point)
# mount /dev/sdb1 /mythtvroot
# mkdir /mythtvroot/FilesAndFolders
# tar cf - . | (cd /data/mythtvbackup/FilesAndFolders && tar xBf -)

HDMI CEC Pulse Eight

TODO

Open Problems

I'm very happy with my current setup, although I have one problem to fix:

On one if the 3 tuners cards I have enabled the "Use DVB card for active EIT scan.

This will every so often lock the card out from recording, so I can only record from 4 channels. Reboot seems to solve the issue temporary.





     RSS of this page