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

Ubuntu 16.04+ For anyone still getting same error, if you are using nvidia driver, sometimes you will see that libGL.so.1 points to ambiguous libGL provided by both mesa and nvidia. To test this, you can run this command

$ sudo ldconfig -p | grep -i gl.so

The output was something like:

    libwayland-egl.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libwayland-egl.so.1
    libftgl.so.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libftgl.so.2
    libcogl.so.20 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcogl.so.20
    libQt5OpenGL.so.5 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5
    libQtOpenGL.so.4 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQtOpenGL.so.4
    libQtOpenGL.so.4 (libc6) => /usr/lib/i386-linux-gnu/libQtOpenGL.so.4
    libOpenGL.so.0 (libc6,x86-64) => /usr/lib/nvidia-378/libOpenGL.so.0
    libOpenGL.so (libc6,x86-64) => /usr/lib/nvidia-378/libOpenGL.so
    libGL.so.1 (libc6,x86-64) => /usr/lib/nvidia-378/libGL.so.1
    libGL.so.1 (libc6) => /usr/lib/i386-linux-gnu/mesa/libGL.so.1
    libGL.so.1 (libc6) => /usr/lib32/nvidia-378/libGL.so.1
    libGL.so (libc6,x86-64) => /usr/lib/nvidia-378/libGL.so
    libGL.so (libc6) => /usr/lib32/nvidia-378/libGL.so
    libEGL.so.1 (libc6,x86-64) => /usr/lib/nvidia-378/libEGL.so.1
    libEGL.so.1 (libc6) => /usr/lib32/nvidia-378/libEGL.so.1
    libEGL.so (libc6,x86-64) => /usr/lib/nvidia-378/libEGL.so
    libEGL.so (libc6) => /usr/lib32/nvidia-378/libEGL.so

Now I just needed to remove the library provided by mesa and everything worked perfectly.

$ sudo rm /usr/lib/i386-linux-gnu/mesa/libGL.so.1

Update: This issue no longer exists from Ubuntu 18.04 LTS.


In my situation I had to install the i386 NVIDIA drivers. It worked thereafter.

sudo apt install libnvidia-gl-440:i386

Have a great day!


Windows Subsystem for Linux (WSL) has same error

In Windows Subsystem for Linux (WSL) under Windows 10 there the file /usr/lib/i386-linux-gnu/mesa/libGL.so.1 does not exist. Instead there is the file /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 seems to replace it. However if you delete the replacement file the library doesn't work at all.

Rename library then rename back solves problem

If you rename the file and then rename it back the errors disappear and it works a lot faster:

───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$ lock-screen-timer
Linux version 4.4.0-43-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #1-Microsoft Wed Dec 31 14:42:53 PST 2014
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$ sudo ldconfig -p | grep -i gl.so
        libwayland-egl.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libwayland-egl.so.1
        libcogl.so.20 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcogl.so.20
        libQt5OpenGL.so.5 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libQt5OpenGL.so.5
        libGL.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
        libEGL.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/mesa-egl/libEGL.so.1
───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$ sudo rm /usr/lib/i386-linux-gnu/mesa/libGL.so.1
rm: cannot remove '/usr/lib/i386-linux-gnu/mesa/libGL.so.1': No such file or directory
───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$ sudo mv /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.ORIGINAL
───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$ lock-screen-timer
Linux version 4.4.0-43-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #1-Microsoft Wed Dec 31 14:42:53 PST 2014
/usr/bin/zenity: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$ sudo mv /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.ORIGINAL /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$ lock-screen-timer
Linux version 4.4.0-43-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #1-Microsoft Wed Dec 31 14:42:53 PST 2014
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
───────────────────────────────────────────────────────────────────────────────
rick@alien:/mnt/e/etc$

I verified the change is persistent, ie close the WSL terminal window and open a new window.

What's using the library?

The library is used by yad in the lock-screen-timer bash script upgraded with hybrid support for WSL in addition to Ubuntu. Yad is a fork of Zenity which is why you see the Zenity-like Gtk-Message: reference in the third error message above.

Here's what the yad window looks like in Ubuntu (in WSL it's slightly different):

Lock Screen Timer


This might be a nvidia driver issue, according to a steam-for-linux issue.

In my case, I installed SuperTuxKart through flapak, when I ran it, I met following errors:

..:: Antarctica Rendering Engine 2.0 ::..
Linux 4.15.0-52-generic #56-Ubuntu SMP Tue Jun 4 22:49:08 UTC 2019 x86_64
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

My solution is:

  1. Check nvidia driver on my system

ubuntu-drivers devices

It has nvidia-driver-430 installed already.

  1. According to the steam-for-linux issue issue, install nvidia-driver-418 to replace nvidia-driver-430

sudo apt install libnvidia-gl-418

It prompted that it lack dependency of libnvidia-compute-418, so just install libnvidia-compute-418 first.

sudo apt install libnvidia-compute-418

then

sudo apt install libnvidia-gl-418

  1. Reboot system.

Then I ran SuperTuxKart, it worked.


In my case the issue was that I had enabled some CUDA apt sources that had installed the 440 nvidia driver and tools. Once I disabled that and installed the then latest version of nvidia driver (435), it installed everything else needed and the error went away.