1

I'm attempting to start a program that requires rendering a window (Unity Game) on a remote server that doesn't have a display attached to it. I wouldn't want to use ssh -X to forward rendering commands to my local machine. I'm trying to run the program in headless mode but still making use of the remote server's GPU, or use Xvfb, but I cannot get it to work.

In the first step of this process, I try to determine whether X server is already running. Upon sshing into the remote server, I ran

echo $DISPLAY

and it returns empty string. I thought that this means the X server is not running (reference)

However, I encounter contradicting information:

  • When running ps ax | grep X, I get

    2149 tty1     Sl+    0:03 /usr/lib/xorg/Xorg vt1 -displayfd 3 -auth /run/user/121/gdm/Xauthority -background none -noreset -keeptty -verbose 3
    

    This means indeed X server is running (because of the Xorg executable). Running ps -C Xorg also shows PID 2149 (reference).

  • Also, when I run Xvfb :0.0, I get

    $ Xvfb :0.0
    _XSERVTransSocketUNIXCreateListener: 
    ...SocketCreateListener() failed
    _XSERVTransMakeAllCOTSServerListeners: server already 
    running
    (EE) 
    Fatal server error:
    (EE) Cannot establis
    

    This again seems to indicate that an X server is already running on :0.0.

However (again), when I run xdpyinfo, the utility for displaying information about an X server, I get

$ xdpyinfo
xdpyinfo:  unable to open display "".

and

$ xdpyinfo -display :0.0
No protocol specified
xdpyinfo:  unable to open display ":0.0".

This seems to tell me again that the X server is not running.

What is going on? Is the X server running?

As you may be able to tell I'm a newbie to X-server related issues. Please feel free point out any problem with my steps above, and suggest ways to resolve this. Thanks! There's a lot to learn.

zkytony
  • 111
  • Here the author proposes a way to find the locally-running servers: (cd /tmp/.X11-unix && for x in X*; do echo ":${x#X}"; done). Can you try it? (It would be just enough to call ls /tmp/.X11-unix.) – sasha Apr 26 '21 at 12:19
  • There is a file X0 in /tmp/.X11-unix – zkytony Apr 27 '21 at 14:49
  • I managed to have a workaround on another server which definitely did not have X server running at first. I had to install Xorg and Xvfb, and I ran sudo Xorg :0.0 and my application was able connect to that server. Interestingly echo $DISPLAY is still an empty string, yet xdpyinfo :0.0 actually returns information. – zkytony Apr 27 '21 at 14:55
  • echo $DISPLAY just outputs a value of the variable, whatever it is. If nobody has set it before, then it has no value (if anybody set it to a wrong value, then it has the wrong value). You might need setting $DISPLAY to a specific value (if you know a specific X server exists and want the subprocesses to use it by default), but getting the $DISPLAY doesn't really give any information except “somebody has set a specific value” or “nobody has set any value yet”. – sasha Apr 27 '21 at 15:12
  • @sasha It seems like people have debated about whether $DISPLAY can be used to check X server is running: https://stackoverflow.com/questions/637005/how-to-check-if-x-server-is-running . I feel that xdpyinfo is probably the right way to check – zkytony Apr 28 '21 at 12:58
  • There seems to be a confusion between 2 concepts. $DISPLAY is a correct way for a program to determine what X server it should use (because there may be many X servers available; and the program shouldn't do anything unexpected for a user, behave in a non-standard way). But it's not a way for a human being to detect which X servers are actually available (because it's just an environment variable, nothing more; it's value may give a hint but can't be used as a proof). – sasha Apr 28 '21 at 14:18

0 Answers0