Skip to content

VDR4Arch Installation (en_US)

Manuel Reimer edited this page Sep 8, 2020 · 26 revisions

Table of Contents

General

VDR4Arch is a ready to use binary repository for Arch Linux. Our main goal is to follow as many rules of the Arch Linux DeveloperWiki as possible.

Basic installation

There are more detailed instructions how to install Arch Linux in the Arch Linux Wiki. Here are just a few steps which are next to the x86 systems especially interesting for ARM systems.

Set Hostname (e.g. "vdr01")

 # echo vdr01 > /etc/hostname

Set timezone

 # ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
 # nano /etc/locale.gen

Remove the hash in front of 'en_US.UTF-8'

Generate locales

 # locale-gen

Set generated locale as default

 # echo 'LANG=de_DE.UTF-8' > /etc/locale.conf

Set keyboard layout permanently

 # echo 'KEYMAP=de' > /etc/vconsole.conf

Set the root password (There is no default password on x86 systems. On ARM systems the default passowrd is 'root')

 # passwd

And finally reboot the system

 # reboot

Installation of VDR4Arch

To enable the vdr4arch repository add the this to the end of /etc/pacman.conf.

 [vdr4arch]
 Server = https://vdr4arch.github.io/$arch
 SigLevel = Never

Then we update the local package database

 # pacman -Sy

This command

 # pacman -Sl vdr4arch

lists the available packages.
For more details see the Packetlist

GPU specific configuration (for both, VDR-OSD and Kodi)

Intel (VA-API)

First must the driver be installed:

 pacman -S xf86-video-intel

For all HTPC systems it is strongly recommended to save a fixed edid.bin for reliable booting even if, for example, the AV receiver is switched off. As the intel driver is running inside the kernel we have to pass the edid.bin at boot time which does require some boot manager reconfiguration.

At first grab the edid.bin from the running system with a command like this:

 # cp /sys/class/drm/card0-HDMI-A-2/edid /usr/lib/firmware/edid/edid.bin

If you copied from the correct HDMI connector, then this file should have a size above 0 bytes. If your file is a zero byte file, try with HDMI-A-1 instead of HDMI-A-2. Also remember this port number for future use if you have to use a different one.

Next change the kernel boot options in your boot loader. For systemd-boot this is usually done in /boot/loader/entries/$NAME.conf. Here you have to add the following to the "options" line (keep whatever already is there and add your additions separated with one space character):

 video=HDMI-A-2:1920x1080@50D drm.edid_firmware=HDMI-A-2:edid/edid.bin

The resolution setting only works if you load the driver early in the boot stage which does require some additional changes in your /etc/mkinitcpio.conf (again: Keep everything that is in these lists and add the new option separated with one space character):

 MODULES=(i915)
 FILES=(/usr/lib/firmware/edid/edid.bin)

After doing so, recreate your initcpio:

 # mkinitcpio -p linux

Rebooting now should switch your TV to 1920x1080@50 directly.

NVidia(VDPAU)

First must the driver be installed:

 pacman -S nvidia

For all HTPC systems it is strongly recommended to save a fixed edid.bin for reliable booting even if, for example, the AV receiver is switched off. To do this on Nvidia systems, at first create a new file /etc/X11/10-nvidia.conf with the following content:

 Section "Device"
   Identifier "Device0"
   Driver "nvidia"
   Option "CustomEDID" "DFP-1:/etc/X11/edid.bin"
   Option "IgnoreEDID" "true"
   Option "UseEDID" "false"
   Option "ModeDebug" "true"
 EndSection

The edid file itself can be generated with the following commands:

 # X -verbose 6 > /tmp/xlog 2>&1

The above command has to be terminated with Ctrl-C after about 5 seconds. Finally run the following command:

 # nvidia-xconfig --extract-edids-from-file=/tmp/xlog --extract-edids-output-file=/etc/X11/edid.bin

Using VDR's built-in OSD

Preparation

If the X server isn't already started differently, you can use vdr-xorg.

 # pacman -S vdr-xorg

