Ubuntu – Win10 linux subsystem libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast

driversnvidiaopenglwindows-subsystem-for-linux

I'm not really asking a question, but this ___ website won't allow me to do this any other way.

I ran into a problem today using GTK under Win10's Linux subsystem (specifically Ubuntu 18.04). The error msg was:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

Someone else ran into this while using Steam, and there are some answers here: Steam libGL error. The second answer, "Windows Subsystem for Linux (WSL) has same error", is the one that led me to the solution, however that answer didn't work out of the box.

Their answer concerns a directory /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1. That directory does not exist in my system, but I'll provide the solution that did work on my stem in my answer (to myself).

I realize this is a terribly clumsy way to answer this question. However, I felt it was important to answer it, because it took me a lot of fiddling around to find an answer that worked for me, and others may have the same issue. I couldn't leave an answer on the original question, because it's been closed; and I couldn't comment on the answer that led me to the solution, because I don't have sufficient reputation. And I couldn't post to the meta-questions either. Can you say "Catch-22"? I knew you could.

Best Answer

Add LIBGL_ALWAYS_INDIRECT variable to /etc/bash.bashrc solved my error.

export LIBGL_ALWAYS_INDIRECT=1

Don't know what's the actual usage. But maybe useful, because XLauch confg says it requires this.

My error occurs when invoke emacs from wsl2, and display in XLauch (vcxsrv):

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

I find the solution according to: