Recently, when I start Dropbox from terminal, I always get the libGL error:

/opt/dropbox/dropbox start
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

I googled, and luckily found this. I followed the instructions, and get the following output:

% glxinfo 
name of display: :0
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  46
  Current serial number in output stream:  45

% glxgears
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:  153 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  35
  Current serial number in output stream:  37

% export LIBGL_DEBUG=verbose 
% glxinfo
name of display: :0
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib64/dri/swrast_dri.so
libGL: Can't open configuration file /home/nostalgia/.drirc: No such file or directory.
libGL: Can't open configuration file /home/nostalgia/.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  46
  Current serial number in output stream:  45

There are two OpenGL implementations on my Gentoo Linux:

% eselect opengl list
Available OpenGL implementations:
  [1]   nvidia *
  [2]   xorg-x11

As you see, currently, I’m using the nvidia implementation.

And there are quite a lot libGL.so files on my box:

% locate libGL.so
/home/nostalgia/.dropbox-dist/dropbox-lnx.x86_64-3.18.1/libGL.so.1
/usr/fakelib/amd64/libGL.so
/usr/fakelib/x86/libGL.so
/usr/lib32/libGL.so
/usr/lib32/libGL.so.1
/usr/lib32/libGL.so.1.2.0
/usr/lib32/opengl/nvidia/lib/libGL.so
/usr/lib32/opengl/nvidia/lib/libGL.so.1
/usr/lib32/opengl/nvidia/lib/libGL.so.1.0.0
/usr/lib64/libGL.so
/usr/lib64/libGL.so.1
/usr/lib64/libGL.so.1.2.0
/usr/lib64/opengl/nvidia/lib/libGL.so
/usr/lib64/opengl/nvidia/lib/libGL.so.1
/usr/lib64/opengl/nvidia/lib/libGL.so.1.0.0

% sudo find /usr -iname "*libGL.so*" -exec ls -l {} \; 
Password: 
lrwxrwxrwx 1 root root 24 Jul 15  2015 /usr/fakelib/x86/libGL.so -> /usr/lib32/librrfaker.so
lrwxrwxrwx 1 root root 24 Jul 15  2015 /usr/fakelib/amd64/libGL.so -> /usr/lib64/librrfaker.so
lrwxrwxrwx 1 root root 14 Mar 14 01:22 /usr/lib32/libGL.so -> libGL.so.1.2.0
lrwxrwxrwx 1 root root 14 Mar 14 01:22 /usr/lib32/libGL.so.1 -> libGL.so.1.2.0
lrwxrwxrwx 1 root root 14 Apr  7 10:14 /usr/lib32/opengl/nvidia/lib/libGL.so -> libGL.so.1.0.0
lrwxrwxrwx 1 root root 14 Apr  7 10:14 /usr/lib32/opengl/nvidia/lib/libGL.so.1 -> libGL.so.1.0.0
-rwxr-xr-x 1 root root 439972 Apr  7 10:14 /usr/lib32/opengl/nvidia/lib/libGL.so.1.0.0
-rwxr-xr-x 1 root root 697944 Mar 14 01:22 /usr/lib32/libGL.so.1.2.0
lrwxrwxrwx 1 root root 14 Mar 14 01:22 /usr/lib64/libGL.so -> libGL.so.1.2.0
lrwxrwxrwx 1 root root 14 Mar 14 01:22 /usr/lib64/libGL.so.1 -> libGL.so.1.2.0
lrwxrwxrwx 1 root root 14 Apr  7 10:14 /usr/lib64/opengl/nvidia/lib/libGL.so -> libGL.so.1.0.0
lrwxrwxrwx 1 root root 14 Apr  7 10:14 /usr/lib64/opengl/nvidia/lib/libGL.so.1 -> libGL.so.1.0.0
-rwxr-xr-x 1 root root 579760 Apr  7 10:14 /usr/lib64/opengl/nvidia/lib/libGL.so.1.0.0
-rwxr-xr-x 1 root root 774688 Mar 14 01:22 /usr/lib64/libGL.so.1.2.0

So I doubt that if the glxgears/glxinfo command is using the inappropriate libGL.so file. How to detect which libGL.so file I’m using? Of course, with strace:

		% strace -o /tmp/libGL.strace glxgears

I checked the /tmp/libGL.strace file, and found that the called libGL.so file is /usr/lib64/libGL.so.1, which is a symbolic link to /usr/lib64/libGL.so.1.2.0, the default xorg-x11 OpenGL implementation.

Now, it’s quite clear: I only need to point /usr/lib64/libGL.so.1 to the nvidia OpenGL .so implementation, which is /usr/lib64/opengl/nvidia/lib/libGL.so.1.0.0:

		% sudo ln -fs /usr/lib64/opengl/nvidia/lib/libGL.so.1.0.0 /usr/lib64/libGL.so.1

And test again:

% glxinfo | grep direct
direct rendering: Yes

Now, everything works like a charm!

References:

Leave a Reply

Your email address will not be published. Required fields are marked *