Anki not opening in Ubuntu: libGL error

When I start anki in my Ubuntu machine, this popups

image

When I try to open it in terminal the following error message is coming

libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget::resizeEvent() no OpenGL context 
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget::resizeEvent() no OpenGL context 
Qt warning: QQuickWidget: Failed to make context current 
Xlib: sequence lost (0x102d1 > 0x2d3) in reply type 0x0!
Xlib: sequence lost (0x102d4 > 0x2d6) in reply type 0x0!
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget::resizeEvent() no OpenGL context 
Qt warning: QQuickWidget: Failed to make context current 
[21404:21447:0520/120313.269102:ERROR:context_group.cc(292)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
Qt warning: QQuickWidget: Attempted to render scene with no context 
Qt warning: QQuickWidget: Attempted to render scene with no context 
Qt warning: QQuickWidget: Attempted to render scene with no context 
[21461:7:0520/120313.271585:ERROR:command_buffer_proxy_impl.cc(144)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.
[21404:21447:0520/120313.291113:ERROR:context_group.cc(292)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
Qt warning: QQuickWidget::invalidateRenderControl could not make context current 
Qt warning: QQuickWidget::invalidateRenderControl could not make context current 
Qt warning: QQuickWidget::invalidateRenderControl could not make context current 

OS version - Ubuntu 20.04.2 LTS
Graphics - Radeon RX 580 Series
Processor - AMD® Ryzen 7 3800x 8-core processor × 16

I have tried searching on Google and tried this, but it didn’t work.

Also I reinstalled my graphic drivers to see whether it works, but it didn’t :frowning:

Anki version is 2.1.44 also tried 2.1.40

Did you install from Ubuntu repository?
Don’t install. Download tar.bz2 version from Anki main website.

I downloaded from the Anki website and not from the Ubuntu repository

I use it on Manjaro Plasma with nvidia and I don’t have problems.

Google for:

libgl error failed to load driver swrast ubuntu

for example

Or ask also on Ubuntu forum or askubuntu.com

You can try

# apt intall mesa-utils libgl1-mesa-glx

It is probably related to you having proprietary Nvidia drivers.

I have an AMD graphic card

mhm… wrong diagnostic then I guess :stuck_out_tongue: still worth trying I think.

Nope, not working :sob:

try doing

$ LIBGL_DEBUG=verbose anki

and post the output.

libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL: OpenDriver: trying /usr/X11R6/lib64/modules/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/X11R6/lib64/modules/dri/swrast_dri.so
libGL: dlopen /usr/X11R6/lib64/modules/dri/swrast_dri.so failed (/usr/X11R6/lib64/modules/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so
libGL: dlopen /usr/lib64/dri/swrast_dri.so failed (/usr/lib64/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/X11R6/lib/modules/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/X11R6/lib/modules/dri/swrast_dri.so
libGL: dlopen /usr/X11R6/lib/modules/dri/swrast_dri.so failed (/usr/X11R6/lib/modules/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/dri/swrast_dri.so
libGL: dlopen /usr/lib/dri/swrast_dri.so failed (/usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/X11R6/lib32/modules/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/X11R6/lib32/modules/dri/swrast_dri.so
libGL: dlopen /usr/X11R6/lib32/modules/dri/swrast_dri.so failed (/usr/X11R6/lib32/modules/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib32/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib32/dri/swrast_dri.so
libGL: dlopen /usr/lib32/dri/swrast_dri.so failed (/usr/lib32/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget::resizeEvent() no OpenGL context 
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget::resizeEvent() no OpenGL context 
Qt warning: QQuickWidget: Failed to make context current 
Xlib: sequence lost (0x102bb > 0x2bf) in reply type 0x0!
Qt warning: QQuickWidget: Failed to make context current 
Qt warning: QQuickWidget::resizeEvent() no OpenGL context 
Qt warning: QQuickWidget: Failed to make context current 
[5013:5055:0522/160354.584581:ERROR:context_group.cc(292)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
Qt warning: QQuickWidget: Attempted to render scene with no context 
Qt warning: QQuickWidget: Attempted to render scene with no context 
Qt warning: QQuickWidget: Attempted to render scene with no context 
[5069:7:0522/160354.586989:ERROR:command_buffer_proxy_impl.cc(144)] ContextResult::kTransientFailure: Failed to send GpuChannelMsg_CreateCommandBuffer.
[5013:5055:0522/160354.600715:ERROR:context_group.cc(292)] ContextResult::kFatalFailure: too few texture units supported (0, should be 8).
Qt warning: QQuickWidget::invalidateRenderControl could not make context current 
Qt warning: QQuickWidget::invalidateRenderControl could not make context current 
Qt warning: QQuickWidget::invalidateRenderControl could not make context current 


Do you have proprietary or open source AMD drivers? Installing proprietary drivers can break the installation of libGL, in the sense that the drivers are installed, but the links that point to them are replaced with broken links.

If you do have proprietary drivers, I suggest you try installing open source ones.

What does this say https://stackoverflow.com/a/32056721/13853882 I couldn’t understand as I have very little experience with linux.

Your environment contains information which allows programs to fetch resources. LD_LIBRARY_PATH is an environment variable that provides information about where to fetch shared objects (the .so files).
The guy would posted says he provided the wrong paths, therefore preventing programs fetching the resources at the good place (to be more specific, he added /usr/lib and /usr/lib64 to LD_LIBRARY_PATH, whereas the .so file was in the /usr/X11R6/lib directory).
When he removed the wrong paths, his programs were able to fetch the resources (it is not completely clear to me why removing paths would actually allow programs to find resources in other paths, but whatever…).
However, from the logs you posted, you can see that in your case libGL tries to fetch the resource (swrast_dri.so) in many directories, including /usr/X11R6/lib, but fails to find it in all of them. Furthermore, you have no problems in loading libGL.so, you have problems loading swrast_dri.so, which is a subcomponent of the libGL library.

You could actually try, as the author of the post, to do strace -e open anki 2&>1 | grep libGL.so and post the result.

I am not sure about these drivers, I downloaded mine from the AMD website.

This is what I am getting

image

Nothing in the terminal

Sorry, I wasn’t complete, I forget the -e open. Furthermore, I meant the log of strace -e open anki 2&>1 | grep libGL.so.

Still the same error

Oh sorry I am an idiot :sweat_smile: it’s strace -e open anki 2>&1 | grep libGL.so. I always forget which is the right order between the > and the &…