CLover32
CLover32

Reputation: 33

gazebo and rviz in docker stopped working after installing nvidia

So long story short: I had a working docker image where i could show graphical things through the Xserver. I tested it multiple times and everything seemed to work flawlessly. However after installing Nvidia and CUDA i started getting this error:

Error setting socket option (IP_ADD_MEMBERSHIP).
Error setting socket option (IP_ADD_MEMBERSHIP).
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  38
  Current serial number in output stream:  37
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  151 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  38
  Current serial number in output stream:  37

Since i need CUDA for another project i can't just uninstall it. Currently i'm running these commands:

docker build -t $container_name $repo_DIR/.
docker run -it -d --net=host --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --name=$container_name -v $HOME/repos/$container_name/src/:"/home/docker/catkin_ws/src_extern/" --gpus all $container_name bash
xhost +local:"docker inspect --format='{{ .Config.Hostname }}' $container_name" 
docker start $container_name 
docker exec --user docker -it $container_name bash

I've tried different approaches from forums, but i couldn't find anything that worked or any post with my exact problem. Any suggestions? If possible it should also be able to run without cuda/nvidia since i need the image for my laptop too. Also it would be fine if it worked around cuda/nvidia since i don't need it for the docker image anyways.

Some other information I'm Using Arch and CUDA-10.2 with nvidia-460 driver. The docker image runs on ubuntu:bionic and these are all the files including libGL:

/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1
/usr/lib/x86_64-linux-gnu/libGLESv2.so
/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0
/usr/lib/x86_64-linux-gnu/libGLU.so.1.3.1
/usr/lib/x86_64-linux-gnu/libGLESv2.so.2
/usr/lib/x86_64-linux-gnu/libGLU.so.1
/usr/lib/x86_64-linux-gnu/libGLU.so
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/x86_64-linux-gnu/libGLU.a
/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0
/usr/lib/x86_64-linux-gnu/libGLX.so
/usr/lib/x86_64-linux-gnu/libGL.so.1
/usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
/usr/lib/x86_64-linux-gnu/libGLdispatch.so
/usr/lib/x86_64-linux-gnu/libGLX.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLX.so.0
/usr/lib/x86_64-linux-gnu/libGLdispatch.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0.0.0
/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so.1.0.0
/usr/lib/x86_64-linux-gnu/libGLESv1_CM.so
/usr/lib/x86_64-linux-gnu/libGLdispatch.so.0
/usr/lib/x86_64-linux-gnu/libGLESv2.so.2.0.0

EDIT 1: Solution, apparently it was only rviz and gazebo that was broken, and it was fixed by following this

Edit 2: Changed to more relevant title.

Upvotes: 1

Views: 2738

Answers (1)

CLover32
CLover32

Reputation: 33

It is only gazebo and rviz that was broken after installing nvidia. I fiexed it by following this. The part i missed in my dockerfile was:

# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
    ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
    ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics

Upvotes: 1

Related Questions