Robotics StackExchange | Archived questions

Segmentation fault when running rviz on docker

Hello,

I am trying to run rviz on docker for ros-kinetic but as soon as it connects to ros master (i.e. after running roscore), the window shuts down and gives segmentation fault

Precisely this error:

rviz
[ INFO] [1642852163.241325570]: rviz version 1.12.17
[ INFO] [1642852163.241360320]: compiled against Qt version 5.5.1
[ INFO] [1642852163.241370195]: compiled against OGRE version 1.9.0 (Ghadamon)
Could not initialize OpenGL for RasterGLSurface, reverting to RasterSurface.
Segmentation fault (core dumped)

I tried various solutions but could not get it working ( particularly from here http://wiki.ros.org/docker/Tutorials/GUI )

My docker file is here: https://github.com/pankhurivanjani/ros-dockerfiles-personal-use/blob/main/nvidia-ros-kinetic-cuda/Dockerfile

and I use this script to run it : https://github.com/pankhurivanjani/ros-dockerfiles-personal-use/blob/main/nvidia-ros-kinetic-cuda/run.sh

Update 1: Even though my docker image is cuda based when I run nvidia-smi it gives

bash: nvidia-smi: command not found

If I put --gpus all in docker run command I get the error

docker: Error response from daemon: could not select device driver "" with capabilities: [[gpu]].

P.S. In case it is relevant earlier I was having display problem too for which I had opened one similar issue here (https://answers.ros.org/question/394457/not-able-to-run-rviz-on-ros-docker/ )

Asked by petal on 2022-01-22 07:00:36 UTC

Comments

Not sure if this will work for you in docker, but take a look at this thread and how they solve it: https://github.com/ros-visualization/rviz/issues/1226#issuecomment-419907568

If it works let’s document as an answer for future users

Asked by osilva on 2022-01-23 06:55:32 UTC

Answers

Unfortunately, if you plan to use CUDA in a docker container, it's not as simple as running a docker container. NVIDIA maintains their own docker fork which has some resources on this. Not using nvidia-docker is the most common cause for the error you're seeing: you're attempting to select a GPU but your version of docker doesn't know how to handle what you're asking it to do.

With regards to the other error you linked, I wouldn't expect this to be related: it looks like that one is a problem of graphics being accessible, while this one is about being able to call CUDA functionality.

Asked by cst0 on 2022-01-23 23:43:51 UTC

Comments