Frontend Auto Login

From MythTV Official Wiki
Revision as of 20:32, 9 April 2006 by Fishter (talk | contribs) (No Window Manager: Add note about this being unsupported due to focus issues)

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.


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


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,


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

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

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.


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 all -l /home/mythtv/mythfrontend.log

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.

You should note that running mythfrontend without a window manager is not a supported configuration. You may run into focus problems when trying to press buttons, enter text and generally use the system.


To use fvwm, edit your .xinitrc like,

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

Next edit your .fvwm2rc,

# Submitted by Scott Elliott <selliott at>
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

For the default user, create a link in ~/.kde/Autostart that points either to the script listed above (or some other script that starts the front end) or merely to mythfrontend itself. The system will now log in automatically, and immediately start the frontend.

Frontend Auto Login with Fedora Core 5 and GNOME / GDM

To set GDM to auto-login your mythtv user, edit your GDM configuration:

 vi /etc/gdm/custom.conf

Add the following lines to the [daemon] section:


Then, set the $HOME/.xsession file for your mythtv user to start mythwelcome:

 vi ~mythtv/.xsession

An example, which will start the Metacity window manager, an xterm (which you can start with F12 from mythwelcome) and finally, mythwelcome itself.

Note: If mythwelcome dies for some reason, GDM will restart it.

metacity &
xterm &

Make sure to make it executeable:

 chmod 755 ~mythtv/.xsession

If you'd like to be able to login as a different user before GDM logs in your mythtv user, replace the AutomaticLogin lines in your GDM configuration with TimedLogin lines.

This example will wait 10 seconds before logging in the mythtv user.