X server tricks

I use ubuntu Dapper (6.06), but often want to use two X servers at the same time. It's possible to use gdmflexiserver to get a second login, but it's a pain to use, as one has to manually go and select a different session, and then answer silly questions each time. Here is a little script to start a second X server running kde, from within ion:

  • The main command is in a file, let's say mykde: #! /usr/bin/env bash
    exec xinit "$HOME/.xinitkderc" -- :1
    which has to be executable, so run chmod ugo+x mykde. This runs xinit, which itself starts an x server on display 1.
  • At first, I got several authorization errors. The two that solved my issues were:
    1. Make sure you're allowed to start an X server: run dpkg-reconfigure x11-common and select "Anybody" when asked about the permissions to run X servers
    2. Get access to the .Xauthority file: run sudo chwon user:user .Xauthority
    3. Make sure .Xauthority knows about a server on :1. Run xauth list. If there is nothing on display :1, you need to add it by running xauth add something:1 . `mcookie` and substitue whatever it says on the xauth list output before the colon. For example, I used to get ubuntu/unix:0 MIT-MAGIC-COOKIE-1 167f506fc44d99896434253da733195b so substituted 'ubuntu/unix' for 'something'.
  • mykde asks for the .xinitkderc file. This is a standard .xinitrc file, which specifies which things to run when the Xserver starts up. Mine looks liek this: #! /usr/bin/env bash
    xset -b b off
    setxkbmap gb
    ssh-add « /dev/null
    xterm &
    konqueror /home/qhuys/ &
    firefox&
    exec startkde
    The last line actually launches the kde server.
  • Hopefully, you will now find that this runs a second Xserver, with KDE, without you having to log in again etc.