Setting up MythTV as a dedicated HTPC machine requires MythTV to start on boot and restart if anything crashes, have no desktop environment and a light weight display manager. I found the best display manager for running MythTV as a dedicated HTPC is LightDM. It is easy to configure, has no default desktop environment, and has auto login feature. Once configured correctly only mythfrontend will boot on startup and respawn is anything crashes.

Setting Up LightDM

To switch to LightDM, first make sure it is installed.


sudo apt-get install lightdm

You will get prompted during the installation process which display manager you want to use. If you have multiple installed make sure you select lightDM. If you already have lightDM installed then just update /etc/X11/default-display-manager


/usr/sbin/lightdm

Auto Login

To configure LightDM to auto login and continue to auto login if X or MythTV crashes edit /etc/lightdm/lightdm.conf


[Seat:*]
autologin-guest=false
autologin-user=mythtv
autologin-user-timeout=0
user-session=mythtv

Greeters provide the login panel, so remove any reference to greeters. The autologin-user is the user you want mythtvTV to run as. user-session is the xsession to run after logging in.

XSession

The value of user-session needs to reference a file in /usr/share/xsessions/. So in this example my user-session is mythtv so I need a file named mythtv.desktop.


[Desktop Entry]
Name=mythtv
Exec=/usr/bin/mythfrontend.real
Type=Application

Testing

Assuming lightDM is already running, restart it


sudo systemctl restart lightmd

If everything works when lightDM restart it should automatically login mythtv user and running mythfrontend. If something so wrong check out /var/log/lightdm/lightdm.log.