Ubuntu libGL error failed to load driver swrast

I setup PlayOnLinux to install some windows games on my linux machine, however, frequently one of the issues of cross-os gaming is that you must run them in a 32bit wine configuration.

Ok, thats not so bad, but everytime I completed the PlayOnLinux install process, and actually ran the game, I was getting the following errors in the debug log:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:BadValue (integer parameter out of range for operation)
Major opcode of failed request: 154 (GLX)
Minor opcode of failed request: 3 (X_GLXCreateContext)
Value in failed request: 0x0
Serial number of failed request: 250
Current serial number in output stream: 254

To make a long story short, it seems there was an issue with my 32bit openGL drivers (the 64bit ones worked just fine).  To solve the issue, I ran the following command to check out where my libraries were pointing to:

ldconfig -p | grep libGL.so.1

Which in my case was returning:

libGL.so.1 (libc6,x86-64) => /usr/lib/nvidia-352/libGL.so.1
libGL.so.1 (libc6) => /usr/lib/i386-linux-gnu/mesa/libGL.so.1

Well, the first line (the one with libc6,x86-64) was reporting the location of the 64 bit libGL library, that one was ok.

The second one (libc6),  is the 32bit library, I can see it was pointing to some /usr/lib/i386-linux-gnu/mesa/ folder..  The spot it should really be pointing to is  /usr/lib32 . In your case, you may not even have this second line (hence no 32bit driver) read below on how to add it if this is the case

These library paths are defined inside the /etc/ld.so.conf.d folder. So, I greped in there for mesa, and I found the culprit.  In my case it was the file /etc/ld.so.conf.d/i386-linux-gnu_GL.conf .  The content of the file was:

/usr/lib/i386-linux-gnu/mesa

I commented that line and added the correct folder (/usr/lib32).  So the file became:

#/usr/lib/i386-linux-gnu/mesa
/usr/lib32

If in your case you never had a libc6 library reported by ldconfig -p | grep libGL.so.1, you can just go ahead and create a file /etc/ld.so.conf.d/local.conf or whatever, with the contents:

/usr/lib32

Anyways, once that file is in place, you need to run ldconfig to enable the new configuration:

sudo ldconfig

And to test the configuration you can run again:

ldconfig -p | grep libGL.so.1

You should see the libc6 line pointed to the correct folder in /usr/lib32 .  Now your 32bit GLX should work!

Happy Gaming!

Bookmark the permalink.
There are to Ubuntu libGL error failed to load driver swrast