My Ubuntu VDR Installation

Last updated $Date: 2008-11-10 20:37:29 $

Martti Kupar inen <martti.kuparinen@iki .fi>

http://www.iki.fi/kuparine/comp/vdr/

Abstract

This is how I installed and configured our multimedia PC running Ubuntu and VDR.


Table of Contents

1. Introduction
2. Overview
3. Installing the operating system
4. Installing VDR
5. Configuring VDR
6. Starting the VDR client
7. Miscellaneous stuff
8. References

Introduction

This article describes how I built the multimedia PC in our living room. The reason for building this was to replace the separate DVD player and DVB receiver, to get rid of few remote controllers and to have a "total solution" for our family.


Overview

Hardware

ComponentDescriptionNotes
Antec Fusion 430CaseManual and FAQs
Abit AN-M2HD AM2Motherboard
Kingston 2 x 1 GiB 800MHz DDR2RAM
AMD Athlon X2 BE-2350 AM2CPU
NVIDIA Geforce 7050PVGPUnvidiafb does not work *
ALC883 chipsetSoundcardHDMI audio problems with NVIDIA, see [1] and [2] **
2 x Samsung T166 500 GBHDDUse HUTIL to set acoustic mode
Samsung SH-S202J/BEWN DVD±RWConnect to a Windows PC during firmware upgrade ***
3 x Terratec Cinergy T USB XXSDVB-TSee this to install the required drivers
IR receiverIR
Logitech Harmony 555Remote controller
*Loading the nvidiafb results in "nvidiafb: Device ID: 10de053b" and "nvidiafb: unknown NV_ARCH". Use Xorg with some window manager to get a graphical screen.
**I connect my multimedia PC to an external amplifier with optical cable so this is not an issue for me.
***Confirmed with the Finnish Samsung technical support, the firmware upgrade application needs Windows and there is no boot floppy or CD ISO image available. I'd buy another drive if I were you...

Software

ComponentVersionDescription
Ubuntu8.04.1Installed from the 64-bit alternate install CD
VDR1.6.0-2Video Disk Recorder with 1.6.0-1, 1.6.0-2, cap_sys_nice, cutter marks, liemikuutio, parentalrating content and ttxtsubs patches
bitstreamout0.85Play AC3 sound over a sound card
epgsearch0.9.24Extensive EPG searching capabilities
femon1.6.3Display the signal information using OSD
lcdproc0.0.10Connects to lcdproc
osdteletext0.5.1Teletext support
remote0.4.0Support the built-in remote control port of DVB cards
rssreader1.6.2RSS feed reader
skinsoppalusikka1.6.2A nice skin
streamdevCVS 20081101Stream Live-TV to other VDRs
svdrpservice0.0.4Provide SVDRP service for other plugins
xineliboutput1.0.3Framebuffer and/or X11 frontend for VDR
vdradmin-am3.6.2Web-based administration tool for VDR

Installing the operating system

Installing Ubuntu

I started by installing Ubuntu 8.04.1 from the 64-bit alternate installation CD and then installed some additional features.

HDD partitions and file systems created during initial installation:

File systemTypeSize (GiB)Physical partitions
/ext310RAID1: /dev/md0 = /dev/sda1 + /dev/sdb1
swapswap2 * 1/dev/sda2 + /dev/sdb2
/homejfs455RAID1: /dev/md1 = /dev/sda3 + /dev/sdb3

df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/md0              9,2G  963M  7,8G  11% /
varrun                881M  168K  881M   1% /var/run
varlock               881M     0  881M   0% /var/lock
udev                  881M  100K  881M   1% /dev
devshm                881M     0  881M   0% /dev/shm
/dev/md1              456G   53M  456G   1% /home
tmpfs                 881M  868K  880M   1% /tmp

sudo vi /etc/fstab

/dev/md0        /               ext3    errors=remount-ro 0     1
/dev/md1        /home           jfs     defaults        0       2
/dev/sda2       none            swap    sw              0       0
/dev/sdb2       none            swap    sw              0       0
proc            /proc           proc    defaults        0       0
tmpfs           /tmp            tmpfs   defaults        0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec 0  0

