0
$\begingroup$

Description:

I have tried to execute ros in a docker container on vscode. I have followed the tutorial at this page . I have a problem in visualizing rviz2.

Environment:

  • ROS Distro: Humble
  • OS Version: Ubuntu 22.04
  • DISPLAY SERVER : x11

Step followed:

Tutorial using humble as ROS_DISTRO. I have changed the variable DISPLAY in containerEnv to unix:1. I have also tried to execute the command xhost local:root before starting the container as suggested here

Expected behaviour

Open rviz2 through vscode

Actual behaviour

Error: `qt.qpa.xcb: could not connect to display :1 qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" 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`

My files

devcontainer.json Docker file: Screenshot from 2024-04-30 12-35-48

Thank you in advance!

$\endgroup$
1
  • $\begingroup$ Please paste any code or console output as code formatted text and not as a screenshot. Screenshots are not text searchable, amongst other things... $\endgroup$ Commented Apr 30 at 16:22

1 Answer 1

0
$\begingroup$

I had almost this exact error using jazzy and the Jazzy Docker Tutorial

The error I was receiving was:

dave@DROIDBASE1:/home/ws$ rviz2
Authorization required, but no authorization protocol specified

qt.qpa.xcb: could not connect to display unix:0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" 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, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

I was able to resolve this by executing the xhost local:root command on my local Ubuntu machine before creating the docker container. The response to that command should be something along the lines of: non-network local connections being added to access control list

Apparently by default, the X server only allows connections from the same user and sometimes from the same machine.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.