Ssh – X Forwarding with indirect rendering fails with newer clients

sshstartxx11

Posting this question for a colleague after quite a bit of research. He wants to connects to an old Centos 4 server via ssh -X (or -Y) and run some X application there. It used to run fine for years, but recent updates (on both Centos 7 and Ubuntu) to his client PCs now make this impossible. His app just hangs, and trying simply to run glxgears leads to a crash:

X Error of failed request:  BadValue (integer parameter out of range for operation)
Major opcode of failed request:  150 (GLX)
Minor opcode of failed request:  3 (X_GLXCreateContext)
Value in failed request:  0x0
Serial number of failed request:  19
Current serial number in output stream:  21

It's really a problem of version of the client. Reverting to earlier Centos 6 on the client side make it work again. There's nothing in the X11 log on the server side. I ran strace glxgears without noticing anything out of the ordinary. What can I try to diagnose this further ?

EDIT:
On any modern Linux the following attempt to force an indirect rendering context will fail:

glxinfo -i
name of display: :0
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:  24 (X_GLXCreateNewContext)
Value in failed request:  0x0
Serial number of failed request:  39
Current serial number in output stream:  40

I tried the following to re-enable indirect rendering. Unless I'm mistaken, all those have to be done on the client machine:

  • in sections Screen or Device of /etc/X11/xorg.conf you add:

    Option "AllowIndirectGLXProtocol" "True"

  • in /usr/bin/startx (or wherever startx is located):

    defaultserverargs="+iglx"

  • in /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf you change the line:

    xserver-command=X -core +iglx

  • before launching KDE, for instance in .kde/env/igl.sh

    export LIBGL_ALWAYS_INDIRECT=1

None of those work.

Best Answer

Linux workstation

Perversely, many versions of GDM don't offer a way to pass arguments like +iglx to Xorg. In response, new X.org versions have an IndirectGLX option (see also example xorg.conf text).

In the absence of that option, there is a workaround of wrapping Xorg itself with a shell script:

mv /usr/bin/Xorg /usr/bin/Xorg.original
echo -e '#!/usr/bin/env bash\nexec /usr/bin/Xorg.original "$@" +iglx' > /usr/bin/Xorg
chmod +x /usr/bin/Xorg
chcon --type=bin_t /usr/bin/Xorg

macOS workstation (XQuartz)

Just run

defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

and restart XQuartz if it's running. (Beware of typos: there is no error checking on the domain and variable names.)

Related Question