cd /
sudo ln -s /home/video

Installing and configuring additional software

Shutting down unwanted services


sudo aptitude install rcconf
sudo rcconf

AMD Cool 'n' Quiet


sudo aptitude install powernowd
sudo vi /etc/default/powernowd

OPTIONS="-q"

sudo /etc/init.d/powernowd restart
dmesg | grep powernow

[ 3915.198363] powernow-k8: Found 1 AMD Athlon(tm) X2 Dual Core Processor BE-2350 processors (2 cpu cores) (version 2.20.00)
[ 3915.200144] powernow-k8:    0 : fid 0xd (2100 MHz), vid 0xc
[ 3915.200149] powernow-k8:    1 : fid 0xc (2000 MHz), vid 0xd
[ 3915.200151] powernow-k8:    2 : fid 0xa (1800 MHz), vid 0xf
[ 3915.200153] powernow-k8:    3 : fid 0x2 (1000 MHz), vid 0x16

cat /proc/cpuinfo | grep MHz

cpu MHz         : 1000.000
cpu MHz         : 1000.000

Temperature information


sudo aptitude install hddtemp
sudo hddtemp /dev/sd?

/dev/sda: SAMSUNG HD501LJ: 32°C
/dev/sdb: SAMSUNG HD501LJ: 32°C

sudo aptitude install lm-sensors
sudo sensors-detect

...
To load everything that is needed, add this to /etc/modules:

#----cut here----
# Chip drivers
w83627ehf
k8temp
#----cut here----

Do you want to add these lines automatically? (yes/NO) YES

sudo /etc/init.d/module-init-tools
sudo sensors

SSH


sudo aptitude install openssh-server
sudo vi /etc/ssh/sshd_config

PermitRootLogin no
...
AllowUsers myloginname

sudo vi /etc/hosts.allow

sshd: 127.0.0.1 192.168.1.

sudo vi /etc/hosts.deny

ALL : ALL : severity auth.info

sudo /etc/init.d/ssh restart

NFS


sudo aptitude install nfs-kernel-server
sudo vi /etc/exports

/home	192.168.1.0/24(ro,all_squash)

/etc/init.d/nfs-kernel-server reload

Samba


sudo aptitude install samba
sudo vi /etc/samba/smb.conf
sudo /etc/init.d/samba restart

Postfix


sudo vi /etc/aliases

postmaster:	root
root:		myname.somewhere@domain.com

sudo newaliases
sudo vi /etc/postfix/main.cf 
sudo /etc/init.d/postfix restart
date | mail -s TESTING root

mdadm


sudo vi /etc/mdadm/mdadm.conf 

MAILADDR root

SMART


sudo aptitude install smartmontools
sudo vi /etc/default/smartmontools

enable_smart="/dev/sda /dev/sdb"
start_smartd=yes

sudo vi /etc/smartd.conf

TBD

/etc/init.d/smartmontools restart

Minimalistic Xorg


sudo aptitude install xserver-xorg-core
sudo aptitude install xserver-xorg-input-kbd xserver-xorg-input-mouse
sudo aptitude install nvidia-glx-new
sudo aptitude install gdm
sudo aptitude install openbox

Next configure gdm to automatically login user vdr and make sure openbox is started as the window manager. In the Security tab activate "Enabled Automatic Login" and select vdr as the user. Activate also "Enable Timed Login" and select vdr as the user. Set "Pause before login" to e.g. 10 seconds.


sudo gdmsetup

Next make openbox automatically start the VDR client upon login.


sudo mkdir -p ~vdr/.config/openbox
sudo vi ~vdr/.config/openbox/autostart.sh

# Read global settings
. ${GLOBALAUTOSTART}

# My own stuff
/usr/local/bin/vdrx -H localhost -P 37890 -f &

sudo chmod 755 ~vdr/.config/openbox/autostart.sh
sudo chown -R vdr:vdr ~vdr/.config

Miscellaneous


sudo aptitude install screen

Installing DVB drivers

