Frontend Auto Login

From MythTV Official Wiki
Revision as of 16:55, 24 February 2006 by Perlguy9 (talk | contribs)

Jump to: navigation, search

Part of a proper frontend system is having it automatically login as the mythtv user and loading mythfrontend. There are a variety of methods to do this. KDM allows for auto-login, but doesn't handle mythfrontend crashes well. The best method is to use inittab to login the user straight into mythfrontend.

Setup

First you will need to make sure you have mingetty installed. Next, make sure you have a dedicated user to run the mythfrontend wth a home directory.

inittab

Add the following line to your '/etc/inittab' file,

c7:12345:respawn:/sbin/mingetty --autologin=mythtv tty7

This is what will login the mythtv user.

Option 1

Now we will setup the mythtv user,

.bash_profile

In that home directory, create/edit a .bash_profile file like this,

if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty7 ]; then
while [ 1 == 1 ]
     do
          startx
          sleep 10
     done
fi

this will start X only if running on virtual terminal 7, so if you telnet or ssh into the box it will not react strange. It will also restart X if the frontend crashes.

.xinitrc

There are two options for .xinitrc, one will load a window manager, the other will not.

No Window Manager

For no windowmanager, create/edit the user's .xinitrc and add,

xset -dpms s off
xsetroot -solid black
mythfrontend -v -l /home/mythtv/mythfrontend.log
#mythtv-setup
#xterm

This will turn off dpms, turn the X default background color black, turn verbose logging on, and log everything to /home/mythtv/mythfrontend.log, this can be changed. Also included is an easy way to access mythtv-setup or xterm, just uncomment the appropriate line and comment out the mythfrontend line.

fvwm

To use fvwm, edit your .xinitrc like,

xset -dpms s off
xsetroot -solid black
x11vnc -many -q -bg -rfbauth .vnc/passwd
fvwm2 &
mythfrontend -v -l /home/mythtv/mythfrontend.log 2>&1
#mythtv-setup
#xterm

Next edit your .fvwm2rc,

# Submitted by Scott Elliott <selliott at insight.rr.com>
Style "*" RandomPlacement, DumbPlacement
Style myth* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus,
GrabFocus, BorderWidth 0
Style xmame* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus,
GrabFocus, BorderWidth 0, StaysOnTop
Style mplayer* NoTitle, NoHandles, Sticky, WindowListSkip, SloppyFocus,
GrabFocus, BorderWidth 0

Option 2

If the above instructions don't give you results you like, there is another option to autologin. You can use inittab to login as the mythtv user and launch X all at once, without having to create a .bash_profile script.

Find the following line in your /etc/inittab file:

6:2345:respawn:/sbin/getty 38400 tty6

And comment it out by adding the "#" symbol in front of it:

#6:2345:respawn:/sbin/getty 38400 tty6

Then add this line directly under the line you just commented out:

6:2345:respawn:/usr/bin/openvt -fwc 2 -- /bin/su - mythtv -c /usr/bin/startx >& /dev/null

This command starts X as the mythtv user, and will restart X automatically if MythTV crashes. This option has the advantage that if your distribution has a graphical boot sequence like Ubuntu, Red Hat, Mandriva, etc, then you won't see any text before Myth starts. It looks a little more professional. This also means that you don't have to create a .bash_profile script. Edit your .xinitrc file according to the directions above and you are done.

Some may prefer this method of logging in and starting X to the method above because X prefers to use tty 7 and the method above may cause problems.

Option 3

Configure KDM to login automatically as a default user. Then configure your desktop (KDE or GNOME) to autostart a program like mythfrontend. To deal with mythfrontend crashes, I would suggest that you run a wrapper around mythfrontend like: while true; do mythfrontend; sleep 5s; done

More detailed instructions to follow.

Option 4