Subject: Bug#1094: When connected to a x2go server that has nVidia's binary drivers most software will segfault.

From: Matthew Moskewicz <[email-masked]>
Date: Thu, 11 May 2017 12:15:03 -0700

i ran into this issue on ubuntu 16.04 (64 bit), and i can confirm that both
workarounds (using Nouveau and setting LD_LIBRARY_PATH=/usr/lib/nvidia-375
) fix the issue.

to add a bit more info, it seems that in the failing case, glxinfo (or
presumably the other apps), can't find the GLX_indirect library that it
trys to load dynamically, which has something to glvnd:
https://github.com/NVIDIA/libglvnd

looking at ldd, you can see that glxinfo is finding the GL libraries fine,
using the system-set ld.so.conf settings that the nvidia driver sets up:
moskewcz@mari:/etc/ld.so.conf.d$ ldd /usr/bin/glxinfo
    linux-vdso.so.1 =>  (0x00007ffe4779c000)
    libGL.so.1 => /usr/lib/nvidia-375/libGL.so.1 (0x00007fcd87f35000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6
(0x00007fcd87bfb000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcd87831000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fcd8762d000)
    libGLX.so.0 => /usr/lib/nvidia-375/libGLX.so.0 (0x00007fcd873fd000)
...

the paths are set here:
moskewcz@mari:/etc/ld.so.conf.d$ cat
/etc/ld.so.conf.d/x86_64-linux-gnu_EGL.conf
/usr/lib/nvidia-375
/usr/lib32/nvidia-375

using strace, we can see the difference that setting LD_LIBRARY_PATH makes:

# working case, opens the correct lib:
moskewcz@mari:/etc/ld.so.conf.d$ LD_LIBRARY_PATH=/usr/lib/nvidia-375 strace
glxinfo 2>&1 | grep GLX_ind
open("/usr/lib/nvidia-375/tls/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) =
-1 ENOENT (No such file or directory)
open("/usr/lib/nvidia-375/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = 4

# non-working case, fails to open libGLX_indirect.so:
moskewcz@mari:/etc/ld.so.conf.d$ strace glxinfo 2>&1 | grep GLX_ind
open("/lib/x86_64-linux-gnu/tls/x86_64/libGLX_indirect.so.0",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/tls/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC)
= -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/x86_64/libGLX_indirect.so.0",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/x86_64/libGLX_indirect.so.0",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/tls/libGLX_indirect.so.0",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/x86_64/libGLX_indirect.so.0",
O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/usr/lib/x86_64-linux-gnu/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC)
= -1 ENOENT (No such file or directory)
open("/lib/tls/x86_64/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
open("/lib/tls/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No
such file or directory)
open("/lib/x86_64/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT
(No such file or directory)
open("/lib/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such
file or directory)
open("/usr/lib/tls/x86_64/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
open("/usr/lib/tls/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT
(No such file or directory)
open("/usr/lib/x86_64/libGLX_indirect.so.0", O_RDONLY|O_CLOEXEC) = -1
ENOENT (No such file or directory)
[...snip many more repeats of failed-to-load libGLX_indirect...]

however, it's not clear why, under x2go, the nvidia code isn't searching in
/usr/lib/nvidia-375 -- but it's not clear what code it uses for the DL
loading, maybe it is somewhere in the glvnd code.

mwm