The package vdr-xorg extends the systemd-configuration for VDR, so an X server is started before starting VDR.

GPU-secific settings

Intel (VA-API)

Afterwards must the X-Server be configured for use with VDR. The following new configuration file is needed:

 Section "Monitor"
   Identifier  "HDMI1"
   Modeline    "1920x1080_24"     74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
   Modeline    "1920x1080_50"    148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
   Modeline    "1920x1080_60"    148.500 1920 2008 2056 2200 1080 1084 1089 1125 +hsync +vsync
 EndSection
 
 Section "Extensions"
     Option         "Composite" "Disable"
 EndSection

To make sound working, we have to set the default ALSA output device in /etc/asound.conf

For Intel this config should work.

 pcm.!default {
   type hw
   card PCH
   device 7
 }

If sound still doesn't work, it's helpful to take a look at the device list.

For this we need alsa-utils

 # pacman -S alsa-utils

The list of sound devices can be get with the following command:

 # aplay -l
 **** List of PLAYBACK Hardware Devices ****
 card 0: PCH [HDA Intel PCH], device 0: ALC662 rev1 Analog [ALC662 rev1 Analog]
   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

With newer driver versions Intel got these ugly weathered colors. To fix this we need to install xorg-xrandr

 pacman -S xorg-xrandr

and add or edit the file /home/vdr/.xinitrc

 #!/usr/bin/bash
 xrandr --output HDMI1 --set "Broadcast RGB" "Full"

NVidia(VDPAU)

Afterwards must the X-Server be configured for use with VDR. The following new configuration file is needed:

 # nano /etc/X11/xorg.conf.d/20-vdr.conf
 Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "ExactModeTimingsDVI" "True"
    Option         "FlatPanelProperties" "Dithering = disabled"
    Option         "NoLogo" "True"
    SubSection     "Display"
        Depth       24
        Modes      "1920x1080_50" "1920x1080_60_0" "1920x1080_24"
    EndSubSection
 EndSection

To make sound working, we have to set the default ALSA output device in /etc/asound.conf

In case of an nVidia graphic card this configuration should work:

 pcm.!default {
   type hw
   card NVidia
   device 7
 }

If sound still doesn't work, it's helpful to take a look at the device list.

For this we need alsa-utils

 # pacman -S alsa-utils

The list of sound devices can be get with the following command:

 # aplay -l
 **** List of PLAYBACK Hardware Devices ****
 card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
 card 0: '''NVidia''' [HDA NVidia], '''device 7''': HDMI 1 [HDMI 1]
   Subdevices: 0/1
   Subdevice #0: subdevice #0

Plugins

Softhddevice

 # pacman -S vdr-softhddevice

And activate it with a corresponding symlink.

 # cd /etc/vdr/conf.d
 # ln -s ../conf.avail/50-softhddevice.conf .

Xineliboutput (stand-alone VDR)

 # pacman -S vdr-xineliboutput xineliboutput-frontends

And activate it with a corresponding symlink.

 # cd /etc/vdr/conf.d
 # ln -s ../conf.avail/50-xineliboutput.conf .

Set --local=sxfe (or --local=fbfe) and --remote=none in /etc/vdr/conf.d/50-xineliboutput.conf

Xineliboutput (Client/Server)

Server
 # pacman -S vdr-xineliboutput

And activate it with a corresponding symlink.

 # cd /etc/vdr/conf.d
 # ln -s ../conf.avail/50-xineliboutput.conf .

Set --local=none and --remote=3789 in /etc/vdr/conf.d/50-xineliboutput.conf

Client

Install Xineliboutput frontends

 # pacman -S xineliboutput-frontends

To start vdr-sxfe frontend run:

 # vdr-sxfe <IP address of the server>

To start vdr-fbfe frontend run:

 # vdr-fbfe <IP address of the server>

Playback using Full-Featured DVB devices

 # pacman -S vdr

(vdr-dvbsddevice and vdr-dvbhddevice are actually no longer part of the vdr package and currently you have to find your own way to get them. Either someone creates a pull request to get them back into our repo or at some time this documentation section has to go)

