How to manage local X DISPLAY with a chroot?

System: openSUSE 12.2

Run a XFCE chroot, exporting to a local console graphical display

Have been able to successfully setup a chroot.
The chroot can be navigated using the command line, and even has successfully been updated using zypper (at least without error).
The problem now is attempting to export a graphical console to the Host.

After experimenting using Xnest and getting “unable to start” errors running startxfce4, I suspect that running Xnest may actually conflict with attempting to export to a XFCE Desktop. I tried running startxfce4 without Xnest and am now getting a rather standard Xorg error output which I consider likely progress (standard errors hopefully mean more common errors), as follows

:/> startxfce4
/usr/bin/startxfce4: Starting X server

_XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running

Fatal server error:
Cannot establish any listening sockets - Make sure an X server isn't already running

Please consult the The X.Org Foundation support 
 for help. 
Please also check the log file at "/var/log/Xorg.0.log" for additional information.

Server terminated with error (1). Closing log file.
:/> XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 7 requests (7 known processed) with 0 events remaining.

Attempts to analyze problem:
Determiining if an Xserver is running
I ran the following command both from within the chroot and on the Host

ls /tmp/.X11-unix

Results from running the above command, this leads me to believe that the Host is running only one Xserver display, and no Xserver display is running from within the chrrot (which likely eliminates the possibility of XFCE running in the chroot and only needs to be accessed some way).
chroot - Nothing. Just returned me to another command prompt
Host = X0

Attempts to export DISPLAY
Have attempted to run the following commands to export DISPLAY, but after both attempts I ran the above command listing displays on both Host and in chroot without any result change

From within the chroot

# This should export to a local display using Sockets
export DISPLAY=1


# This should export to a local display using TCP
export DISPLAY=localhost:1


# This uses a special xfce4 utility to export the display
xfce4-session --display=localhost:1

am hoping someone can see an error in what I’ve attempted or suggest an alternative method.


On Mon 04 Mar 2013 07:06:01 PM CST, tsu2 wrote:

am hoping someone can see an error in what I’ve attempted or suggest an
alternative method.


Start Xnest, then the window manager eg;

Xnest :1 -ac &
twm -display :1 &

The above works for me as my user…?

The other option I use is gdmflexiserver to start a new session on the
next available VT…

Cheers Malcolm °¿° (Linux Counter #276890)
openSUSE 12.2 (x86_64) Kernel 3.4.28-2.20-desktop
up 7 days 16:26, 5 users, load average: 0.27, 0.10, 0.07
CPU Intel® i5 CPU M520@2.40GHz | GPU Intel® Ironlake Mobile

I did not realy read all of this because I lack the experience with most of what you do (sorry).

But I do not quite understand if you understand what a statement like

export X="y"

That could be my fault, but I will try to give a short explanation.

Becaus this is in a shell (let us assume bash)


means that the shell variable X is created (if not already existing) and gets the string value y

The export command means that this variable X with the value y is then exported to the process environment.

All values in a process’s environment are copied to all processes that are offspring of that process. That means that when you, after the above, start a program


the process that runs that instance of programa can use the varibale X and see that it’s value is y.

To come back to:

export DISPLAY=localhost:1

When you now start a program


xlock will be able to find that DISPLAY is set to the string localhost:1. The program can then act accordingly. Accordingly meaning that it can ignore this completely, but in the case of xclock (and most if not all X using programs) it will try to open a window on the display indicated by the string localhost:1 (remember that X is also a network client/server application and that DISPLAY=" will try to open a window on displaysurface 3 of

If the opening of that window is allowed depends on the security, etc. on the system (I guess will not even have the appropriate network port openend). Even if the connection is allowed, the owner of the display surface may not have allowed others to open windows (the default case).

Thx Malcom and HVV,

Have been able to launch a console using Xnest, but more research seems to verify my current experimentations…

Whenever you launch a Desktop, the Desktop typically includes its own Windows Manager. Seems logical, “startx” and “startxfce4” are typically invoked from a init3 “multi-user” console environment, not from an already running graphical environment.

As my experiments have shown, if you launch a graphical console like Xnest, because it is a graphical console it requires launching a Windows Manager of its own <first> so you cannot launch a Desktop <after> launching Xnest because invoking a second window manager causes conflicts(AFAIK you can’t run 2 window managers simultaneously).

So, another solution is required. My early investigation suggests that the Desktop initialization script should support sending to a specific DISPLAY, not always the default 0.0

Am still considering the consequences of this, if I define the DISPLAY to use sockets, it just might automatically invoke a local console on the Host or maybe not instead simply running a second DISPLAY that can be switched to. So, am musing that the better approach would be to define DISPLAY to use TCP (eg DISPLAY=localhost:1) so I can <then> configure a console to access.

I find it odd I cannot find anything on the Internet for something like this (chroot and launching a Desktop in a graphical console). How can no one have done this before or should this be such a PITA no one has posted anything about doing this?