Running MythTV on independent X-server

From MythTV Official Wiki
Jump to: navigation, search

This HOWTO will guide you in setting up your ordinary desktop system with an extra, 100% independent and separate, X-server for MythTV. Thus you will have one PC serving you with both desktop services by keyboard and mouse simultaneously with HTPC/PVR services by IR-remote on your television/flatscreen/projector (from now on refered to as TV).


This HOWTO only focuses on the special steps in setting up this "dual screen" scenario. For all other aspects of configuring MythTV or X you should search the Internet for other ressources.

You will need:

  • Running Linux desktop system on primary graphics adapter
  • Configured MythTV with remote control
  • An additional secondary graphics adapter

This guide will not cover:

  • Configuring Xorg device settings for additional graphics adapter
  • Configuring LIRC

Secondary graphics adapter

First make sure you have both graphics adapters and monitors configured in your Xorg.conf. This includes two pairs of Device and Monitor sections. Your primary pair should be included in your Default Screen and working with your desktop. The secondary pair should be configured and working with correct module,modelines, required TV-out setting etc., but should be left unused. To check if the secondary pair is working well, edit the following in the Screen section:

  • Comment out the existing Device line
  • Add a new Device line with the Identifier of your secondary card
  • Restart X and confirm your desktop is running on your TV.
  • Change things back and restart X once more

Make sure Xinerame is disabled:

Section "ServerFlags"
       Option          "Xinerama" "false"

Dummy input

The additional X-server will have no keyboard and mouse available and we want to keep our existing keyboard and mouse on the desktop. To achieve this we will need to configure the additional X-server with a set of dummy devices by utilizing the Xorg "void input driver".

First, check if you have the driver available:

ls /usr/lib/xorg/modules/input/

If it's not available, you should install the driver, preferably through your distributions package system. On my Kubuntu:

apt-get install xserver-xorg-input-void

Add the dummy devices to your Xorg.conf:

Section "InputDevice"
       Identifier      "Dummy Keyboard"
       Driver          "void"
       Option          "CoreKeyboard"

Section "InputDevice"
       Identifier      "Dummy Mouse"
       Driver          "void"
       Option          "CorePointer"

Configuring Xorg

You should now add an additional Screen and ServerLayout section to your Xorg, including your secondary pair of graphics adapter and monitor and your dummy input devices:

Section "Screen"
       Identifier      "Myth Screen"
       Device          "VideoCard1"
       Monitor         "Monitor1"

Section "ServerLayout"
       Identifier      "Myth Layout"
       Screen 0 "Myth Screen" 0 0
       Inputdevice     "Dummy Keyboard"
       Inputdevice     "Dummy Mouse"

If your graphics adapter or monitor needs any additional settings in the Screen section, you should add them. You should leave your Default Screen and Default Layout untouched. Now restart your X and check that it's still working on your desktop. Don't expect anything on your TV just yet.

Starting secondary X-server

Normally, only root is allowed to start a new X-server, but as you are probally running MythTV as yourself or a dedicated user you will need to allow anybody to start an X-server.

Edit /etc/X11/Xwrapper.config


Now, you are ready to start your secondary X-server. From a console or xterm:

xinit mythfrontend -- :1 -sharevts -layout "Myth Layout" -br -dpms

Now you should see MythTV running on your TV. Grab your remote and play.

Starting at boot

You would probally want your MythTV to be available at all times, so I suggest you add it to your systems startup scripts. On my Kubuntu which utilizes Upstart i added a service named Xmyth by creating the file /etc/event.d/Xmyth:

# X server for MythTV
# Replace MY-USER with the user running MythTV on your system
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5

stop on runlevel 0
stop on runlevel 1
stop on runlevel 6

exec /usr/bin/sudo -H -u MY-USER /usr/bin/xinit mythfrontend -- :1 -sharevts -layout "Myth Layout" -br -dpms

Start the service by running

start Xmyth