# /etc/init.d/vdr Erklärung nötig [Newbie question ;)]

## bjokuh

Hallo,

derzeit starte ich meinen VDR immer von der Konsole mit

```
vdr -Pplugin1 -Pplugin2 ... 
```

Ich habe gesehen, daß es auch ein kleines Skript gibt, um VDR automatisch zu starten, doch irgendwie muß man das vorher wohl noch anpassen. Leider blicke ich da nicht ganz durch. Kann mir das hier jemand erklären?

```

#!/sbin/runscript

# Copyright 2003 Martin Hierling <mad@cc.fh-lippe.de>

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/media-video/vdr/files/rc.vdr,v 1.20 2005/04/06 18:49:42 mad Exp $

opts="${opts} fullrestart"

pidof=/sbin/pidof

test -x /bin/pidof && pidof=/bin/pidof

depend() {

        use lircd dvbsplash

        after checkroot

}

getvdrversion()

{

        vdrversion=$(awk '/VDRVERSION/ { gsub("\"","",$3); print $3 }' /usr/include/vdr/config.h)

}

start() {

        getvdrversion

        ebegin "Starting vdr-${vdrversion}"

        # reading the default vdr options

        #

        [ -n "${AUDIO}" ] && vdropts="${vdropts} --audio=${AUDIO} "

        [ -n "${CONFIG}" ] && vdropts="${vdropts} --config=${CONFIG} "

        [ -n "${DEVICE}" ] && for i in ${DEVICE}; do vdropts="${vdropts} --device=${i} "; done

        [ -n "${SHUTDOWN}" ] && vdropts="${vdropts} --shutdown='${SHUTDOWN}' "

        [ -n "${EPGFILE}" ] && vdropts="${vdropts} --epgfile=${EPGFILE} "

        [ -n "${LOG}" ] && vdropts="${vdropts} --log=${LOG} "

        [ -n "${VIDEO}" ] && vdropts="${vdropts} --video=${VIDEO} "

        [ -n "${RECORD}" ] && vdropts="${vdropts} --record='${RECORD}' "

        [ -n "${PORT}" ] && vdropts="${vdropts} --port=${PORT} "

        [ -n "${TERMINAL}" ] && vdropts="${vdropts} --terminal=${TERMINAL} "

        [ -n "${LIB}" ] && vdropts="${vdropts} --lib=${LIB} "

        [ -n "${MUTE}" ] && vdropts="${vdropts} --mute "

        [ -n "${PLUGINS}" ] && for i in ${PLUGINS}; do 

                #

                # reading associated plugin config files and render the command options

                #

                if  [ -f "/etc/conf.d/vdr.${i}" -a -n "$(grep "^[A-Z_]" /etc/conf.d/vdr.${i} 2>/dev/null )" ]; then

                        unset pluginopts

                        #

                        # reading the values begining wiht [A-Z]

                        # 

                        for t in $(cat /etc/conf.d/vdr.${i} | grep "^[A-Z]"); do

                                unset value option

                                value=$(echo $t| cut -d "=" -f 2 | tr -d "\"")

                                option=$(echo $t| cut -d "=" -f 1 | tr "[:upper:]" "[:lower:]")

                                pluginopts="${pluginopts} --$option=$value"

                        done

                        #

                        # An extra option field can be declared called _EXTRAOPTS containing

                        # some free formed options for this plugin

                        #

                        if [ "$(grep ^_EXTRAOPTS /etc/conf.d/vdr.${i})" ]; then

                                extraopts=$(grep ^_EXTRAOPTS /etc/conf.d/vdr.${i}|cut -d "\"" -f 2)

                                pluginopts="${pluginopts} ${extraopts}"

                        fi

                        vdropts="${vdropts} --plugin='${i} ${pluginopts}'"

                else

                vdropts="${vdropts} --plugin=${i}"

                fi

        done

        #

        # this reads envs from pluginconfigs

        #

        for t in $PLUGINS; do

                if  [ -f "/etc/conf.d/vdr.$t" ]; then

                        source /etc/conf.d/vdr.$t

                fi

        done

        #

        # finaly start vdr

        # 

        #echo "/usr/bin/vdr --daemon ${vdropts}"

        [ -x /usr/bin/show_dvb_image ] && killall /usr/bin/show_dvb_image 2>/dev/null

        su - vdr -c "/usr/bin/vdr --daemon ${vdropts}"

        exitcode=$?

        # Warten auf offenen svdrp port

        if [ $exitcode == 0 ] && [ "$PORT" != "0" ]; then

                ok=0

                test -z "$PORT" && PORT=2001

                waittime=20

                while [ "$waittime" -gt 0 ] && [ "$ok" == "0" ]; do

                        if /usr/bin/svdrpsend.pl -d localhost -p $PORT quit 2>/dev/null|grep -q ^220; then

                                ok=1

                                break

                        fi

                        if ${pidof} /usr/bin/vdr >/dev/null; then

                                :

                        else

                                # Not running

                                ok=2

                        fi

                        waittime=$[waittime-1]

                        echo -n "."

                        sleep 1

                done

                case "$ok" in

                        0)

                                echo " timeout, if your compute is too slow enlarge waittime"

                                exitcode=1

                                ;;

                        1)

                                echo " started"

                                ;;

                        2)

                                echo " aborted, please check logfile"

                                exitcode=1

                                ;;

                esac

        fi

        eend $exitcode "Failed to start vdr."

}

stop() {

        getvdrversion

        ebegin "Stopping vdr-${vdrversion}"

        start-stop-daemon --stop --quiet --retry 15 --exec /usr/bin/vdr

        eend $? "Failed to stop vdr."

}

fullrestart() {

        ebegin "Fully restarting $(vdr -V) and DVB drivers"

        /etc/init.d/vdr stop

        /etc/init.d/vdr zap

        sleep 5

        ${pidof} /usr/bin/vdr && /bin/killall -9 vdr

        sleep 5

        /sbin/rmmod -v \

                        dvb-ttpci \

                        alps_bsrv2 \

                        grundig_29504-401 \

                        grundig_29504-491 \

                        ves1820 \

                        stv0299 \

                        alps_tdmb7 \

                        alps_tdlb7

        sleep 3

        /etc/init.d/vdr start

}

```

