Skip to content

ROS Gazebo black screen #3368

Closed
Closed

Description

@IceSentry

Following this tutorial I managed to run ros on wsl with ubuntu 16.04 and Microsoft Windows [Version 10.0.17134.112]. However when launching gazebo with VcXsrv it gives a black screen where you should see the 3d model of the robot, but the rest of the UI is there and there is no error in the console.

I know WSL is supposed to be for command line tools, but there have been a few issues related to using gui apps through x server that have been resolved here.

I created this issue after reading #1450 where it was suggested to create a new issue for this.

Activity

  1. therealkenc commented on Jul 9, 2018

    @therealkenc

    where it was suggested to create a new issue for this.

    Hmmm, Sunil did say that, didn't he. "This tutorial" is a pretty big ask, given that it demonstrably does work out of the box and this isn't a WSL bug or even feature request. You are probably way better off asking your question wherever it is that ROS Gazebo people hang out.

    As a first step before I bite, see if you able to run glxgears or do you just get blackness there too:

    $ sudo apt install mesa-utils
    $ export DISPLAY=localhost:0
    $ glxgears
    

    In VcXsrv choose multi-window and "Native opengl" unchecked (sic). If glxgears is okay and gazebo still doesn't light up I'll try to take a closer look if/when I get a moment.

  2. MVoz commented on Jul 9, 2018

    @MVoz

    IceSentry (@IceSentry)
    vcxsrv.exe :0 -ac -terminate -lesspointer -multiwindow -clipboard ...

    windows\ vcxsrv.exe :0 <<-->> display :0 \linux

  3. IceSentry commented on Jul 9, 2018

    @IceSentry
    Author

    therealkenc it was asked on gazebo answer http://answers.gazebosim.org/question/16888/gazebo-on-wsl-bash-for-windows/ which is actually how I came to the original issue on github.

    I did manage to see some gears with glxgears, unfortunately gazebo still shows a black screen. Although on my version of vcxsrv I don't see a native opengl checkbox. I use vcxsrv 1.20.0.0 from sourceforge

    voskrese I have no idea what you want me to do

  4. shoffmeister commented on Jul 9, 2018

    @shoffmeister

    glxgears gives me about 650 fps on vcxsrv 1.20 in native OpenGL mode on a comparatively slow Intel HD 4000 laptop GPU, about 1500 fps on an Intel HD 620 (two slow generations later)

    You can enable OpenGL mode on the vcxsrv side by running XLaunch; this will take you through a wizard which on its last page refers to the LIBGL_ALWAYS_INDIRECT environment variable (export LIBGL_ALWAYS_INDIRECT=1)

    Generally speaking, it would be nice to understand whether ROS gazebo actually does run with a native Linux and vcxsrv as the remote X server.

  5. IceSentry commented on Jul 9, 2018

    @IceSentry
    Author

    With export LIBGL_ALWAYS_INDIRECT=1 gazebo simply doesn't launch.

    Also I made a mistake in my other comment, I was using an old version of xming. I tried it again with vcxsrv with native opengl and I had the same result.

  6. MVoz commented on Jul 9, 2018

    @MVoz

    IceSentry (@IceSentry) You wrote that you see a black screen, instead of anything, I assumed that you installed Xming\vcxsrv, just do not set it on the desired display, by default -1, and you need 0, if of course you passed the same settings in UNIX environment

    In general, you will get your own \Google translation ))

  7. therealkenc commented on Jul 9, 2018

    @therealkenc

    this will take you through a wizard which on its last page refers to the LIBGL_ALWAYS_INDIRECT environment variable (export LIBGL_ALWAYS_INDIRECT=1)

    Do not do that.

    Generally speaking, it would be nice to understand whether ROS gazebo actually does run with a native Linux and vcxsrv as the remote X server.

    This is generally the prerequisite for posting here. Even then, monsters like ROS make for terrible use-cases for tracking down WSL bugs or feature gaps; since those bugs won't have to do with drawing pixels. An exception is being made since it was suggested to open an issue.

    Although on my version of vcxsrv I don't see a native opengl checkbox. I use vcxsrv 1.20.0.0 from sourceforge

    Start VcXsrv with XLaunch. You will see the checkbox on the third page of the wizard.

    In any case, against my better judgement I installed ROS (a short part of my life I'll never get back). Worked here out of the box with Ubuntu 16.04 and VcXsrv 1.20. Which is pretty much what I feared.

    n.b. I don't want to imply unchecking native gl is your magic bullet. I only know it lit up without incident for me. I am not sure the thing is actually usable, mind. I suspect Gazebo falls much into the same category as Blender on that front.

    image

  8. therealkenc commented on Jul 9, 2018

    @therealkenc

    I only just clicked though the gazebosim forum question. It is useful as an illustration (and future link target):

    it was asked on gazebo answer http://answers.gazebosim.org/question/16888/gazebo-on-wsl-bash-for-windows/

    "It" was the wrong question, and went sideways in the first sentence. Like shoffmeister suggests, the procedure would be to run Gazebo in a Real Linux VM talking to a "remote" VcXsrv first, and if it doesn't work, that is the question you'd be asking on the Gazebo list (or any other list).

    "I'm running Gazebo in the cloud using VcXsrv as my remote X Server, and I get a black screen. Please help."

    Instead what the poster said was "I am surprised to how RPi is able render the visualization window, whereas WSL is unable to!" Which is going to get basically zero help from anyone unless you are lucky enough to find someone exceedingly patient. Because WSL, just like any headless box, doesn't render anything.

  9. IceSentry commented on Jul 10, 2018

    @IceSentry
    Author

    I'm sorry if I wasted your time, I'm very new to all of this and since it was suggested in the other thread and I had a similar issue I made this thread.

    I know WSL isn't supposed to be used for GUI apps, but I've seen a few issues here talking about running gui apps through an xserver so I assumed it was in a kind of grey area.

    I will try to do a fresh wsl and gazebo install and see if it works. I'll also look into running gazebo on a
    a linux vm with an X server. To be clear I did find the native opengl option and I disabled it as suggested and it still didn't work for me.

    But if I understand correctly you don't believe this is an issue with WSL and it is most likely with gazebo and/or the x server?

  10. therealkenc commented on Jul 10, 2018

    @therealkenc

    I'm sorry if I wasted your time

    Don't be. This isn't on you. It wasn't a waste. Yes it's a grey area.

    But if I understand correctly you don't believe this is an issue with WSL and it is most likely with gazebo and/or the x server?

    Dunno, precisely, or I'd tell ya. I was kind of hoping glxgears wouldn't work for you, in which case we could attack that head on. Or, that gazebo wouldn't work for me, in which case I could deep dive for the curiosity value. We've got neither of those situations, unfortunately.

    We do know "WSL" (namely the kernel emulation layer that makes this whole thing go) is fine. Because it works, demonstrably. WSL doesn't even know you are talking to VcXsrv. All WSL knows is you are writing some bytes down a socket on localhost port 6000.

    It might be firewall related. I got quite a few popups to open ports. Try disabling your Windows firewall entirely and see if that helps. But we're grasping here.

    You might try XMing just to switch things up. That at least purturbs a variable (the X Server).

    You can also try running it remotely from inside a VM as an experiment, if you are feeling motivated or are looking for a time sink. But trying a given scenario (like Gazebo) in a VM is more valuable in the case where you know it doesn't work in WSL, and thus can start tracking down a diverge from the Real Thing. Here we know it does, so there is no diverge to discover. The possible outcomes of the experiment for you aren't pretty. Either it doesn't work in the VM, which leaves you exactly where you are right now (wondering why). Or it does work, which puts you in the unenviable position of trying to find out precisely what bits of your Real Linux userspace (Ubuntu + everything) differ from your WSL userspace (Ubuntu + everything). Which is "not easy", to put it mildly.

    One "last" shot: what does glxinfo | grep OpenGL return for you. Should look like:

    ken@DESKTOP-4UTIQSF:~/Devel/ros$ glxinfo | grep OpenGL
    OpenGL vendor string: VMware, Inc.
    OpenGL renderer string: llvmpipe (LLVM 6.0, 256 bits)
    OpenGL core profile version string: 3.3 (Core Profile) Mesa 18.0.5
    OpenGL core profile shading language version string: 3.30
    OpenGL core profile context flags: (none)
    OpenGL core profile profile mask: core profile
    OpenGL core profile extensions:
    OpenGL version string: 3.0 Mesa 18.0.5
    OpenGL shading language version string: 1.30
    OpenGL context flags: (none)
    OpenGL extensions:
    OpenGL ES profile version string: OpenGL ES 3.0 Mesa 18.0.5
    OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
    OpenGL ES profile extensions:
    

    If it's the same just say 'same' no need to paste the output. I'm just trying to guess variables.

  11. shoffmeister commented on Jul 10, 2018

    @shoffmeister

    On the subject of using export LIBGL_ALWAYS_INDIRECT=1, and also regarding "native windows opengl" in vcxsrv, I finally understand some of the implications there.

    Fundamentally, using native OpenGL forces all OpenGL commands to be rendered on the remote server (i.e. the "box" which eventually shows the bits and bytes). One of the side-effects of that is that the OpenGL command stream forces use of the GLX protocol - and that only supports OpenGL 1.4 (see http://x.cygwin.com/docs/ug/using-glx.html)

    So, some experiments after sudo apt install gazebo9:

    • launch vcxsrv with "Native opengl" checked
      -- export LIBGL_ALWAYS_INDIRECT=1 && gazebo -> exactly nothing happens, silent crash (gazebo diagnostics probably broken)
      -- export LIBGL_ALWAYS_INDIRECT=0 && gazebo ->
    libGL error: No matching fbConfigs or visuals found
    libGL error: failed to load driver: swrast
    libGL error: No matching fbConfigs or visuals found
    libGL error: failed to load driver: swrast
    
    • launch vcxsrv without "Native opengl" checked
      -- export LIBGL_ALWAYS_INDIRECT=1 && gazebo -> exactly nothing happens, silent crash (gazebo diagnostics probably broken)
      -- export LIBGL_ALWAYS_INDIRECT=0 && gazebo -> life is good

    At no time am I able to see a black screen; something must be seriously broken elsewhere for that to happen (in case "black screen" is exactly what is visible)

  12. shoffmeister commented on Jul 10, 2018

    @shoffmeister

    But if I understand correctly you don't believe this is an issue with WSL and it is most likely with gazebo and/or the x server?

    The probability of this being a WSL problem is very, very low, given the above.

  13. IceSentry commented on Jul 10, 2018

    @IceSentry
    Author

    image

    This is what I mean by black screen I should have made this at the beginning. The issue is that the 3d viewer is black not the entire window.

    I'll do a clean install of wsl, gazebo and vcxsrv tomorrow and try to investigate more.

  14. yxy1996 commented on Jul 25, 2018

    @yxy1996

    I have the same black screen problem, with a "preparing world" window on the front. I run it in xfce4. And the origin ubuntu commander output like this:

    (xfwm4:6656): xfwm4-WARNING **: Unmanaged net_wm_state (window 0xd00004, atom "_NET_WM_STATE_STAYS_ON_TOP")

    I also try the last shot glxinfo | grep OpenGL, and it returns the same.

  15. 11 remaining items

  16. jbohren-hbr commented on Aug 23, 2018

    @jbohren-hbr
  17. therealkenc commented on Aug 23, 2018

    @therealkenc

    🌟

  18. maxymczech commented on Aug 28, 2018

    @maxymczech

    I have encountered same issue on Ubuntu Bionic, ROS Melodic and Gazebo 9 (running on virtual machine). I have 'solved' it by killing previously previously launched instance of gzserver.

  19. karray commented on Nov 20, 2018

    @karray

    I still see a lot of message errors, but this is unlikely a WSL-specific issue beyond networking config:

    Exception sending a message
    ...
    

    The same here. I've installed ROS-Melodic (full desktop) with Gazebo 9 on 3 different machines: 2 of them are with Ubuntu 18.04 and third one with WSL Ubuntu 18.04 (Windows 10). After a fresh install I get Exception sending a message, which is being printed infinitely after starting gazebo (gzserver, roslaunch). But it seems that everything.

    I've also noticed that it happens only when I open VPN connection

  20. traversaro commented on Dec 31, 2018

    @traversaro

    It seems that a similar issue related to 169.245.*.* "phantoom" network interfaces is affecting also the Windows build of Gazebo, see ms-iot/ROSOnWindows#47 (comment) . This may indicate that the problem/feature of phantom interfaces may not be related to WSL at all, but it could be related just to the Windows network stack.

  21. traversaro commented on Dec 31, 2018

    @traversaro

    If I understand correctly (see ms-iot/ROSOnWindows#47 (comment)) the 169.245.*.* interfaces are related to ädapter that are disconnected, and so the issues is in Gazebo that should ignore them.

  22. therealkenc commented on Dec 31, 2018

    @therealkenc

    so the issues is in Gazebo

    You are now caught up to above.

  23. traversaro commented on Dec 31, 2018

    @traversaro

    You are now caught up to above.

    Thanks! Sorry for noise due to skipping over the last comments.

  24. achimismaili commented on Dec 8, 2020

    @achimismaili

    For me, setting DISPLAY to 0, 0.0, localhost:0 or 127.0.0.1 on a ubuntu windows linux sub system (WLS2) did all not work, I had to use the public IP and the following command helped me:

    export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0

  25. luyor commented on Feb 17, 2021

    @luyor

    I use ROS Gazebo in WSL docker. For me, the network settings are correct, but I still see the blank screen. The reason is, Gazebo is downloading data silently in background, and I just need to wait for it to finish.

    I use this tutorial to setup ROS Gazebo in WSL docker.
    I run roscore in terminal. Then run rosrun gazebo_ros gazebo in second terminal. I have a blank screen as IceSentry (@IceSentry), and a log in terminal: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...

    Gazebo is downloading data silently in background, see discussion in the forum.
    Close the window, and wait for the log to print in terminal:

    [ INFO] [1613558941.011174200]: waitForService: Service [/gazebo/set_physics_properties] is now available.
    [ INFO] [1613558941.208707300]: Physics dynamic reconfigure ready.
    

    Rerun rosrun gazebo_ros gazebo, then it works.

  26. besch commented on Jun 29, 2022

    @besch

    For me the 'black screen in gazebo' fix was to install latest Intel driver
    Although one issue left to solve is, after Windows restart gazebo scene resets to black screen

  27. TrinhNC commented on Oct 18, 2022

    @TrinhNC

    For me follow the solution of Jonathan Bohren (@jbohren-hbr) works only when I uninstall Xming and install vcxrv.

  28. lidianzhong commented on Jul 2, 2024

    @lidianzhong

    I finally solve the problem by deleting the .wslconfig content. For me, the problem should be related to the ip network problem.
    image

  29. TomE8 commented on May 17, 2025

    @TomE8

    I had the same problem:

    Image

    The solution for me was to use ogre engine:
    gz sim --render-engine ogre

    For the record, I run Gazebo on docker inside a virtual box.

  30. chidalu-z17 commented on Aug 16, 2025

    @chidalu-z17

    I had the same problem but mine was a bit weird as I had gazebo installed in a docker where my ros2-humble was installed, and that docker was installed on my oracle vm virtual box which was installed on my windows 11 PC.
    Essentially Gazebo -> ROS2-Humble Container (Docker based on Ubuntu 22.04) -> Ubuntu 24.04 -> Oracle VM VirtualBox -> Windows 11 PC.

    I think what worked for me was to:
    run: xhost +local:root or alternativelty run: xhost +local:docker (would work too and its generally safer than using root) on my ubuntu 24.04 terminal (host) and I increased the number of CPU allocated to the Ubuntu 24.04 VM to 3, instead of the default 2, as Gazebo requires enough recourses to render in 3D.

    It could also had been that Gazebo was "loading" and increasing the number of CPU's essentially made it load faster. I haven't confirmed this. You could try waiting on the blank screen to go away too. If not, then just try what I described above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions