art-e-fact / easyturtle

Exploring how to get started with ROS TurtleSim as fast as possible using a single Docker container.
MIT License
0 stars 1 forks source link

Xauthority on Ubuntu 22 #1

Open ljburtz opened 2 years ago

ljburtz commented 2 years ago

Summary: tested that it works on Ubuntu 22.04 (with two additional commands) 5.15.0-39-generic Docker version 20.10.17, build 100c701

Details: with the README instructions I did not have any turtlesim window open inspecting the docker container and running turtlesim manually, I saw the following error message:

$ rosrun turtlesim turtlesim_node QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root' Authorization required, but no authorization protocol specified qt.qpa.screen: QXcbConnection: Could not connect to display :0 Could not connect to any X display.

commands that fixed it on the host:

xhost +local:docker
docker run --rm --interactive --tty --env DISPLAY=$DISPLAY --env XAUTHORITY=/tmp/.docker.xauth --net host --name easyturtle easyturtle

note the additional XAUTHORITY. I think it shouldn't hurt even on the environments where it was working without

@ic i can update the README.md if you wish

ic commented 2 years ago

Thank you for the test and solution!

Would you have any chance to try with the changes in #2 ? I unfortunately have no Ubuntu 22 machine around.

In the PR, the change basically ensures Docker gets XAUTHORITY set to the value you found. I updated the README as you suggested, but without adding the variable (automatic). However I did not mention the xhost change, as wondering whether it is really necessary (tests should easily confirm).

Tested it still works on MacOS. Wondering whether a CI solution exists to try on a grid of settings.

ljburtz commented 2 years ago

test ok on Ubuntu22 (details in #2 ) looks good to me good question for a CI solution on several OSs. for testing x11 apps on headless systems i've heard about XVFB (used it for gazebo previously) quick pointer: https://www.scivision.dev/xvfb-ci-fake-x11-display/