Danke Björn

----------

## astaecker

Viele Init-Skripte stellen Optionen bereit, die man in der dazugehörigen Conf-Datei einstellen kann. Die Conf-Dateien findet man im /etc/conf.d Verzeichnis.

----------

## oscarwild

Konkret sind das in diesem Fall

- /etc/conf.d/vdr (VDR-Startoptionen)

- /etc/conf.d/vdr.<pluginname> (Pro Plugin die jeweiligen Optionen)

Genaueres findest Du unter http://www.vdr-wiki.de/wiki/index.php/Gentoo

----------

## bjokuh

Gut, ich habe es einfach mal versucht mit:

```

server root # /etc/init.d/vdr start

 * Starting vdr-1.3.22...

 * Failed to start vdr.                                                   [ !! ]

```

Aber wie ihr seht mit einer Fehlermeldung.

Meine /etc/conf.d/vdr:

```

# /etc/conf.d/vdr:

# $Header: /var/cvsroot/gentoo-x86/media-video/vdr/files/confd,v 1.10 2005/02/24 21:30:53 zzam Exp $

# Global config file for vdr rc-scripts

# activate the watchdog timer with a timeout of SEC

# seconds (default: 0); '0' disables the watchdog

#WATCHDOG="60"

# send Dolby Digital audio to stdin of command CMD

#AUDIO="" 

# mute audio of the primary DVB device at startup

# (default is to unmute)

#MUTE="1"

# read config files from DIR (default is to read them

# from /etc/vdr directory)

CONFIG="/etc/vdr"

# use only the given DVB device (NUM = 0, 1, 2...)

# there may be several NUMs options (default: all DVB

# devices will be used)

#DEVICE=""

# call CMD to shutdown the computer

# SHUTDOWN="/usr/bin/vdrshutdown.sh"

SHUTDOWN="/etc/vdr/vdrshutdown.sh"

# write the EPG data into the given FILE (default is

# /video/epg.data); use '-E-' to disable this

# if FILE is a directory, the default EPG file will be

# created in that directory

#EPGFILE="/var/vdr/epg.data"

# set log level (default: 3)

# 0 = no logging, 1 = errors only,

# 2 = errors and info, 3 = errors, info and debug

# if logging should be done to LOG_LOCALn instead of

# LOG_USER, add '.n' to LEVEL, as in 3.7 (n=0..7)

#LOG="3"

# use DIR as video directory (default: /video)

#VIDEO=""

# call CMD before and after a recording

# RECORD="/usr/bin/vdrrecord.sh"

#RECORD=""

# use PORT for SVDRP (default: 2001)

# 0 turns off SVDRP

# PORT="2001"

#PORT=""

# search for plugins in DIR (default is /usr/lib/vdr)

#LIB=""

# load a plugin defined by the given options

# list all plugins you want to be loaded, seperated by space

PLUGINS="remote tvtv mplayer"

# controlling tty

#TERMINAL=""

#

# Splash functions are moved to packet dvbsplash

#

# emerge dvbsplash if you want splash-functions

#

```