Now the operating system should be installed and ready for VDR. Before going any futher, I made sure that the DVB receivers were correctly detected by the Linux kernel. I have three receiver cards as seen below.

ls -l /dev/dvb/adapter*
/dev/dvb/adapter0:
total 0K
crw-rw---- 1 root video 212, 0 2008-11-08 17:22 demux0
crw-rw---- 1 root video 212, 1 2008-11-08 17:22 dvr0
crw-rw---- 1 root video 212, 3 2008-11-08 17:22 frontend0
crw-rw---- 1 root video 212, 2 2008-11-08 17:22 net0

/dev/dvb/adapter1:
total 0K
crw-rw---- 1 root video 212, 4 2008-11-08 17:22 demux0
crw-rw---- 1 root video 212, 5 2008-11-08 17:22 dvr0
crw-rw---- 1 root video 212, 7 2008-11-08 17:22 frontend0
crw-rw---- 1 root video 212, 6 2008-11-08 17:22 net0

/dev/dvb/adapter2:
total 0K
crw-rw---- 1 root video 212,  8 2008-11-08 17:22 demux0
crw-rw---- 1 root video 212,  9 2008-11-08 17:22 dvr0
crw-rw---- 1 root video 212, 11 2008-11-08 17:22 frontend0
crw-rw---- 1 root video 212, 10 2008-11-08 17:22 net0

Installing VDR

The mkvdr.sh script (and the corresponding mkvdr.conf) will fetch, patch, build and install VDR. All binaries and configuration files are installed into /usr/local/vdr-VERSION-DATE so you can have multiple VDR installations at the same time. The startup scripts will automatically select the newest version but if you need to use an older version, you can create a symbolic link (/usr/local/vdr) which points to the correct directory. As an example, my /usr/local looks like this:


cd /usr/local
ls -ld vdr*
lrwxrwxrwx 1 root root   18 2008-07-01 15:00 vdr -> vdr-1.6.0-20080701
drwxr-xr-x 8 root root 4096 2008-06-01 08:28 vdr-1.6.0-20080601
drwxr-xr-x 8 root root 4096 2008-07-01 14:54 vdr-1.6.0-20080701

Follow the next steps to install VDR.


cd mysourcedir

wget http://www.iki.fi/kuparine/comp/vdr/distfiles/mkvdr.sh
wget http://www.iki.fi/kuparine/comp/vdr/distfiles/mkvdr.conf

sh mkvdr.sh -m
vi ~/.mkvdrrc

sh mkvdr.sh -x

sudo chown -R vdr:vdr /usr/local/vdr-*-*/etc
sudo wget -O /etc/default/vdr http://www.iki.fi/kuparine/comp/vdr/distfiles/etc_default_vdr
sudo vi /etc/default/vdr

I have these settings in my .mkvdrrc file:

ENABLE_PATCH_CAPSYSNICE=true
ENABLE_PATCH_CUTTER_MARKS=true
ENABLE_PATCH_LIEMIKUUTIO=true
ENABLE_PATCH_PARENTALRATING_CONTENT=true
ENABLE_PATCH_TTXTSUBS=true

ENABLE_PLUGIN_BITSTREAMOUT=true
ENABLE_PLUGIN_EPGSEARCH=true
ENABLE_PLUGIN_FEMON=true
ENABLE_PLUGIN_LCDPROC=true
ENABLE_PLUGIN_LIVE=true
ENABLE_PLUGIN_OSDTELETEXT=true
ENABLE_PLUGIN_REMOTE=true
ENABLE_PLUGIN_RSSREADER=true
ENABLE_PLUGIN_SKINSOPPALUSIKKA=true
ENABLE_PLUGIN_STREAMDEV=true
ENABLE_PLUGIN_SVDRPSERVICE=true
ENABLE_PLUGIN_SYSINFO=true
ENABLE_PLUGIN_XINELIBOUTPUT=true

ENABLE_ADDON_VDRADMIN_AM=true

Configuring VDR

The standard "mkvdr.sh -c" phase will configure VDR for single-client usage. This is useful for testing and for systems were remote clients have the same screen as the local client. This means the following directory layout:

/usr/local/vdr-VERSION-DATE/
		bin/
			vdr
			vdr-fbfe
			vdr-sxfe
			...

		etc/
			channels.conf
			remote.conf
			setup.conf
			svdrphosts.conf
			...

In this case the VDR server can be started with the following command e.g. in /etc/rc.local:

if [ -x /usr/local/bin/vdrd ]; then
	/usr/local/bin/vdrd -P 37890 -V /video
fi

Currently my /usr/local/bin/vdrd has these plugins active (see also the .mkvdrrc settings above):

	-P "xineliboutput --local=none --remote=${PORT} --primary"	\
	-P "svdrpservice"						\
	-P "streamdev-server"						\
									\
	-P "bitstreamout --onoff"					\
	-P "epgsearch --reloadmenuconf --mailcmd=/usr/bin/sendEmail"	\
	-P "femon"							\
	-P "lcdproc --host localhost --port 13666"			\
	-P "osdteletext --directory=/tmp/osdteletext --max-cache=100"	\
	-P "rssreader"							\
	-P "skinsoppalusikka --logodir=${PREFIX}/logos"			\
	-P "sysinfo"							\

Starting the VDR client

I created a simple script to start the VDR display. I downloaded it in /usr/local/bin and made it executable. The vdrx script can connect to remote VDR servers (see the -H and -P options) so I'm using it also on "dummy frontends" without any DVB receivers.


cd /usr/local/bin
sudo wget http://www.iki.fi/kuparine/comp/vdr/distfiles/vdrx
sudo chmod 755 vdrx
vdrx -h

vdrx -H 127.0.0.1 -P 37890

On dummy frontends I also install the following package:


sudo aptitude install xineliboutput-sxfe

See also: Bug #197400 and Bug #232241.


Miscellaneous stuff

ACPI wakeup

ACPI wakeup needs /proc/acpi/alarm to be available in the host. Since this is writable only by root, we need either to configure sudo so that the VDR user does not need to provide a password or run the VDR process as root. Personally I prefer not to run it with root privileges.

The vdrshutdown takes the wake up time and executes itself with root privileges using sudo to actually write the wake up time to /proc/acpi/alarm. In order to make things work, I executed


sudo visudo

# Allow VDR to shutdown the host
Defaults:vdr	!requiretty
vdr		ALL = NOPASSWD: /usr/local/bin/vdrshutdown

Restart VDR with -s /usr/local/bin/vdrshutdown and you should see messages like this in /var/log/user.log

Jun 30 23:41:22 n50 vdr: /usr/local/bin/vdrshutdown 1215030480 171998 3 Kasvottomat sotilaat~Ke 02.07.2008-23:30 0
Jun 30 23:41:22 n50 vdr: Requested wakeup time is 2008-07-02 20:28:00
Jun 30 23:41:22 n50 vdr: Setting wakeup time to 2008-07-02 20:25:00
Jun 30 23:41:23 n50 vdr: Wakeup time set to 2008-07-02 20:25:00

Xorg and Panasonic AE-PT500

I needed the following settings in /etc/X11/xorg.conf to make the picture appear on our prjector. Please note that I do not want to have DPMS option as it will blank the picture after some keyboard or mouse inactivity.

Section "Monitor"
        Identifier      "Panasonic PT-AE500"
        Option          "DPMS" "off"
        HorizSync       28-80
        VertRefresh     43-60
        Option          "UseEDID" "false"
        Option          "UseEDIDFreqs" "false"
        Option          "ExactModeTimingsDVI" "true"
        Option          "ModeValidation" "NoDFPNativeResolutionCheck"
        Modeline        "720p" 74.160 1280 1352 1392 1648 720 725 730 750 -hsync -vsync
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Device          "NVIDIA GPU GeForce 7050 PV"
        Monitor         "Panasonic PT-AE500"
        DefaultDepth    24
        SubSection "Display"
                Modes           "720p"
        EndSubSection
EndSection

Watching TV with Mobile Phone

