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

Gazebo not working in ros kinetic singularity image

asked 2019-04-10 03:49:38 -0500

rickstaa gravatar image

updated 2020-01-30 15:16:00 -0500

I am trying to create an emika_franka_panda robot simulator using the osrf/ros:kinetic-desktop-full docker image as explained in this topic. To do this i created the following definition file:

Bootstrap: docker
From: osrf/ros:kinetic-desktop-full

%post  
    # Initiation commands
    apt-get update

    # Setup ros dependency tool
    rosdep update

I then tried to create the image by using the following command:

sudo singularity build --sandbox ros_kinetic_panda ros_kinetic_panda.def

Following when running the container using:

sudo singularity shell --nv --writable ros_kinetic_panda

and trying to launch gazebo using:

gazebo

I run into troubles. The gazebo interface tries to launch but crashes with the following errors after 1 second.

Singularity panda_kinetic:~/singularity/containers> gazebo
libGL error: libGL error: No matching fbConfigs or visuals found
No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
libGL error: failed to load driver: swrast
Gtk-Message: Failed to load module "appmenu-gtk-module"
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "canberra-gtk-module"

What I already tried to fix this issue

Use the melodic docker image

Bootstrap: docker
From: osrf/ros:melodic-desktop-full

%post
    echo "Setting up ros melodic emika franka container."

    # Initiation commands
    apt-get update

    # Setup ros dependency tool
    rosdep update

Now the gazebo simulator launches without any problems.

Trying to build from the apt-get repository

In this case I tried to first bootstrap from the ubuntu 16.04 repository and following trying to install ros kinetic by using the installation guide. This gave me the following errors when trying to run the gazebo simulator.

libGL error: No matching fbConfigs or visuals found
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
libGL error: failed to load driver: swrast
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid
Singularity ros_test:~> 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
terminate called after throwing an instance of 'std::runtime_error'
  what():  locale::facet::_S_create_c_locale name not valid

System information

  • PC: Hp Zbook G3
  • Root linux system: Ubuntu 18.04
  • Graphics driver: Quadro M1000M
  • Cuda versions: 10.0 (cudnn 7.4.2) and 9.0 (cudnn 7.5.0)
  • Singularity version 3.0.3

nvidia-smi output nvidia_output

Shell output log

VERBOSE: Set messagelevel to: 4
VERBOSE: Container runtime
VERBOSE: Check if we are running as setuid
VERBOSE: Spawn scontainer stage 1
VERBOSE: Get root privileges
VERBOSE: Execute scontainer stage 1
VERBOSE: Get root privileges
VERBOSE: Create mount namespace
VERBOSE: Spawn smaster process
VERBOSE: Spawn scontainer stage 2
VERBOSE: Create mount namespace
VERBOSE: Spawn RPC server
VERBOSE: Execute smaster process
VERBOSE: Serve RPC requests
VERBOSE: Found 'bind path' = /etc/localtime, /etc/localtime
VERBOSE: Found 'bind path' = /etc/hosts, /etc/hosts
VERBOSE: Checking for template passwd file: /usr/local/var/singularity/mnt/session/rootfs/etc/passwd
VERBOSE: Creating passwd content
VERBOSE: Creating template passwd file and appending user data: /usr ...
(more)
edit retag flag offensive close merge delete

Comments

1

Your image doesn't contain any graphics drivers (or at least: not the level of 3D support that Gazebo requires).

--nv is the right approach, but with versions of Singularity newer than 2.5.x/2.6 you'll need to take additional steps, as not all required files (notably: OpenGL related) are injected into your container.

It's not trivial, but I believe the Singularity user documentation should document this.

gvdhoorn gravatar image gvdhoorn  ( 2019-04-10 04:15:19 -0500 )edit
1

Also:

sudo singularity build --sandbox ros_kinetic_panda ros_kinetic_panda.def

If you're using --sandbox here (and --writable with shell) because you have included your workspace in your image, then don't. Build your image to include the necessary dependencies, but keep your workspace out of the image. You can use rosdep to install all required dependencies (after having copied the workspace temporarily into your image build dir, then remove after rosdep has finished).

gvdhoorn gravatar image gvdhoorn  ( 2019-04-10 04:17:31 -0500 )edit

Thanks a lot for your answer @gvdhoorn! And the tip about the --sandbox and --writable options. I review the documentation again and I now better understand their usage. Based on the documentation I indeed thought the --nv option solved the driver problems I encountered previously. After your suggestion, I tried to install 2 OpenGL packages that were missing to my images but this did unfortunately not work either.

Do you maybe know what the best way is to solve this problem? I have a hard time finding a good guide on how to do this. Do I need to use the old nvida-HPC-docker solution, use the nvidia-GPU-docker image instead of the ros-kinetic-image, use the gpu4singularity package or copy the needed nvidia .run files from my host system to my image container.

Thanks a lot in advance

rickstaa gravatar image rickstaa  ( 2019-04-10 05:10:46 -0500 )edit
1

Question: do you actually have NVIDIA hardware in your system?

If so: can you show the output of singularity -v shell --nv /path/to/your/image?

gvdhoorn gravatar image gvdhoorn  ( 2019-04-10 08:17:46 -0500 )edit

Thanks a lot for looking into it my problem. For clarity, I added my system specifications and the singularity shell output to the question above.

rickstaa gravatar image rickstaa  ( 2019-04-10 08:54:51 -0500 )edit
1

Which version of Singularity is that? And can you show the command line you used to start it (unless it was exactly the command I suggested)?

I would've at least expected to see some Found NV library: .. lines in there.

gvdhoorn gravatar image gvdhoorn  ( 2019-04-10 09:07:04 -0500 )edit

Yea that is strange it is singularity 3.0.3 with the singularity -v shell --nv ros_kinetic_panda command in the /bin/bash/ command line.

rickstaa gravatar image rickstaa  ( 2019-04-10 09:13:52 -0500 )edit

I solved my issue with the tips of @gvdhoorn. The problem was caused by my Nvidia-driver after having purged the driver according to this guide link text and reinstalling a newer driver my issue disappeared.

rickstaa gravatar image rickstaa  ( 2019-04-10 15:41:34 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-04-11 12:39:35 -0500

rickstaa gravatar image

updated 2019-04-11 15:40:27 -0500

gvdhoorn gravatar image

With the comments made by @gvdhoorn I managed to solve the issue by reinstalling my driver. In my case I needed the NVIDIA driver metapackage from nvidia-driver-418 (opensource) driver instead of the NVIDIA driver metapackage from nvidia-driver-415 (opensource).

Although I'm not totally sure what the exact issue was this might solve the issue for other people as well. To find the right driver for your video card run the nvdia-smi command to get the name of your video card. Following you can find which driver you need on the nvidia driver site. The new driver can then be installed according to this guide.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-04-10 03:48:28 -0500

Seen: 2,271 times

Last updated: Jan 30 '20