Und noch 3 Plugin-Conf-Dateien:

```

# /etc/conf.d/vdr.mplayer:

# $Header: /var/cvsroot/gentoo-x86/media-video/vdrplugin-mplayer/files/vdr.mplayer,v 1.1 2003/06/05 09:39:40 mad Exp $

# Global config file for vdr rc-scripts

# MPlayer is called through a skript called "mplayer.sh" with the filename to

# play as first argument and the phrase SLAVE as second argument if SlaveMode 

# is enabled.

# The skript has to call MPlayer with all the necessary options.

MPLAYER="/usr/bin/mplayer.sh"

# The default mount script is "mount.sh". This script is called from the

# plugin with 2 options on commandline. The first is

# one of mount/unmount/eject/status and gives the action to perform. The

# second one is the base directory as defined in "mplayersources.conf".

# The script must return the exit code 0 if the action was

# successfull and 1 if the action failed (see the comments in the example

# "mount.sh" script which comes with the archive).

MOUNT="/usr/bin/mount.sh"

```

```
# /etc/conf.d/vdr.remote:

# $Header: /var/cvsroot/gentoo-x86/media-video/vdrplugin-remote/files/vdr.remote,v 1.1 2005/01/10 12:50:29 austriancoder Exp $

# Global config file for vdr rc-scripts

# Remember:

# You have to use EXTRAOPTS starting with an underscore

# See last line of this file

# Examples:

# ---------

# vdr -Premote

# vdr -P"remote -i autodetect"

#    Try to autodetect device '/dev/input/eventX' (X = 0,1,2,...).

#    If no device can be identified, '-i /dev/input/event0' is used.

#

# vdr -P"remote -i /dev/input/event2"

#    use specified input device '/dev/input/event2'

#

# vdr -P"remote -l /dev/lircd"

#    select LIRC remote control

#

# vdr -P"remote -p tcp:3333"

#    wait for a telnet connection on tcp port 3333

#    (use 'telnet vdr 3333' to access this port)

#

# vdr -P"remote -t /dev/tty10"

#    use terminal device without 'OSD'

#

# vdr -P"remote -T /dev/tty10"

#    use terminal device with 'OSD'

#

# vdr -P"remote -i autodetect -p tcp:3333 -t /dev/tty10"

#    use multiple devices

#_EXTRAOPTS="-i autodetect"

_EXTRAOPTS="-i /dev/input/event2"

```

