This site is now 100% read-only, and retired.

Running multiple X11 sessions

Posted by Steve on Tue 18 Jan 2005 at 11:14

Tags: , ,

For testing out Window managers, or developing applications it's sometimes useful to run more than one X11 Window session. Normally you'd do that by setting up X to run on another virtual terminal, but thats a bit awkward to use, and only works if you're physically in front of the machine. Instead you could run nested X11 sessions.

XNest allows you to start a new X11 session inside your current one, running completely seperate from it.

It's very useful for testing out Window Managers, as you can only have one window manager running at a time.

xnest is usually installed when you setup the X11 window system on Debian machines, but if it's not you can get it by running the following command as root:

apt-get install xnest

Usage is very simple:

Xnest -ac :2

This will create a new window which has the DISPLAY string set to ":2". (The -ac flag allows you to connect to it, and is important).

Once this is done you can run commands that will display inside that by adding "-display :2" to their command line, such as:

xterm -display :2

This will give you an xterm running inside your new X11 environment.

To run a new window manager run:

/etc/alternatives/x-window-manager -display :2

This will give you your default window manager in the new session, which you can use to execute programs, etc.

If you wish to test out a new window manager, such as xfce you can do that by running as root:

apt-get install xfce4


Xnest -ac :22 &
export DISPLAY=:22
xfce4-session &

This sets up a new X11 session running as ":22", and then starts a copy of the xfce environment inside it.

If you like it you can set this up as your primary window manager, if not you can just remove it..



Re: Running multiple X11 sessions
Posted by Anonymous (60.231.xx.xx) on Mon 27 Jun 2005 at 05:10
erm... why is that I always have problems with my linux system... i must suck. and i'm a newbie trying to learn.. When i type the command Xnest -ac :2 on tty1 while running gnome on tty7 it says 'Fatal server error: Unable to open display "2"' and when i type the command in a terminal in gnome it says _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running

Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running
can you please help me??

[ Parent ]

Re: Running multiple X11 sessions
Posted by marculin76 (195.7.xx.xx) on Wed 22 Mar 2006 at 16:02
--- sorry for the english :p ---

got the same problem me too...but before another words, see this article that say a bit about X x/

finded in :) From my debian machine I have used Xnest program to test the new KDE's release, 3.5.1, after downloaded it, configured it, maked & make installed all the packages in my home folder...nearly to 9 hours of CPU and memory to 100%...

from konsole (tty0 within kde 3.3.2) I launch

Xnest :2 &
then I generate one 'cookie' for the authetication client versus X :2
Xauth generate :2 .
I lauched for test
xconsole -display :2
that is appeared in X within Xnest window
then I have exported
replacing the default in :0.0
I launch
(of KDE 3.5.1) without to indicate the display
and finally I started
(of KDE 3.5.1) and it's appeared in Xnest in all its splendore ;B

(this i think that is not mandatory or can do in temporary way)Before all I had added in PATH the absolute path for new KDE binary, in LD_LIBRARY the path to KDE lib and create the variable KDEDIR pointed on installation folder.

sorry for xfce, i didn' not tried yet but the new Konqueror is a really kick ass !!! ...rock'on guys...

[ Parent ]