TBD

Infrared remote controller

TBD

LCD/VFD

VDR can display useful information on the VFD/LCD with the lcdproc plugin.

NewCS and SC

TBD

Automatic CD ripping

Someone has configured a nice system doing automatic CD-to-MP3 ripping. This sounds so nice that I wanted to have the same system. The purpose is to put a music CD into the DVD tray, close the tray and the system will automatically create MP3s and eject the tray when all is done.

TBD - Not tested yet!


sudo aptitude install abcde cdparanoia lame
sudo vi /etc/abcde.conf

LAMEOPTS="--vbr-new"

sudo vi /usr/bin/abcded

#!/bin/sh

DATE="`date +%Y-%m-%d_%H:%M:%S`"
DELAY="60"

while true; do
    sleep ${DELAY}
    cdparanoia -Q > /dev/null 2>&1 && \
    abcde -o mp3 -x -N -f > /tmp/abcde-${DATE}.log  2>&1
done

sudo chmod 755 /usr/bin/abcded
sudo cp /usr/share/doc/abcde/examples/abcde.init /etc/init.d/abcde
sudo chmod 755 /etc/init.d/abcde
sudo update-rc.d abcde defaults 
sudo /etc/init.d/abcde restart

Wake on LAN

Sometimes I need to wake up the multimedia PC and configure recordings even when we are not at home. I have installed a Wake On LAN (WOL) client and created a simple script on our router (this router is always powered on and connected to the Internet). Now if I need to wake up the multimedia PC, I simply connect to the router with SSH and execute the wol script. It takes about one minute for the multimedia PC to boot.

I have also installed the wol script on our Ubuntu desktop and laptop PCs and created a launcher for it on everyone's GNOME panel to make it possible to remotely start the multimedia PC with a single mouse click. As the etherwake program used by the wol script requires root privileges, I've given everyone permission to execute it without giving the password. After all, sending WOL packets is not that dangerous.


sudo visudo

# Allow everyone to start HTPC using the WOL script
ALL	ALL = NOPASSWD: /usr/sbin/etherwake

Activating WOL on the multimedia PC


sudo aptitude install ethtool
sudo vi /etc/network/interfaces

auto eth0
iface eth0 inet static
...
	post-up /usr/sbin/ethtool -s eth0 wol g

Sending WOL packets from NetBSD routers


su -
cd /usr/pkgsrc/net/wakeup
make update
vi /usr/local/wol

#!/bin/sh

# MAC address of the multimedia PC
MAC="xx:xx:xx:xx:xx:xx"

/usr/pkg/bin/wakeup ${MAC}

chmod 755 /usr/local/wol

Sending WOL packets from Linux routers


sudo aptitude install etherwake
sudo vi /usr/local/wol

#!/bin/sh

# MAC address of the multimedia PC
MAC="xx:xx:xx:xx:xx:xx"

sudo /usr/sbin/etherwake ${MAC}

sudo chmod 755 /usr/local/wol

Remote access with the live plugin

TBD

Remote access with VDRAdmin-AM

The vdradmin-am package provides a nice web frontend which allows the VDR to be controller using a standard web browser. I modified /etc/vdradmin/vdradmind.conf to have these settings.


sudo vi /etc/rc.local

if [ -x /usr/bin/vdradmind.pl ]; then
	/usr/bin/vdradmind.pl -k
	/usr/bin/vdradmind.pl
fi

sudo vi /etc/vdradmin/vdradmind.conf

[...]
MAIL_FROM = my.address@domain.com
MAIL_SERVER = smtp.mydomain.com
MAIL_TO = my.address@domain.com
[...]
PASSWORD = mysecret
PASSWORD_GUEST = guest
[...]
USERNAME = admin
USERNAME_GUEST = guest
[...]
ST_STREAMDEV_HOST = myhost.mydomain.com
ST_STREAMDEV_PORT = 3000
[...]
VDRCONFDIR = /usr/local/vdr/etc
VDR_HOST = myhost.mydomain.com
VDR_PORT = 2001
VIDEODIR = /video
[...]

References