```

# /etc/conf.d/vdr.mp3

# $Header: /var/cvsroot/gentoo-x86/media-video/vdrplugin-mplayer/files/vdr.mp3,v 1.1 2003/06/20 12:03:56 mad Exp $

# Global config file for vdr rc-scripts

# The default mount script is "mount.sh". This script is called from the

# plugin with 2 options on commandline. The first is

# one of mount/unmount/eject/status and gives the action to perform. The

# second one is the base directory as defined in "mplayersources.conf".

# The script must return the exit code 0 if the action was

# successfull and 1 if the action failed (see the comments in the example

# "mount.sh" script which comes with the archive).

#MOUNT="/usr/bin/mount.sh"

# If you are using cdfs, the MP3 plugin is able to query a CDDB database for

# the song information (like title, artist). Local CDDB lookups can be enable

# from the setup menu and you must give the path to your local CDDB files.

# The database layout follows the xmcd standard

# (one subdirectory level for the categories, individual files for every disc).

# The settings for remote CDDB lookups can be found in the setup menu, too.

# Any information retrieved from a remote host is stored to your local CDDB

# database, so the user running VDR needs write access to this directory.

#CDDB="/var/cddb"

# If you are using any of the networking capabilities and you have a dial-up

# network you can use this script.

# This script is called before and after any network access and receives one

# option on commandline. This can either be "up" or "down", depending on if it's

# before or after the network access. In the "up" case the script should not

# return before the network is connected and useable. By default the plugin

# assumes that network access can be done at any time without prior action.

#NETWORK="/usr/bin/network.sh"

```

Und dann noch eine:

```

# /etc/conf.d/vdr.shutdown:

# $

# Global config file for vdr's shutdown and wakeup handling

# Do you want to use nvram-wakeup?

#USE_NVRAM="yes"

# If you need an extra nvram-config file, because your mainboard

# is't supoorted yet

#NVRAM_CONFIG="/etc/nvram-wakeup.conf"

# Do you want to use acpi-wakeup?

# NOTE:  At the moment acpi dosn't support to

#        set the wakup date. So this could make

#        some problems.

#USE_ACPI="yes"

# Which boot manager are you using?

# grub or lilo

BOOT_MANAGER="grub" 

# Which is your reboot entry in grub.conf?

#REBOOT_ENTRY="2" 

```

Kann mir jemand weiterhelfen?

Danke

Björn

----------

## oscarwild

 *bjokuh wrote:*   

> 
> 
> ```
> 
> server root # /etc/init.d/vdr start
> ...

 

Klar, Dein VDR konnte nicht gestartet werden  :Laughing: 

Bitte schau doch mal nach, was beim Startversuch ins Log geschrieben wird, und zeig uns die eigentliche Fehlermeldung!

----------

## bjokuh

 *oscarwild wrote:*   

>  *bjokuh wrote:*   
> 
> ```
> 
> server root # /etc/init.d/vdr start
> ...

 

Tja, wenn ich nur wüßte, wohin  er das Log schreibt, dann würde ich euch das gerne mitteilen.

Sag mir, welches Log-Files ich schicken kann, dann mach' ich das doch glatt  :Wink: 

Ah, ich hoffe, daß ich das richtige gefunden habe:

```

Apr 18 19:06:45 [su(pam_unix)] session opened for user vdr by bjokuh(uid=0)

Apr 18 19:06:45 [su] PAM pam_putenv: delete non-existent entry; REMOTEHOST

Apr 18 19:06:45 [PAM-env] Unknown PAM_ITEM: <DISPLAY>

Apr 18 19:06:45 [su] PAM pam_putenv: delete non-existent entry; DISPLAY

Apr 18 19:06:45 [PAM-env] Unknown PAM_ITEM: <XAUTHORITY>

Apr 18 19:06:45 [su] PAM pam_putenv: delete non-existent entry; XAUTHORITY

Apr 18 19:06:45 [su(pam_unix)] session closed for user vdr

Apr 18 19:06:45 [rc-scripts] Failed to start vdr.

```

Auszug aus 

```
cat /var/log/everything/current 
```

Kann damit aber nicht wirklich viel anfangen  :Wink: 

Gruß

Björn

----------

## Tinitus

Hallo,

laß mich raten....

Du verwendest udev

in der Konsole kannst Du vdr als user root

starten

versuch mal ein: su vdr

und starte dann mal den vdr

wenn es jetzt nicht geht ist es ein Rechteproblem beim Zugriff auf die TV Hardware...

