Enabling a composited desktop with Xinerama on Kubuntu Karmic Koala 9.10.

tags: Composite Xinerama Ubuntu Kubuntu Multi-GPU Two Cards

Unfortunately for Linux users who want to use more than one graphics card in a multi monitor setup, there's a bit of a catch. In order to make your desktop seamlessly span the multiple cards, you need to enable Xinerama. And, when Xinerama is enabled, you can no longer use a composited deskop. No more 'wobbly windows', true transparancy, and the higher performance compositing brings to a windowed environment. Well thanks to the guys that developed XGL, and to d2globalinc for having testing it as a way to work around the Xinerama/Compositing, we can now have our cake and eat it to. There are some draw backs to using XGL though. It's no longer maintained, so if something comes along that breaks it, we'll be outta luck. Also full screen GL aaccelerated applications can also have problems.

Not withstanding its problems in certain situaltions, it's all we have at the moment for tripple head and more monitor setups. ATI's Eyefinity cards will support more than two screens per card so this would present the best hope we have although there is the Matrox 'DualHead2Go' and 'TrippleHead2Go' that provide hardware work arounds that may be usefull to some. Of course the best solution would be for the X developers to fix X so that we didn't have this problem in the first place, but there's no one working on this at the moment, and may never be.

So, for most of us, all we have is d2globalinc's solution unless we buy more hardware. So in order to implement his work-around, we need to go through these steps. Here, I'll be assuming we're using nVidia graphics cards. If you're prepared to use ATI cards, and therefore deal with their drivers, a better option might be to buy an Eyefinity card.

The hardware setup I'm using is as follows.


  • Kubuntu Karmic Koala 9.10
  • nVidia device driver version 190.42
  • xserver-xgl package from Hardy

First, a summary preview of the steps involved.

  1. Install Karmic (apply any required updates, if any of them require rebooting, do that)
  2. Download nVidia Device driver and xserver-xgl package
  3. Install Device Driver.
  4. Setup X to use the new driver.
  5. Log back into the desktop.
  6. Use the nVidia utility to enable the extra screens and Xinerama.
  7. Restart the X server.
  8. Install Compiz and xserver-xgl.
  9. Enable Compiz (thereby disabling KWIN)
  10. Patch the Xgl-session script so it'll work in Karmic.
  11. Restart X. (X will automagically be started with XGL)

So, here's the procedure in detail.

1. Install Karmic.

Once it's installed, apply any updates that are available. To do this,

Start the "System Settings" tool

Choose "Add and Remove Software"


Click "Software Updates" on the left.

If any updates are available, do the followinng, otherwise skip to step 2.


Click "Select all updates"

Press “Apply”


Enter your password to enable the package updates

Packages will download and install.


Once updates are applied, and for thoroughness, reboot your system.

2. Download the nVidia 190.42 drivers and the xserver-xgl package.

The nVidia drivers are currently available via these links.

Click "Download"

Click "Agree & Download"


Save it to your home folder.

Wait for the file to download.


Once downloaded, start Dolphin, right click the driver file and choose properties.

Go to the Permissions tab and check "Is executable" and click "OK"


Download the xserver-xgl package. It's available in either 32 or 64 bit from the following links.

3. Install the device driver.

