[mythtv-users] Misc. tips and tricks for RedHat + ivtv users

Andrew Dodd atd7 at cornell.edu
Fri Feb 6 18:50:13 EST 2004


I figured I'd share a few tips/tricks useful for people using RedHat + ivtv, in
case anyone else ran into some of the problems I've had.

First, under RH 7.3 (and I'm betting more recent versions too), PAM is set up so
that when a local user logs in, permissions of various devices are set so that
that particular user can access the devices.  After they log out, the device
permissions are set back to a default state.  In my case, it was read/write for
ONLY the user that logged in, or for root (reversion of the permissions).  This
would cause problems because mythbackend is running as user "mythtv" on my system.

The solution I used was to change /etc/security/console.perms to change the
device to mode 660 instead of 600 (user AND group read/write) and set it to
revert back to root.mythtv instead of root.root when a user logged out.  (For
some reason it doesn't set the group when a user logs in.)  In my case, the line is:

<console>  0660 <v4l>        0660 root.mythtv

It used to be:
<console>  0600 <v4l>        0600 root

Next, in some cases, the ivtv driver would get screwed up and mythbackend would
start spewing out Input/output errors when trying to read from /dev/video0. 
What I did was write a script that runs every minute, and if the errors are
detected in the backend log, will stop mythbackend, unload and reload ivtv, and
start mythbackend.

I made changes in a few places to do this.  First, I'm using the
etc.rc.d.init.d.mythbackend script from the contrib directory to run mythbackend
as a service.  (Of course moved to /etc/rc.d/init.d/mythbackend).  I modified
the script as follows:

Change the code:

restart() {
        stop
        start
}
                                                                               
                        
to:

restart() {
        stop
        /sbin/modprobe -r ivtv
        /sbin/modprobe ivtv
        start
}

So if a restart command is issued, the module is reloaded while the backend is
stopped.

Next, I created a script called /sbin/restartmythonerror.cron, it's attached. 
It checks the backend logs for input/output errors and restarts the backend if
they are detected.

Last, I modified /etc/crontab to run the script every minute, i.e. added the line:

* * * * * root /sbin/restartmythonerror.cron

After everything else, and restarted crond.

So next time the ivtv driver FUBARs, the script should automatically restart the
backend and reload the module.  (I missed two recordings to this problem last
night...)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: restartmythonerror.cron
Type: application/octet-stream
Size: 245 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-users/attachments/20040206/00cbfdf7/restartmythonerror.obj


More information about the mythtv-users mailing list