76

If I click the desktop app of "Steam", nothing happens.

Running steam in terminal produces the following:

STEAM_RUNTIME is enabled automatically
Installing breakpad exception handler for appid(steam)/version(1474415843)
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

What's interesting is that if I change my GPU driver to xorg, it works perfectly.

What can I do to make it work? It stopped working after the latest steam update(36 hours ago).

I tried uninstalling nvidia - sudo apt-get remove nvidia* and re-installing the driver, but with no luck.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
cbll
  • 1,600

6 Answers6

70

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.

  • 16
    Man, you deserve a huge cookie. – Aritz Lopez Aug 13 '17 at 10:31
  • 5
    on debian 9, I removed this one and worked, but no mention to "mesa", however, "dpkg -S libGL.so.1" give a tip which one you should remove. So:

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

    And enjoy your cookie :)

    – FabricioFCarv Feb 16 '18 at 01:22
  • Yep, basically you need to remove libGL.so.1 from wherever it is in your system. – Zobayer Hasan Feb 18 '18 at 14:22
  • 1
    This is correct; at first I thought that it would be better to remove the package (libgl1-mesa-glx) that libGL.so.1 belongs to, but as it happens, this is a requirement of the Steam package. So just remove libGL.so.1 (which should be a symbolic link anyway). – bbarker Mar 18 '18 at 11:13
  • I don't have a mesa folder in /usr/lib/i386-linux-gnu/. I tried removing /usr/lib/i386-linux-gnu/libGL.so.1, and steam said: You are missing the following 32-bit libraries, and Steam may not run: libGL.so.1 – alephalpha Jul 05 '18 at 07:08
  • 1
    This was an error scenario that caused due to conflicts between mesa and nvidia. If you don't have one or the other, then probably the reason is something different. If you are using ubuntu 18.04, this issue no longer exists. – Zobayer Hasan Jul 09 '18 at 04:27
  • 1
    I had the same problem in CentOS 7. (thanks @ZobayerHasan saved a lot of time). Removing the default libGL libs solved the issue. But is there a better solution without deleting the default library? – Waruna Ranasinghe Jul 11 '18 at 23:37
  • 5
    This issue persists on 18.10 – QkiZ Nov 10 '18 at 23:05
  • @QkiZ, Interesting, cause I did fresh install of 18.04 and steam, with nvidia drivers. And this problem did not occur. Somehow 18.10 re-introduced the problem? – Zobayer Hasan Nov 26 '18 at 07:48
  • 1
    Yes. I resolved it by resolution from https://github.com/ValveSoftware/steam-for-linux/issues/5884#issuecomment-437690163 – QkiZ Nov 26 '18 at 14:43
  • 6
    After updating Linux Mint from 18 to 19 i had this issue. I had to remove /usr/lib/i386-linux-gnu/libGL.so.1 Thank you Zobayer Hasan for your help! – kayo Feb 24 '19 at 23:24
  • 1
    Removing /usr/lib/i386-linux-gnu/libGL.so.1 lets the Steam launch somewhat but then complains that this is missing, if it is found then the launch crashes to "An X Error occurred" :( – NikoNyrh May 19 '19 at 12:04
  • @NikoNyrh You should only remove it when it is redundant, otherwise probably have to look into other solutions. – Zobayer Hasan May 20 '19 at 05:44
  • It seems that my issue is related to CUDA 10 not shipping with x86 version of some drivers(?) which Steam requires. I don't have the relevant links at hand atm. – NikoNyrh May 20 '19 at 07:59
  • 2
    This issue persists on 19.10 sudo rm -rf /lib/x86_64-linux-gnu/libGL.so.1 fix it – Antoine Boucher Jan 31 '20 at 00:48
32

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!

Stan S.
  • 477
  • 5
  • 5
  • 3
    Thanks bro! This works for me in Ubuntu 20.04. – Noctis Apr 20 '20 at 20:00
  • 4
    I was able to get away with just sudo apt install libnvidia-gl-440 – gbronner May 01 '20 at 22:58
  • This worked for me after upgrading to nvidia-driver-440! I didn't realize that my glxgears binary was 32-bit at first. – erjiang Jun 30 '20 at 17:38
  • 1
    I play WoW using Lutris, and after upgrading from 390 to 450 to support my new GeForce GTX 1660 on Mint 19.3, I was getting the same error in my WINE console output:
    libGL error: failed to load driver: swrast```
    The error was resolved by installing `libnvidia-gl-450:i386` which was not selected by default for some reason.
    
    – EvilSupahFly Jul 21 '20 at 22:26
  • 3
    It says Depends: libnvidia-gl-450:i386, but installing libnvidia-gl-450:i386 threatens to remove cuda-10-1 cuda-demo-suite-10-1 cuda-drivers cuda-drivers-450 cuda-runtime-10-1 libnvidia-gl-450 libnvidia-ifr1-450 nvidia-driver-450 but i need cuda 10.1.

    As Cuda 11 and Cuda 10.2 is not supported by many libraries I daily use. Want to use steam and Cuda.

    – Black Chase Sep 02 '20 at 05:28
  • 1
    Thanks heaps. I needed to: apt install libnvidia-gl-460:i386 on Ubuntu 18.04 – Neil Stockbridge Mar 02 '21 at 07:55
  • This fixed an issue for me. I recently installed Ubuntu 20.04 within WSL2 (Windows 10) where the host machine has an NVidia GPU. – Matthew Zaleski Jun 10 '21 at 23:48
  • FYI, the number at the end needs to match the version of the nvidia driver you are using. You can check with nvidia-smi | grep -i version – Jeff Ward Jan 07 '23 at 18:46
17

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 (Microsoft@Microsoft.com) (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 (Microsoft@Microsoft.com) (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 (Microsoft@Microsoft.com) (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.

Quick Fix From Comments

In comment below it is suggested to try https://stackoverflow.com/a/63450299/6929343:

export LIBGL_ALWAYS_INDIRECT=1

For a quick test, run:

glxinfo -B | grep renderer

NOTE: I haven't tested this solution.

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

  • 3
    This didn't work for me - although I'm not using lock-screen-timer – Eric Mar 05 '18 at 12:50
  • lock-screen-timer is just an example of a script that calls the GUI. You could use gedit. – WinEunuuchs2Unix Mar 05 '18 at 13:14
  • Sure, I realize. My point is that my application (rqt) might be invoking the GUI in a different way, which might be why it still fails after trying your fix – Eric Mar 05 '18 at 13:54
  • Hm. For me gnome-terminal throws the same warning, but even without renaming anything, the warning is gone when starting a second instance of gnome-terminal. Isn't that the case maybe for your "solution" too? – jan-glx Apr 24 '18 at 11:19
  • This did not work for me as well – Tropilio Oct 28 '19 at 13:56
  • I don't even have mesa folder in my WSL2 – Praytic May 07 '21 at 15:29
  • @Praytic The answer was posted for WSL (version 1). I haven't had time to reboot and test WSL2 yet. – WinEunuuchs2Unix May 07 '21 at 17:22
  • 1
    For WSL you need to run export LIBGL_ALWAYS_INDIRECT=1. See the dedicated question about WSL. https://stackoverflow.com/questions/61831052/how-do-i-run-opengl-programs-using-wsl-ubuntu-20-04 – Aaron Jul 11 '23 at 11:09
  • @Aaron Thank you for the comment. I rolled it up into the answer and I hope it helps others. – WinEunuuchs2Unix Jul 12 '23 at 03:27
5

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.

2

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.

Christian Fritz
  • 363
  • 3
  • 15
1

The solutions that worked for me:

  • Ubuntu 20.04:
    sudo apt install libnvidia-gl-440
    (without :i386)

  • WSL2 Windows 10: run XServer with -nowgl (and -ac):
    "C:\Program Files\VcXsrv\vcxsrv.exe" :0 -multiwindow -clipboard -nowgl -ac #see https://askubuntu.com/a/1394781/498339

PJ127
  • 281