ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

ROS Rviz Error: “Could not connect to any X display”

asked 2019-10-21 02:48:48 -0500

xman236 gravatar image

updated 2022-04-17 11:02:16 -0500

lucasw gravatar image

I am struggling since days to install ROS & Rviz on my Windows 10 Pc. I first installed Ubuntu melodic using windows app store and followed the tutorial from ROS Wiki (http://wiki.ros.org/ROS/Tutorials/Ins...). So, I tried to start rviz using:

roscore &
rosrun rviz rviz

Then it says: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user' qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display.

Using

sudo visudo

I added these 2 lines to sudoers.tmp

Defaults env_keep+="DISPLAY XAUTHORITY"
Defaults env_keep+="XDG_RUNTIME_DIR"

However the same error occurs. What else could I try?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-10-21 03:00:42 -0500

gvdhoorn gravatar image

updated 2019-10-21 03:04:31 -0500

I am struggling since days to install ROS & Rviz on my Windows 10 Pc. I first installed Ubuntu melodic using windows app store

This implies that you're using WSL to run an Ubuntu user land and have installed ROS into that.

Windows 10 nor WSL come with an X Server, which is the part that renders the graphical windows required to use the UI part of ROS (ie: RViz, Gazebo, etc). You don't appear to have an X Server running (and probably neither have one installed), but still try to run rviz, you receive the error message ("Could not connect to any X display").

You'll have to install a suitable X Server on the Windows 10 side (so not inside WSL). See this AskUbuntu Q&A for some more info. In the past people have used VcXsrv and Xming. Whether those still work I couldn't say.

And finally: you may already be aware, but although WSL (and WSL 2) are very nice and convenient from a technological perspective, there are still certain things that don't work correctly with it. At least with WSL 1 (ie: the original one) networking has always been a weak point, and seeing as ROS is extensively networked, certain aspects of ROS were not as robust running under WSL as they could be. See #q238646 for an earlier question.

This situation could have improved and WSL 2 uses a rather different approach to how WSL is implemented and run, but I wanted to let you know as you may run into problems that could, potentially, be caused by WSL and not ROS or its configuration.

edit flag offensive delete link more

Comments

Previous Q&As about this: #q326692, #q278427, #q315056,

gvdhoorn gravatar image gvdhoorn  ( 2019-10-21 03:03:39 -0500 )edit

Question Tools

Stats

Asked: 2019-10-21 02:48:48 -0500

Seen: 8,038 times

Last updated: Oct 21 '19