Gazebo | Ignition | Community
Ask Your Question
0

Ignition Fortress shows a black screen where the scene should be with OpenGL 4.5 on Docker on AWS

asked 2022-05-20 16:48:08 -0500

Ruben gravatar image

updated 2022-05-31 12:23:30 -0500

Hi all,

I've been trying to make Ignition Fortress work on Docker, but I am having some errors.

I initially installed it using apt-get on a Ubuntu 20.04, but when running ign gazebo shapes.sdf -v4, it says

OpenGL 3.3 is not supported. Please update your graphics card drivers

I then upgraded OpenGL to 4.5, but there is always a black screen in the place where the scene should be.

I then installed with apt-get on Ubuntu 22.04 but I still have the same black screen, although I do not have the OpenGL error because OpenGL is already OpenGL version string: 4.5 (Compatibility Profile) Mesa 22.0.1

I then installed Ignition Fortress from source, but I still have the black screen.

I've been checking the logs but the only warns I find are like the ones below:

[Dbg] [ServerConfig.cc:973] Loaded (3) plugins from file [/home/user/.ignition/gazebo/6/server.config]
[GUI] [Wrn] [Application.cc:763] [QT] qrc:/qml/StyleDialog.qml:112:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }
[GUI] [Wrn] [Application.cc:763] [QT] qrc:/qml/StyleDialog.qml:105:3: QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }

and

[GUI] [Wrn] [Component.hh:189] Trying to deserialize component with data type [N3sdf3v125WorldE], which doesn't have `operator>>`. Component will not be deserialized.
[GUI] [Wrn] [Ogre2RenderTarget.cc:575] Anti-aliasing level of '8' is not supported; valid FSAA levels are: [ 0 4 ]. Setting to 0

If I run Gazebo Classic, I have no black screens, but it always happens with Ignition Fortress, be it installed with apt-get or from source.

Does anybody have any ideas why this could be happening and how to solve it?

If I install Ignition Fortress on my local PC (rather than in a Docker container), it works, butt on Docker it always fails.

Below we have a gif of the error:

image description

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-05-23 12:12:57 -0500

Ruben gravatar image

updated 2022-05-31 12:05:36 -0500

Led by a similar issue, I mounted the /dev folder of the Docker host inside the container and, as if by miracle, Ignition Fortress loaded with no black screen.

I then compared the logs of when it worked and when it didn't, and I found the following error message when it does not work:

MESA: error: Failed to query drm device.
libGL error: glx: failed to create dri3 screen
libGL error: failed to load driver: crocus
libGL error: failed to open /dev/dri/card0: No such file or directory
libGL error: failed to load driver: i965

Then, instead of mounting the whole /dev inside the container, I mounted only the /dev/dri folder and everything worked just nice.

Awesome!!!

Below is the docker-compose.yaml file used for testing:

version: '3'

services:
  fortress:
    image: my-docker-image/with-ignition:fortress  # Put your image name here
    container_name: fortress
    network_mode: host
    environment:
      - DISPLAY=:0
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
      - /dev/dri:/dev/dri
    entrypoint: [ "/bin/bash", "-c" ]
    command:
      - ign gazebo shapes.sdf -v4

Of course, before running docker-compose up, I had to run xhost +local:root to make the Graphical apps from the docker container appear on my desktop.

It is worth mentioning that sharing /dev/dri worked on my local computer. When trying the same on AWS, the black screen was still there.

On AWS with OpenGL 3.3 and Ogre1

In order to make it work on AWS, I had to:

  • Keep OpenGL 3.3
  • Use the --render-engine ogre param to force Ignition to use Ogre 1, following instructions on ignition troubleshooting

On AWS with Ogre2 and OpenGL 4.5

To make it work with Ogre2 --render-engine ogre2, I had to compile it from the source after disabling Anti-Aliasing.

The steps were detailed on this issue

I first upgraded OpenGL using these instructions:

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt -y full-upgrade

Then

  • I followed the instructions on how to build from source (https://gazebosim.org/docs/fortress/i...)
  • BUT, instead of using the collection-fortress.yaml of the tutorial, I used a custom one, shown in the issue. I did not paste the custom YAML file here because I could not format it properly.

Then the Black Screen went away for me.


My people are destroyed from lack of knowledge.

Hosea 4:6 (part a)

edit flag offensive delete link more

Comments

Did you ever figure out the root cause of this? I've just encountered a similar issue using rviz2 on ROS Rolling with Ubuntu Jammy. Your use -v - /dev/dri:/dev/dri also resolved my issue with libGL error: glx: failed to create dri3 screen.

ruffsl gravatar imageruffsl ( 2023-04-04 15:56:27 -0500 )edit

Hi @ruffsl, only today I saw your comment.

I couldn't find the root cause back then, but today I had the same problem when upgrading Humble. I solved upgrading Mesa, as explained on https://github.com/ros2/rviz/issues/9...:

add-apt-repository ppa:kisak/kisak-mesa
apt update
apt upgrade

Today my problem was with both rviz2 and gazebo

Ruben gravatar imageRuben ( 2023-06-09 08:09:14 -0500 )edit
1

answered 2022-05-25 04:34:11 -0500

rubar gravatar image

updated 2022-05-26 01:15:00 -0500

Look this, well no need to upgrade mesa to 22 from other repos, just mention
-e NVIDIA_DRIVER_CAPABILITIES=all in your docker command, (it allows docker container to use OpenGL) after that you can use ogre2 with hardware rendering, no black screen, no other Environment exports !
ofcurse you should be able to use gpu in docker which itself needs (Nvidia-container-toolkit / Nvidia-container-runtime2 / Nvidia-container-runtime), Nvidia-container-toolkit is preferred, here is the command I use to run the docker image:

docker run --gpus all --ipc host --ulimit memlock=-1 --ulimit stack=6718864 \
-e NVIDIA_DRIVER_CAPABILITIES=all \
-it --net=host \
-v "$HOME/container_test/":/workspace -w /workspace \
-v /dev:/dev --privileged \
-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=${DISPLAY} \
--name ignition_fortress \
IMAGE

edit flag offensive delete link more

Comments

I tried exporting this NVIDIA_DRIVER_CAPABILITIES=all variable, but it was not able to completely solve the problem. I updated my answer. After disabling Anti-Aliasing and compiling Ignition Fortress from source, it worked.

Ruben gravatar imageRuben ( 2022-05-31 12:23:01 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-05-20 16:48:08 -0500

Seen: 5,885 times

Last updated: May 31 '22