You might want to print or write down these steps as we must stop the X server to complete the installation of the driver.

  • Log out (but don't restart or shutdown the machine.)
  • Once at the log in screen, go to a text console by pressing CTRL-ALT-F1
  • Login to the text console.

Pressing CTRL-ALT-F1 gets you here.

Once logged in, you'll be in your home folder.


type "sudo stop kdm" to stop the X server.

Type "sudo ./NVIDIA", and tap the TAB key to complete the command and press enter to start the installer


Follow the prompts in the installer.

4. Allow the installer to modify the file 'xorg.conf'

By allowing the installer to modify the xorg.conf file this 'enables' the driver.

Now , start X again by typing "sudo start kdm"

You should see the graphical login screen appear.

(If X refuses to start, there's a problem, and the xorg.conf file will need to be corrected.)

5. Log back into the desktop.

Compositing is disabled. The nVidia driver probably isn't running.

Compositing goodness. Just what we want to see.

6. Now we need to setup X to enable your extra screens.

Start the "NVIDIA X Server Settings"

It needs to be started with 'root priveleges'.

To do this press ALT-F2 and in the text field, type "kdesudo nvidia-settings"

Enter your password.

Press ALT-F2 and type "kdesudo nvidia-settings" into the text field.

Enter your password to enable the settings tool.


Choose the "X Server Display Configuration" item and setup your screens as required.

I set mine up as follows.

  • The two screens on the 9800GT -> Setup in 'Twinview'
  • Enabled the third screen.
  • Enabled Xinerama.

Choose "X Server Display Configuration"

Select a screen to enable and click "Configure"


Where possible, a screen should be enabled as “Twinview”, otherwise as “Separate X screen”

Twinview is the preferred option.

If a screen needs to be enabled via "Separate X screen", you'll also need to enable Xinerama.


You can also drag the screens around to arrange them to reflect their physical locations.

Once you're happy with the settings, you'll need to save the configuration.

Save the X Configuration File

Click the "Save" button.


If an error about multiple X screens using absolute positioning appears you should be able to just click OK, and then choose "Save"

Quit from the NVIDIA X Server Settings tool.

7. Restart the X server.

To enable the extra screens that have just been turned on in the X Server Settings tool we need to restart the X server. To do this;

  • Log out from the desktop.
  • At the login screen (KDM) select "Restart X Server"

Click "ResetX Server".


If all went well, log back into the desktop.

You should be greated by your extra screens displaying the desktop, bu when Xinerama is enabled, compositing gets disabled, so you'll loose transparency from the panel, etc.

If the login screen didn't display itself again, you'll need to trouble-shoot or delete your xorg.conf

8. Install Compiz and xserver-xgl.

Start the "System Settings" tool.

Choose "Add and Remove Software"

Type compiz into the text field and press enter.

Select the following packages for installation.

  • compizconfig-settings-manager
  • compiz
  • compiz-kde
  • compiz-fusion-plugins-extra
  • compiz-fusion-plugins-main

Press Apply

When the installer notifies you of which packages will be installed, click "Install Now"

The installer will resolve any dependencies and notify you of additional packages it requires.

Click OK

If it asks for your password, enter it.

The installer will now download and install the packages.

The installer will resolve dependencies.

OK the dependancies.

Type compiz into the text field and press enter

Press "Apply" after selecting the required packages


Click "Install Now"

Click "OK" to the additional packages.


If the installer requires your password, enter it here.

The installer will download and install the packages.


Now that the compiz packages are downloaded and installed, we can install the xserver-xgl package that was downloaded earlier.

Start Dolphin and click on the package file you downloaded. The package installer should start.


Click the xserver-xgl package

The installer will start. Click "Install Package"


Enter your password.

Package is installed. Click "Close"

9. Enable Compiz

This is done with a simple script file placed into your .kde/env folder.

  • Start Dolphin
  • Navigate to your env folder with Dolphin.
  • Click the crumb bar to switch it to an editable bar.
  • Add .kde/env to you home folder location and press enter.
  • Right click and create a new text file called compiz.sh
  • Right click that file and open it with Kate

Enter .kde/env a the end of your home directory in the location bar.

Right click an empty part of the window and select "Create New" and "Text File". Name the file compiz.sh


Insert the following text into that file


# Use compiz as the windows manager.
export KDEWM=/usr/bin/compiz.real

Save the text file and quit Kate.

Right click the new file and open it with Kate

Past the following text into the window, save the file and exit Kate.


Now we need to make that file executable. To do this,

  • Right click the file and choose Properties.
  • From the Permissions tab check the “Is executable” item and click “OK”

Right click compiz.sh and select “Properties”

Check the "Is executable" option and click "OK"

10. Patch the Xgl-session script so it'll work in Karmic.

There's two ways to go here. You can either download d2globalinc's patch file and apply it to your xsession file, or download a file that's already patched for Karmic from the link below and add it to you system.

Patched file for Karmic.

If you download the file from the above link, before you copy it to the correct location you'll need to make it executable.

  • From within Dolphin
  • Navigate to the folder you downloaded the file to.
  • Right click the file and click "Properties"
  • Switch to the "Permisions" tab and check the "Is executable" option and click "OK"

Right click Xgl-session and choose "Properties"

Check the "Is executable" option and press "OK"


Now, to copy the file to a system area, we need "root privileges." The easiest way to do this is from the folder that contains the file, press the F4 key which will show a terminal, and enter the following command.

sudo cp Xgl-session /usr/share/xserver-xgl


The F4 key brings up a console

Enter "sudo cp Xgl-session /usr/share/xserver-xgl" and press enter. Then enter your password when asked.


That should be everything done. Now there's just one more thing to do. Restart the X Sever, and hopefully you'll be greated with a composited desktop with Xinerama enabled.

11. Restart the X Server.

Logout of the desktop, and log back in.

You should now be facing a face full of screens with Xinerama and Compisiting enabled. You should now go to the CompizConfig Settings Manager and enable wobbly windows, and other effects to your hearts delight.

I'd like to thank d2globalinc for his work that this page is based on. Without it, I'd be stuck with two separate X desktops until I can get my hands on an ATI Eyefinity card.

Copyright (c) 2009 Greg Newsome all rights reserved.