dort gibt es wohl einen Fehler in der Doku

G. R.

----------

## oscarwild

 *bjokuh wrote:*   

> Sag mir, welches Log-Files ich schicken kann, dann mach' ich das doch glatt

 

Das hängt u.a. davon ab, welchen logger Du verwendest... zur Not mach ein

```
grep -Rl vdr /var/log/*
```

 um die in Frage kommenden Dateien zu finden.

Das everything/current-Log hilft leider nicht wirklich weiter...

Wenn alle Stricke reissen, kannst Du auich mal im Initscript die Zeile

```
su - vdr -c "/usr/bin/vdr --daemon ${vdropts}"
```

durch

```
echo su - vdr -c "/usr/bin/vdr --daemon ${vdropts}"
```

erstzen, und das Kommando, das beim Startversuch ausgegeben wird, mal von Hand ausprobieren.

----------

## Martini

Hallo

Das war ein Problem mit dem User vdr. Der hatte keine Login-Shell. Eine Lösung dazu findest du  HIER

Martini

----------

## bjokuh

 *Martini wrote:*   

> Hallo
> 
> Das war ein Problem mit dem User vdr. Der hatte keine Login-Shell. Eine Lösung dazu findest du  HIER
> 
> Martini

 

Wenn ich den Thread vom VDR-Portal richtig verstehe, sollte ein emerge sync und ein emerge -uD vdr ausreichend sein, oder?

 *oscarwild wrote:*   

> 
> 
> Das hängt u.a. davon ab, welchen logger Du verwendest... zur Not mach ein
> 
> ```
> ...

 

Habe ich gemacht, ergab auch nur lauter Dateien aus dem /var/log/everything/log-DATUM oder ..../current

Anscheinend legt VDR derzeit kein eigenes Log-File an. Hoffe, daß der Thread ausm VDR-Portal alles regelt.

Gruß

Björn

----------

## Martini

 *bjokuh wrote:*   

>  *Martini wrote:*   Hallo
> 
> Das war ein Problem mit dem User vdr. Der hatte keine Login-Shell. Eine Lösung dazu findest du  HIER
> 
> Martini 
> ...

 

Hallo

Ja, ein erneutes emerge von vdr sollte jetzt reichen. Ist im ebuild geändert worden.

Eventuell vorher den user mit "userdel vdr" entfernen.

Geloggt wird ins syslog. Bei  mir /var/log/messages, du scheinst metalog zu verwenden.

Martini

----------

## bjokuh

 *Martini wrote:*   

> 
> 
> Hallo
> 
> Ja, ein erneutes emerge von vdr sollte jetzt reichen. Ist im ebuild geändert worden.
> ...

 

Aber die Versions-Nr. ändert sich nicht? Das wundert mich zwar ein bisschen, aber ich werde es einfach mal erneut emergen.

Wenn's nichts bringt, melde ich mich erneut.  :Wink: 

----------

## bjokuh

Tja, anscheinend ist an dem EBuild wirklich etwas geändert worden, allerdings bekomme ich nun folgende Fehlermeldung:

```

server root # emerge -va vdr

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild   R   ] media-video/vdr-1.3.22  -doc -lirc 0 kB 

Total size of downloads: 0 kB

Do you want me to merge these packages? [Yes/No] y

>>> emerge (1 of 1) media-video/vdr-1.3.22 to /

!!! Security Violation: A file exists that is not in the manifest.

!!! File: files/vdr-1.2.6_CAN-2005-0071.patch

server root # 

```

Kann damit nur leider nicht wirklich viel anfangen. Kann jemand helfen?

Gruß&Dank

Björn

----------

## Martini

Hi

Nein, die Versionsnummer ändert sich nicht. Es wurde nur am initscript was geändert.

Kannst es auch manuell anpassen, geht schneller. Siehe Post im VDR-Portal.

Martini

----------

## bjokuh

```

   #

   # finaly start vdr

   # 

   [ -x /usr/bin/show_dvb_image ] && killall /usr/bin/show_dvb_image 2>/dev/null

   env LD_ASSUME_KERNEL=2.4.1 start-stop-daemon \

      --start --chuid vdr --exec /usr/bin/vdr -- \

      --daemon "${vdropts[@]}"

   exitcode=$?