Create a symlink to the configuration file to activate the plugin:

 # cd /etc/vdr/conf.d
 # ln -s ../conf.avail/50-dvbhddevice.conf .

or for SD devices

 # ln -s ../conf.avail/50-dvbsddevice.conf .

The driver for the Technotrend S2-6400 has to be installed

 # pacman -S media-build-experimental-dkms

and loaded with

 # modprobe saa716x_ff

When the system is restarted, udev will load the driver automatically.

The installation of a dkms driver takes quite some time and unfortunately there's also a daemon necessary.

  1. systemctl enable dkms
  2. systemctl start dkms

The configuration of vdr is located in /etc/vdr/conf.avail and /etc/vdr/conf.d Configuration for the VDR core can be found in /etc/vdr/conf.d/10-vdr.conf

Plugins place their configuration in /etc/vdr/conf.avail. To activate a plugin, a symlink has to be made to /etc/vdr/conf.d Plugins are loaded in alphabetical order.

To be able to control VDR with the keyboard, the following configuration file has to be created: /etc/systemd/system/vdr.service.d/fullfeatured.conf

 [Service]
 StandardInput=tty
 TTYPath=/dev/tty8
 ExecStartPre=/usr/bin/chvt 8
 Note: Untested, please remove this note if this works

Enable autostart of VDR:

 # systemctl enable vdr

Start VDR:

 # systemctl start vdr

Playback on the Raspberry Pi

 # pacman -S vdr-rpihddevice

Create a symlink to the configuration file to activate the plugin:

 # cd /etc/vdr/conf.d
 # ln -s ../conf.avail/50-rpihddevice.conf .

The configuration of vdr is located in /etc/vdr/conf.avail and /etc/vdr/conf.d Configuration for the VDR core can be found in /etc/vdr/conf.d/10-vdr.conf

Plugins place their configuration in /etc/vdr/conf.avail. To activate a plugin, a symlink has to be made to /etc/vdr/conf.d Plugins are loaded in alphabetical order.

In the file /boot/config.txt it's also recommended to increase the gpu_mem setting. It defaults to 64MB which is not enough for VDR.

The official kodi wiki recommend 128MB for a RaspberryPi 1 and 256MB for the RaspberryPi 2

 gpu_mem=256

The config.txt file is also the place in which the license codes for certain Codecs need to be set

 decode_MPG2=0x12345678
 decode_WVC1=0x12345678

(This is just an example. You can buy your own license codes here.)

To be able to control VDR with the keyboard, the following configuration file has to be created: /etc/systemd/system/vdr.service.d/fullfeatured.conf

 [Service]
 StandardInput=tty
 TTYPath=/dev/tty8
 ExecStartPre=/usr/bin/chvt 8
 ExecStartPre=/usr/bin/setterm --clear all --cursor off

Enable autostart of VDR:

 # systemctl enable vdr

Start VDR:

 # systemctl start vdr

Optional Configuration

Wait for the network

In case a plugin is not able to wait for for the network to be available, the following has to be altered:

In /etc/systemd/system/multi-user.target.wants/vdr.service.d the file 01-wait-for-net.conf has to be created:

 # mkdir -p /etc/systemd/system/multi-user.target.wants/vdr.service.d
 # nano /etc/systemd/system/multi-user.target.wants/vdr.service.d/01-wait-for-net.conf
 [Unit]
 After=network-online.target
 Wants=network-online.target

Additionally we have to edit the network configuration. Not all network handling daemons are able to detect if there's actually a working network connection. And as a result of that network-online.target doesn't always work as expected.

It's known to work with systemd-networkd and NetworkManager

Therefore it's recommended to use systemd-networkd. There's a really good documentation over at the Arch Wiki

Additionally a special daemon needs to be enabled.

 systemctl enable systemd-networkd-wait-online

For NetworkManager it is

 systemctl enable NetworkManager-wait-online

Safe shutdown with the power button

Usually systemd handles the powerbutton. Systemd triggers the shutdown if someone presses the powerbutton. Normally this is no big deal, but in case of vdr it is. VDR is only able to save the wakeup timer, if it also triggered the shutdown.

