Black screen on RStudio Desktop on WSL2 via X Server

I am trying to something that is not too common, but I have Windows Subsystem for Linux 2 (WSL2) setup with Windows X Server (VcXsrv) to open RStudio Desktop (NOT RStudio Server, because WSL2 doesn't support local host port forwarding). I have Ubuntu 18.04 installed on Windows 10 Build 1954+.

All other GUI apps, like Chrome, IntelliJ etc. work properly using VcXsrv. My Ubuntu is running xcfce (installed via a sudo apt install xcfe4 and startxcfe4 command on terminal). I installed RStudio using 1.2.5033-amd64.deb from RStudio website and installed it using apt-get.

Now when I run rstudio via terminal, RStudio opens up but with black screen (I can see RStudio header only) with the following error on terminal

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-BETWEENTWOTESTS'
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
Could not link shader program:
 ""
[23529:23862:0114/151251.459445:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.480172:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.508391:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.525751:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.541635:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.554133:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.567590:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.578671:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.590344:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
[23529:23862:0114/151251.603896:ERROR:context_group.cc(274)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).

As per this SO thread with similar problem, I tried sudo rstudio. I can now see RStudio as it should look like with the following messages on terminal

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Home directory not accessible: Permission denied

This issue actually doesn't seem like RStudio-specific. It looks like it is a graphics set up issue with by WSL-GUI-foo setup.

It would be great if I can find out a way to not sudo every time, but this is an acceptable solution for me at this time (especially because WSL2 is still in beta mode). I am leaving a note here in case others try to Google with keywords WSL and X Server. It would be useful if someone can point out potential downside of me using sudo rstudio every time though. Again, not high priority.

Thanks all!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.