```

Damit anpassen? Was hat denn das LD_ASSUME_KERNEL=2.4.1 zu sagen? ich habe kein Kernel 2.4.1, sondern ein 2.6. Kernel installiert.

Und wie geschrieben, ein erneutes emergen von VDR funktioniert nicht.

----------

## bjokuh

Habe meinen sync-Mirror wieder auf "Normal" gestellt, und habe, wie Martini es vorgeschlagen hat, einen Overlay zu gentoo-de angelegt.

Soweit so gut. Das VDR-Init-Skript ist nun auch ein anderes, aber ich habe immer noch ein paar Fragen.

Folgendes spuckt mir mein Logfile aus:

```

Apr 21 17:36:17 [vdr] VDR version 1.3.22 started

Apr 21 17:36:17 [vdr] loading plugin: /usr/lib/vdr/libvdr-remote.so.1.3.22

Apr 21 17:36:17 [vdr] loading plugin: /usr/lib/vdr/libvdr-tvtv.so.1.3.22

Apr 21 17:36:17 [vdr] loading plugin: /usr/lib/vdr/libvdr-mplayer.so.1.3.22

Apr 21 17:36:17 [vdr] ERROR: /etc/vdr/themes: Permission denied

Apr 21 17:36:17 [vdr] loading /etc/vdr/setup.conf

Apr 21 17:36:17 [vdr] ERROR: unknown config parameter: RecordDolbyDigital = 1

Apr 21 17:36:17 [vdr] loading /etc/vdr/sources.conf

Apr 21 17:36:17 [vdr] loading /etc/vdr/diseqc.conf

Apr 21 17:36:17 [vdr] loading /etc/vdr/channels.conf

Apr 21 17:36:17 [vdr] loading /etc/vdr/commands.conf

Apr 21 17:36:17 [vdr] loading /etc/vdr/svdrphosts.conf

Apr 21 17:36:17 [vdr] loading /etc/vdr/ca.conf

Apr 21 17:36:17 [vdr] loading /etc/vdr/keymacros.conf

Apr 21 17:36:18 [vdr] ERROR: /dev/dvb/adapter0/frontend0: Permission denied

Apr 21 17:36:18 [vdr] no DVB device found

Apr 21 17:36:18 [vdr] initializing plugin: remote (0.3.3): Remote control

Apr 21 17:36:18 [vdr] initializing plugin: tvtv (0.1.6): TVTV Timers update

Apr 21 17:36:18 [vdr] initializing plugin: mplayer (0.9.10): Media replay via MPlayer

Apr 21 17:36:18 [vdr] loading /etc/vdr/plugins/mplayersources.conf

Apr 21 17:36:18 [vdr] ERROR: invalid primary device number: 1

Apr 21 17:36:18 [vdr] ERROR: no primary device found - using first device!

Apr 21 17:36:18 [vdr] ERROR: invalid primary device number: 1

Apr 21 17:36:18 [vdr] ERROR: /etc/vdr/setup.conf.$$$: Permission denied

Apr 21 17:36:18 [vdr] deleting plugin: mplayer

Apr 21 17:36:18 [vdr] deleting plugin: tvtv

Apr 21 17:36:18 [vdr] deleting plugin: remote

Apr 21 17:36:18 [vdr] exiting

Apr 21 17:36:20 [rc-scripts] Failed to start vdr.

```

Kann mir jemand helfen?

----------

## JoHo42

Hi Leute,

ich habe das selbe Problem wie bjokuh.

Ich starte den vdr als user graupe.

Dabei kommt dann ebenfalls:

Apr 21 17:36:18 [vdr] ERROR: invalid primary device number: 1 

Apr 21 17:36:18 [vdr] ERROR: /etc/vdr/remote.conf.$$$: Permission denied

wie kann ich VDR als USER Starten.

Gruss J&ouml;rg

----------

