How to enable "AllowIndirectGLX" on Ubuntu 18.04 with Nvidia (1050Ti)

Following scenario: I like to a run an opengl application from a remote cli only server (with a matrox graphics card) through "ssh -X". My local machine is running Ubuntu 18.04 with Nvidia graphics. I've google'd around and found, that I need to enable "AllowIndirectGLX" locally. Unfortunately I've not found how to do this the right way.

There seem to be two possibilities:
1. Adding '"AllowIndirectGLX" = "on"' to some xorg.conf.
2. Adding "+iglx" as a launch parameter to Xorg command.

Problems with this: There is no "xorg.conf" under "/etc/X11". The only file that comes near this is "/usr/share/X11/xorg.conf.d/10-nvidia.conf". For solution 2 my best guess is "/usr/bin/Xorg". But maybe I need to set this for the GDM configuration?

I would like to avoid endless trail and error sessions. Hopefully you guys can help out!

Thank you in advance!


Solution 1:

As mentioned in @NightwishFan's answer to this question, you have to create a xorg.conf file.

"Boot into recovery mode and select Root Shell. Then run:

X -configure

followed by

cp /root/xorg.conf.new /etc/X11/xorg.conf "

Once you have rebooted, open this newly created xorg.conf file using any text editor (use sudo if needed) and add

Section "ServerFlags" Option "AllowIndirectGLX" "on" Option "IndirectGLX" "on" EndSection

This is an NVidia thread that you might find useful.

Hope it helps.