In case VDR triggers the shutdown: /usr/lib/vdr/bin/shutdown.sh gets started, it sets the wakeup timer and finally triggers the system shutdown. In case systemd triggers the shutdown: VDR receives a SIGTERM and terminates. Systemd continues the shutdown process (No wakeup timer was set)

vdrpbd inhibits systemd to take care of the powerbutton. Instead vdrpbd waits for the powerbutton event and tells VDR over svdrpsen, that the powerbutton was pressed.

To install vdrpbd:

 # pacman -S vdrpbd

To enable vdrpbd:

 # systemctl enable vdrpbd
 # systemctl start vdrpbd

Kodi

Start Kodi from within VDR

 Note: The externalplay plugin seems to be broken. It starts Kodi but after exiting Kodi VDR is unable to output again. But there is a working way via the commands.conf file

Create the following file /usr/lib/vdr/start_kodi

 #!/bin/bash
 (
   export DISPLAY=:0
   svdrpsend remo off
   svdrpsend plug graphlcd off
   svdrpsend plug softhddevice deta
 
   kodi
 
   svdrpsend remo on
   svdrpsend plug graphlcd on
   svdrpsend plug softhddevice atta
 ) > /dev/null 2>&1 &
and make it executable
chmod +x /usr/lib/vdr/start_kodi

Disabling the output of another display like imonlcd, lcdproc or targavfd works exacly the same as the example above shows for graphlcd.

Afterwards add the following to /var/lib/vdr/commands.conf:

 Kodi: /usr/lib/vdr/start_kodi

Use Kodi as the main frontend

Using Kodi as the main frontend has many advantages over the VDR OSD and frontend. The media player capabilities of Kodi are far superior to VDR, so you may use your HTPC for much more media playing tasks than with plain VDR. The vdr4arch repository provides you with all the required stuff to have VDR as so-called PVR-Backend. Means that VDR runs completely in the background, providing Kodi with Live-TV and TV recordings.

Prerequisites to port an existing VDR system

To modify an existing VDR system to use Kodi as the main frontend, you should do some initial tasks:

  1. Uninstall all Skin plugins
  2. Uninstall the vdr-softhddevice Plugin
  3. Uninstall vdr-xorg
After doing so, reboot the machine and get sure VDR still runs in background without logging any errors to journal.

Getting Kodi connected with VDR

To get Kodi connected with VDR, you need two packages from vdr4arch:

  1. kodi-addon-pvr-vdr-vnsi
  2. vdr-vnsiserver
Enable both (PVR in Kodi and vnsiserver via symlink in /etc/vdr/conf.d) and Kodi should connect to your VDR daemon.

Autostarting Kodi on system startup

The easiest way to do so is the kodi-standalone-service package which is provided by the vdr4arch repository, but you can follow the Arch Wiki on that task: https://wiki.archlinux.org/index.php/Kodi#Autostarting_at_boot_or_ondemand If you decide to not use kodi-standalone-service, then please be sure to create the user, you run Kodi with, in the following way:

groupadd -g 420 kodi
useradd -c 'kodi user' -m -u 420 -g kodi -G audio,video,network,optical -d /var/lib/kodi -s /usr/bin/nologin kodi
It is required that you use 420 for both, UID and GID, as other packages in the vdr4arch repository depend on that.

Make Kodi set the wakeup time for recordings

To use ACPI to wake up the computer for recordings, you may use the "kodi-setwakeup" package. Just install this package and enter "kodi-setwakeup" as the "Wakeuptime command" in the Kodi configuration.

Compile VDR4Arch

You need a running Arch Linux base installation on a virtual machine.

Install the developement environment

 # pacman -S base-devel

Install repo-make

 # pacman -U http://downloads.tuxfamily.org/repomake/repo-make-1.0.0-1-any.pkg.tar.xz

Clone PKGBUILDs

 # git clone https://github.com/CReimer/vdr4arch.git
 # cd vdr4arch

Start automatic build

 # repo-make

All binary packages will land in the subdirectory "repo"