Ubuntu20.04でRviz2が起動しない

Parallel desktopのUbuntu20.04でRviz2が起動しない

$ rviz2

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
[ERROR] [1605944184.798295285] [rviz2]: rviz::RenderSystem: error creating render window: basic_string::_M_construct null not valid
[ERROR] [1605944184.798411642] [rviz2]: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at /home/shohei/ros2_foxy/build/rviz_ogre_vendor/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)
[ERROR] [1605944184.798448152] [rviz2]: rviz::RenderSystem: error creating render window: InvalidParametersException: Window with name 'OgreWindow(0)' already exists in GLRenderSystem::_createRenderWindow at /home/shohei/ros2_foxy/build/rviz_ogre_vendor/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1061)
(中略)
[ERROR] [1605944639.406623273] [rviz2]: Unable to create the rendering window after 100 tries
terminate called after throwing an instance of 'std::runtime_error'
  what():  Unable to create the rendering window after 100 tries
Aborted (core dumped)

LIBGL_ALWAYS_INDIRECT=1をつけると最初のエラーが消えた

$ LIBGL_ALWAYS_INDIRECT=1 rviz2 
rviz2: /tmp/binarydeb/ros-foxy-rviz-ogre-vendor-8.2.0/obj-x86_64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp:3468: void Ogre::GLRenderSystem::initialiseExtensions(): Assertion `pcVer && "Problems getting GL version string using glGetString"' failed.
Aborted (core dumped)

もしかしたらrviz2だけでなくrvizも問題か?と思って試したらrvizも起動しなかった。(rviz2はrvizと同一プログラムっぽい)

以下でVirtual macihneの3D Accelerationをオフにしろとあったので、Parallel desktopの設定でオフにしたらrviz2(とrviz)が起動した。
github.com

f:id:seinzumtode:20201122071536j:plain

f:id:seinzumtode:20201122073421p:plain