How to automatically login to MythTV on boot

In my last 2 MythTV posts, I explained how to get mythbackend running on boot, and how to get mythfrontend started automatically when you start X.

Now I’m going to explain how to get X to startup and login on boot.
This essentially makes your MythTV setup completely operational from powerup, without user intervention.
Definate WAF in that…

This is how I did it on my Debian machine.

I’m running my MythTV as the user ‘mythtv’ on my machine.

First, you’ll need rungetty installed

apt-get install rungetty

Then open your inittab config in your favourite editor

vi /etc/inittab

Look for the line that starts all your getty’s. It looks something like this

1:2345:respawn:/sbin/getty 38400 tty1

You’ll have to change it to this

1:2345:respawn:/sbin/rungetty tty1 --autologin mythtv

That’ll make it automatically log in to the mythtv user on tty1

Now, you’ll want to automatically start X whenever the mythtv user logs in to tty1
Its nice to constrain it to run, when the user logs in on tty1 only. That way, you can change tty’s and login without having X trying to start up automatically.

Edit your .profile for your mythtv user

vi /home/mythtv/.profile

Put the following in it

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

That’ll start up X as soon as the mythtv user logs in, and if X dies, it’ll wait 10 seconds and then restart it.