Repository: stepjam/RLBench
Issue: Problems for Running Headless
Root cause: Environment Incompatibility

Hi, all. I met some problems following the instruction of Running Headless on both the PyRep and RLBench. 
For PyRep, here are my commands:
```
nohup sudo X &
export DISPLAY=:0.0
cd  examples
python example_reinforcement_learning_env.py
```
I tried to set the `headless=False` and `headless=True` at [https://github.com/stepjam/PyRep/blob/master/examples/example_reinforcement_learning_env.py#L27](url) and both outputs are the same:
```
qt.qpa.xcb: could not connect to display :0.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)
```
After that, I followed [https://github.com/stepjam/PyRep/issues/225](url) in which case I set `headless=True` and run `xvfb-run python example_reinforcement_learning_env.py`. Then it worked :)
```
Starting episode 0
Starting episode 1
Starting episode 2
Starting episode 3
Starting episode 4
Done!
[CoppeliaSim:loadinfo]   done.
```

Based on the success on PyRep, I set `headless=True` and tried the same command running the `examples/single_task_rl.py` on RLBench:
```
nohup sudo X &
export DISPLAY=:0.0
cd  examples
python single_task_rl.py
```
It had the same error output as I met on PyRep:
```
qt.qpa.xcb: could not connect to display :0.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)
```

Then I tried the successful command on PyRep :
```
xvfb-run python single_task_rl.py
```
But this time I got the error:
```
Reset Episode
qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize 0, stencilBufferSize 0, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CoreProfile)
qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 3.2, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 0, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize 0, stencilBufferSize 0, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::CoreProfile)
Could not initialize GLX
Aborted (core dumped)
```

Then I also tried the solution mentioned in [https://github.com/stepjam/RLBench/issues/89](url):
```
Xvfb :99 -screen 0 1024x768x24 +extension GLX +render -noreset &
export DISPLAY=:99
python single_task_rl.py
```
But it still did not work and here is the error informatoin:
```
Reset Episode


Error: signal 11:

/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libcoppeliaSim.so(_Z11_segHandleri+0x2b)[0x7fa74a68dbab]
/lib/x86_64-linux-gnu/libc.so.6(+0x354c0)[0x7fa75f9574c0]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libQt5Gui.so.5(_ZNK14QOpenGLContext10shareGroupEv+0x0)[0x7fa74890f060]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libQt5Gui.so.5(_ZN16QOpenGLFunctions25initializeOpenGLFunctionsEv+0x4b)[0x7fa748bdba4b]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libQt5Gui.so.5(_ZN24QOpenGLFramebufferObjectC1EiiNS_10AttachmentEjj+0xc8)[0x7fa748bdfa18]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libsimExtOpenGL3Renderer.so(_ZN18CFrameBufferObjectC2Eii+0x54)[0x7fa71a2f8314]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libsimExtOpenGL3Renderer.so(_ZN16COpenglOffscreenC1EiiiP14QOpenGLContext+0x68)[0x7fa71a2f86b8]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libsimExtOpenGL3Renderer.so(_Z21executeRenderCommandsbiPv+0x1f13)[0x7fa71a2f6943]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libcoppeliaSim.so(_ZN16CPluginContainer11extRendererEiPv+0x15)[0x7fa74a834f15]
/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libcoppeliaSim.so(_ZN13CVisionSensor24_extRenderer_prepareViewEi+0x34f)[0x7fa74a5583bf]
QMutex: destroying locked mutex
```

Could anyone help me solve the problem of running RLBench?
Thank you very much! I really appreciate the time spent on this.



Hi.
Please try and avoid using xvfb from now on; VirtualGL is the suggested way to run RLBench/Pyrep (as per the new README instructions).
So let's try and resolve the first issue you posted, i.e. `qt.qpa.xcb: could not connect to display :0.0`

Based on your error, it seems like the Xserver is not running. Can you print the output of nvidia-smi? 


I get this error:
```
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)
```
Exact same error, excluding the failure to connect to display.

What is the output of:
`ldd $COPPELIASIM_ROOT/platforms/libqxcb.so`

```
linux-vdso.so.1 (0x00007ffd4fbe9000)
libQt5XcbQpa.so.5 => /home/ryanrudes/CoppeliaSim_Edu_V4_1_0_Ubuntu18_04/libQt5XcbQpa.so.5 (0x00007f9a953c5000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f9a95180000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f9a94ecc000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f9a94caf000)
libQt5Gui.so.5 => /home/ryanrudes/CoppeliaSim_Edu_V4_1_0_Ubuntu18_04/libQt5Gui.so.5 (0x00007f9a94462000)
libQt5DBus.so.5 => /home/ryanrudes/CoppeliaSim_Edu_V4_1_0_Ubuntu18_04/libQt5DBus.so.5 (0x00007f9a941d6000)
libQt5Core.so.5 => /home/ryanrudes/CoppeliaSim_Edu_V4_1_0_Ubuntu18_04/libQt5Core.so.5 (0x00007f9a93a3d000)
libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007f9a93794000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9a93575000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f9a93373000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f9a9314b000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f9a92f41000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f9a92d2f000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f9a929f7000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9a92659000)
libxkbcommon-x11.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 (0x00007f9a92451000)
libxkbcommon.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007f9a92212000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9a9200e000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9a91c85000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9a91a6d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9a9167c000)
libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f9a9147a000)
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f9a91163000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f9a90f31000)
libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f9a90cff000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f9a90ab2000)
libicui18n.so.56 => /home/ryanrudes/CoppeliaSim_Edu_V4_1_0_Ubuntu18_04/libicui18n.so.56 (0x00007f9a90619000)
libicuuc.so.56 => /home/ryanrudes/CoppeliaSim_Edu_V4_1_0_Ubuntu18_04/libicuuc.so.56 (0x00007f9a90261000)
libicudata.so.56 => /home/ryanrudes/CoppeliaSim_Edu_V4_1_0_Ubuntu18_04/libicudata.so.56 (0x00007f9a8e87e000)
/lib64/ld-linux-x86-64.so.2 (0x00007f9a9596a000)
libGLX.so.0 => /usr/lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f9a8e64d000)
libGLdispatch.so.0 => /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f9a8e397000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f9a8e193000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f9a8df8d000)
libxcb-xkb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007f9a8dd71000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f9a8daff000)
libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007f9a8d87b000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f9a8d666000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9a8d45e000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f9a8d238000)
liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f9a8d01c000)
libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007f9a8cd00000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f9a8caeb000)
```

OK that all looks good. A few questions:
- Can you confirm that you are running on a headless display? (i.e. opening a new session and running `echo $DISPLAY` should print nothing)
- Are you running under conda or under docker?
- Are you able to launch coppeliaSim by itself? I.e. `cd $COPPELIASIM_ROOT ; ./coppeliaSim.sh`

> Hi.
> Please try and avoid using xvfb from now on; VirtualGL is the suggested way to run RLBench/Pyrep (as per the new README instructions).
> So let's try and resolve the first issue you posted, i.e. `qt.qpa.xcb: could not connect to display :0.0`
> 
> Based on your error, it seems like the Xserver is not running. Can you print the output of nvidia-smi?

Hi, stepjam.
Here is the output of nvidia-smi:
```
(carla_py37) syr@jtang02-11:/data2/wk/BatchDRL$nvidia-smi
Thu Jul 15 10:42:27 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.56       Driver Version: 418.56       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla P100-PCIE...  Off  | 00000000:02:00.0 Off |                    0 |
| N/A   29C    P0    32W / 250W |      0MiB / 16280MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   1  Tesla P100-PCIE...  Off  | 00000000:03:00.0 Off |                    0 |
| N/A   30C    P0    31W / 250W |      0MiB / 16280MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   2  Tesla P100-PCIE...  Off  | 00000000:81:00.0 Off |                    0 |
| N/A   33C    P0    31W / 250W |      0MiB / 16280MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
|   3  Tesla P100-PCIE...  Off  | 00000000:82:00.0 Off |                    0 |
| N/A   32C    P0    25W / 250W |      0MiB / 16280MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
```

Here is the output of `ldd $COPPELIASIM_ROOT/platforms/libqxcb.so`:
```
(carla_py37) syr@jtang02-11:/data2/wk/BatchDRL$ ldd $COPPELIASIM_ROOT/platforms/libqxcb.so
        linux-vdso.so.1 =>  (0x00007ffe42590000)
        libQt5XcbQpa.so.5 => /data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libQt5XcbQpa.so.5 (0x00007fd98f907000)
        libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fd98f6c4000)
        libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fd98f41a000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fd98f200000)
        libQt5Gui.so.5 => /data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libQt5Gui.so.5 (0x00007fd98e9b3000)
        libQt5DBus.so.5 => /data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libQt5DBus.so.5 (0x00007fd98e727000)
        libQt5Core.so.5 => /data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libQt5Core.so.5 (0x00007fd98df8e000)
        libGL.so.1 => /usr/lib/nvidia-418/libGL.so.1 (0x00007fd98dc4f000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fd98da32000)
        libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007fd98d830000)
        libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fd98d60e000)
        libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fd98d404000)
        libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fd98d1f2000)
        libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fd98ceb8000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd98cbaf000)
        libxkbcommon-x11.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 (0x00007fd98c9a7000)
        libxkbcommon.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007fd98c768000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd98c564000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd98c1e2000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd98bfcc000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd98bc02000)
        libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fd98ba00000)
        libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fd98b6ef000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fd98b4c6000)
        libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fd98b2a1000)
        libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007fd98b055000)
        libicui18n.so.56 => /data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libicui18n.so.56 (0x00007fd98abbc000)
        libicuuc.so.56 => /data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libicuuc.so.56 (0x00007fd98a804000)
        libicudata.so.56 => /data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04/libicudata.so.56 (0x00007fd988e21000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fd98feac000)
        libnvidia-tls.so.418.56 => /usr/lib/nvidia-418/libnvidia-tls.so.418.56 (0x00007fd988c1d000)
        libnvidia-glcore.so.418.56 => /usr/lib/nvidia-418/libnvidia-glcore.so.418.56 (0x00007fd986fb1000)
        libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fd986dad000)
        libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fd986ba7000)
        libxcb-xkb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007fd98698c000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fd98671c000)
        libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fd99001b000)
        libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fd9864fa000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd9862f2000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fd9860d0000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fd985def000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fd985bdb000)
```

- I am running on a headless display and here is the output of `echo $DISPLAY`:
```
(carla_py37) syr@jtang02-11:/data2/wk/BatchDRL$ echo $DISPLAY

```

- I am running under a conda environment with python 3.7.7
- I failed to launch coppeliaSim by itself. Here is the output of `cd $COPPELIASIM_ROOT ; ./coppeliaSim.sh`:
```
(carla_py37) syr@jtang02-11:/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04$ nohup sudo X &
[1] 9988
nohup: ignoring input and appending output to 'nohup.out'
(carla_py37) syr@jtang02-11:/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04$ export DISPLAY=:0.0

[1]+  Stopped                 nohup sudo X
(carla_py37) syr@jtang02-11:/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04$ ./coppeliaSim.sh 
[CoppeliaSimClient]    loading the CoppeliaSim library...
[CoppeliaSimClient]    done.
[CoppeliaSimClient:loadinfo]   launching CoppeliaSim...
[CoppeliaSim:loadinfo]   CoppeliaSim V4.2.0., (rev. 5), flavor: 1
[CoppeliaSim:loadinfo]   Legacy machine ID: 5000-B6EB-FFC4-9C4A-F7E3-D41D
[CoppeliaSim:loadinfo]   Machine ID: B83D-736A-9E95-0000-A703-0101
qt.qpa.xcb: could not connect to display :0.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

./coppeliaSim.sh: line 35:  9995 Aborted                 (core dumped) "$dirname/$appname" "${PARAMETERS[@]}"
```

I found that after I run `nohup sudo X &` , once I press enter, the process will be stopped like this `[1]+  Stopped nohup sudo X`. 
I also tried to run  `nohup sudo X &` in the current terminal and then open another one and run `export DISPLAY=:0.0; cd $COPPELIASIM_ROOT ; ./coppeliaSim.sh` but there is the same error.
Could you help me check this?


I get precisely the same outputs for all of these debugging commands

Thanks for all those details @Zed-Wu 
It seems from your nvidia-smi output shows that there are no xservers running! So any app that requires rendering would fail at this point. I.e. you are looking for something like:

![image](https://user-images.githubusercontent.com/6891386/125822200-b53adc0d-edaf-4c72-aaa2-02cc6c56da7a.png)


We need to get the command `nohup sudo X &` to succeed for this to happen. Did you reboot the headless server? This is a mandatory step to get virtualgl correctly configured after running `sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024`.

Glad you were able to run coppeliaSim, however a vnc server should not be necessary.
Please paste the output of running coppeliaSim.sh

Why is the output of that relevant if it operates and no warning were raised?
```
[CoppeliaSimClient]    loading the CoppeliaSim library...
[CoppeliaSimClient]    done.
[CoppeliaSimClient:loadinfo]   launching CoppeliaSim...
[CoppeliaSim:loadinfo]   CoppeliaSim V4.1.0., (rev. 1), flavor: 1
[CoppeliaSim:loadinfo]   Legacy machine ID: 5000-9DEB-FFC4-9CEC-F7E3-841D
[CoppeliaSim:loadinfo]   Machine ID: EE36-736C-7FB9-0000-C9CE-0101
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-ryanrudes'
[CoppeliaSim:loadinfo]   using the default Lua library.
[CoppeliaSim:loadinfo]   loaded the video compression library.
[CoppeliaSim:loadinfo]   if CoppeliaSim crashes now, try to install libgl1-mesa-dev on your system:
        >sudo apt install libgl1-mesa-dev
[CoppeliaSim:loadinfo]   OpenGL VMware, Inc., Renderer: llvmpipe (LLVM 10.0.0, 256 bits), Version: 3.1 Mesa 20.0.8
[CoppeliaSim:loadinfo]   simulator launched.
[CoppeliaSim:loadinfo]   plugin 'DynamicsBullet-2-78': loading...
[CoppeliaSim:loadinfo]   plugin 'DynamicsBullet-2-78': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'DynamicsBullet-2-83': loading...
[CoppeliaSim:loadinfo]   plugin 'DynamicsBullet-2-83': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'DynamicsNewton': loading...
[CoppeliaSim:loadinfo]   plugin 'DynamicsNewton': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'DynamicsOde': loading...
[CoppeliaSim:loadinfo]   plugin 'DynamicsOde': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'DynamicsVortex': loading...
[CoppeliaSim:loadinfo]   plugin 'DynamicsVortex': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Geometric': loading...
[CoppeliaSim:loadinfo]   plugin 'Geometric': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Assimp': loading...
[CoppeliaSim:loadinfo]   plugin 'Assimp': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'BlueZero': loading...
[CoppeliaSim:loadinfo]   plugin 'BlueZero': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'BubbleRob': loading...
[CoppeliaSim:loadinfo]   plugin 'BubbleRob': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Bwf': loading...
[CoppeliaSim:loadinfo]   plugin 'Bwf': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'CodeEditor': loading...
[simExtCodeEditor:loadinfo]   CodeEditor plugin initialized
[CoppeliaSim:loadinfo]   plugin 'CodeEditor': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Collada': loading...
[CoppeliaSim:loadinfo]   plugin 'Collada': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'ConvexDecompose': loading...
[CoppeliaSim:loadinfo]   plugin 'ConvexDecompose': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'CustomUI': loading...
[CoppeliaSim:loadinfo]   plugin 'CustomUI': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'ExternalRenderer': loading...
[CoppeliaSim:loadinfo]   plugin 'ExternalRenderer': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'GLTF': loading...
[CoppeliaSim:loadinfo]   plugin 'GLTF': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'ICP': loading...
[CoppeliaSim:loadinfo]   plugin 'ICP': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'IK': loading...
[CoppeliaSim:loadinfo]   plugin 'IK': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Image': loading...
[CoppeliaSim:loadinfo]   plugin 'Image': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'K3': loading...
[CoppeliaSim:loadinfo]   plugin 'K3': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'LuaCommander': loading...
[CoppeliaSim:loadinfo]   plugin 'LuaCommander': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'LuaRemoteApiClient': loading...
[CoppeliaSim:loadinfo]   plugin 'LuaRemoteApiClient': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Mtb': loading...
[CoppeliaSim:loadinfo]   plugin 'Mtb': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'OMPL': loading...
[CoppeliaSim:loadinfo]   plugin 'OMPL': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'OpenGL3Renderer': loading...
[CoppeliaSim:loadinfo]   plugin 'OpenGL3Renderer': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'OpenMesh': loading...
[CoppeliaSim:loadinfo]   plugin 'OpenMesh': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Qhull': loading...
[CoppeliaSim:loadinfo]   plugin 'Qhull': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'ROSInterface': loading...
[CoppeliaSim:error]   plugin 'ROSInterface': load failed (could not load). The plugin probably couldn't load dependency libraries. For additional infos, modify the script 'libLoadErrorCheck.sh', run it and inspect the output.
[CoppeliaSim:loadinfo]   plugin 'RRS1': loading...
[CoppeliaSim:loadinfo]   plugin 'RRS1': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'ReflexxesTypeII': loading...
[CoppeliaSim:loadinfo]   plugin 'ReflexxesTypeII': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'RemoteApi': loading...
[simExtRemoteApi:loadinfo]   starting a remote API server on port 19997
[CoppeliaSim:loadinfo]   plugin 'RemoteApi': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'SDF': loading...
[CoppeliaSim:loadinfo]   plugin 'SDF': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'SurfaceReconstruction': loading...
[CoppeliaSim:loadinfo]   plugin 'SurfaceReconstruction': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'URLDrop': loading...
[CoppeliaSim:loadinfo]   plugin 'URLDrop': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Urdf': loading...
[CoppeliaSim:loadinfo]   plugin 'Urdf': load succeeded.
[CoppeliaSim:loadinfo]   plugin 'Vision': loading...
[CoppeliaSim:loadinfo]   plugin 'Vision': load succeeded.
[CoppeliaSim:loadinfo]   using the 'Geometric' plugin.
[CoppeliaSim:loadinfo]   using the 'IK' plugin.
```
![](https://user-images.githubusercontent.com/18452581/125842461-eef0ce4f-b40e-43f2-aa7c-1662f35ae4d1.png)

As you can see running coppeliaSim.sh works fine when I set my display to a vncserver, but all of the example scripts from RLBench crash

I previously had similar problems, now, using vnc as well. That is user friendly, and if you're running an X server anyway, then might as well use a full desktop (especially for debugging with PyCharm). If you have a script that has an opencv-python dependency, you might try to replace it by scikit-image (due to a conflict with Qt).
I also did not find VirtualGL to work immediately. But I want to run headless anyway and didn't try hard. I think a downside of using CoppeliaSim in the first place is that it can't use MUJOCO (although that has a license). We seem to be able to run TargetReach just fine. CoppeliaSim does show a warning with TargetReach.



I'm not having this problem anymore but unfortunately have no clue what I did to fix it. It's been a few days and I decided to go back and reattempt this and this time it just worked. Not sure if I had installed it wrong initially or if something I did in the intermittent period resolved whatever the problem was earlier.

I also got a similar problem.

Though this issue was closed quite some time ago, I think it might be helpful for anyone still experiencing the issue to perform the following installation:

```
apt install libxkbcommon-x11-0
```

I'm suffering from this problem :( I'm using docker for RLBench, and I'm using X for headless display.
Inside of the docker, nvidia-smi shows nothing and the same error keep occurs. :( Do you know how to Handle it?

I'm working on Ubuntu 22.04 with Coppeliasim 4.6 Version

And I think the display works but the example codes are not working as shown error

qt.qpa.xcb: could not connect to display :0.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/data2/wk/BatchDRL/CoppeliaSim/CoppeliaSim_Edu_V4_2_0_Ubuntu16_04" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)

I also got a similar problem.