25

I am trying to run an executable on a remote server, to which I connect via ssh -Y. I think the executable uses openGL

The server runs Ubuntu and the local system runs OSX.

ssh -Y normally opens a display on my local machine by X11. This works well with other applications (firefox, matlab etc..)

This time I get the message:

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:  149 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  35
  Current serial number in output stream:  34
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  149 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  34
  Current serial number in output stream:  35

I also ran glxinfo (I was trying things I found on forums) and got this

name of display: localhost:11.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:  149 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  23
  Current serial number in output stream:  22

Could someone help with this?

Thank you!

Adam Gosztolai
  • 755
  • 2
  • 7
  • 10
  • What’s your local machine running? – Stephen Kitt Mar 12 '18 at 15:35
  • 3
    Are you using XQuartz? – Stephen Kitt Mar 12 '18 at 15:42
  • Yes, XQuartz 2.7.11 – Adam Gosztolai Mar 12 '18 at 15:50
  • You may need to specify option `+extension GLX` in your XQuartz command. – mviereck Mar 12 '18 at 16:12
  • @mviereck Thank you! Can you please tell me how to do this? – Adam Gosztolai Mar 12 '18 at 16:19
  • I don't have a mac, I can only assume. Somewhere you are starting Xquartz. Add that option to the Xquartz command line. Or other possibility, does Xquartz have a config file like `xorg.conf`? – mviereck Mar 12 '18 at 16:27
  • 14
    Try the following: 1) ensure you are running up-to-date Xquartz. 2) in a terminal, `defaults write org.macosforge.xquartz.X11 enable_iglx -bool true` 3) restart xquartz. This worked for me to get a simple java app running. I tried "glxgears" and it starts, but the gears don't turn. I presume they're supposed to. – Dan Pritts Jul 05 '18 at 05:24
  • 2
    I also get the `glxgears` displaying the wheels, but they do not move. – rdbisme Aug 09 '19 at 14:50
  • Same thing - glxgears, no gears moving, keeps reporting fps numbers. Tried running XQuartz with `+extension GLX`. Tried setting `defaults write org.macosforge.xquartz.X11 enable_iglx -bool true`. – Paul Mikesell Jan 20 '20 at 01:32
  • 2
    I installed `xorg-server` via MacPorts and had to write `defaults write org.macports.X11 enable_iglx -bool true` based on the default preference domain listed by `quartz-wm --help`. Running `glxgears` on the remote machine pops up the gears and libGL error messages (`No matching fbConfigs or visuals found` and `failed to load driver: swrast`) along with FPS counts. – Andreas Yankopolus Mar 16 '20 at 23:12

3 Answers3

12

EDIT May 5th, 2021: With the release of XQuartz 2.8.0, the configuration path appears to have changed from org.macosforge.xquartz.X11 to org.xquartz.X11. The same instructions still apply, just replace the old path with the new if you are from the future.


Although the answers here have fixes, I'm submitting another one that I can use for future reference when this issue comes up every other year in my work :)

It happens often when X forwarding (via SSH, Docker, etc). You need to allow OpenGL drawing (iglx), which by default is disabled on a lot of X11 servers (like XQuarts or the standard X11 server on Ubuntu). Some other logs you may see related to this are below.

XRequest.155: GLXBadContext 0x500003a
XRequest.155: BadValue (integer parameter out of range for operation) 0x0
XRequest.155: GLXBadContext 0x500003b
[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
../../src/xcb_io.c:259: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.

The fix is to enable iglx. First, check if you have an XQuarts version that supports this feature. The latest as of this writing does, but it is deprecated so may not in the future. My version is XQuartz 2.7.11 (xorg-server 1.18.4).

Next, run defaults write org.macosforge.xquartz.X11 enable_iglx -bool true. You should be able to confirm it is set by running

$ defaults read org.macosforge.xquartz.X11
{
    "app_to_run" = "/opt/X11/bin/xterm";
    "cache_fonts" = 1;
    "done_xinit_check" = 1;
    "enable_iglx" = 1; ####### this should be truthy
    "login_shell" = "/bin/sh";
    "no_auth" = 0;
    "nolisten_tcp" = 0;
    "startx_script" = "/opt/X11/bin/startx -- /opt/X11/bin/Xquartz";
}

Finally, restart xquartz (or your whole machine). You may need to re-run xhost + to disable security & authentication (fine for isolated machines, dangerous for internet-exposed). You should now be able to run your GUI applications as expected. Hope this helps!

HeroCC
  • 221
  • 2
  • 7
  • I followed the `defaults write` instruction which is found both here and in several other answers, but the key to solving the issue for me was in this answer's recommendation on **using the specific version of xquartz**. I had installed the latest and that failed, however 2.7.11 is working fantastically! – Jony Thrive May 21 '21 at 05:55
  • Just wanted to note, IGLX is *very* deprecated by the XQuartz team, and I doubt the situation will improve anytime soon, esp since Apple in general has decided not to support OpenGL anymore. If you have the option, consider changing your workflow to rely less on IGLX. See https://github.com/XQuartz/XQuartz/issues/144 – HeroCC Jan 10 '22 at 20:31
  • Works on m2 macbook air. Thanks! – optimus_prime Sep 03 '22 at 03:04
  • Works with XQuartz 2.8.5 (xorg-server 21.1.6 and quartz-wm --version 1.3.2) on M1 MacBook Air and the new org domain path. – user2561747 Jun 08 '23 at 02:17
4

Based on the comments and suggestions, I think it could work in the following way. Run:

quartz-wm --help

which will output something like

usage: quartz-wm OPTIONS
Aqua window manager for X11.

--version                 Print the version string
--prefs-domain <domain>   Change the domain used for reading preferences
                          (default: org.xquartz.X11)

The last line shows the defaults domain: in this case, you then check it with

defaults read org.xquartz.X11

and change it with

defaults write org.xquartz.X11 enable_iglx -bool true

If you restart Zquartz now (by either killing it, logging out and in again or rebooting). For me, it was necessary to start the ssh session from an Xquartz xterm session. This allowed me to get:

nicola@raspy3:~ $ glxinfo                                                                                                                                                                      
name of display: localhost:10.0                                                                                                                                                                
libGL error: No matching fbConfigs or visuals found                                                                                                                                            
libGL error: failed to load driver: swrast                                                                                                                                                     
display: localhost:10  screen: 0                                                                                                                                                               
direct rendering: No (If you want to find out why, try setting LIBGL_DEBUG=verbose)                                                                                                            
server glx vendor string: SGI                                                                                                                                                                  
server glx version string: 1.4                                                                                                                                                                 
server glx extensions:                                                                                                                                                                         
    GLX_ARB_multisample, GLX_EXT_import_context, GLX_EXT_visual_info,                                                                                                                          
    GLX_EXT_visual_rating, GLX_OML_swap_method, GLX_SGIS_multisample,                                                                                                                          
    GLX_SGIX_fbconfig, GLX_SGIX_pbuffer, GLX_SGIX_visual_select_group,                                                                                                                         
    GLX_SGI_make_current_read                                                                                                                                                                  

so, the swrast message is still there, but now I get GL to work

P.S.: a one-liner to write the necessary config:

defaults write `quartz-wm --help | awk '/default:.*X11/ { gsub(/\)/, "", $2); print $2}'` enable_iglx -bool true
Nicola
  • 101
  • 3
1

I got this sorta working on Mac OS Mojave with using defaults; write org.macports.X11 enable_iglx -bool true in a terminal app, then run Xquartz +extension GLX` in the same terminal.

Then I am able to run glxgears and get rastering working, but it throws the display into the top left corner of my external monitor (instead of default/retina display) and doesn't draw any frames to resize/move it.

It kinda reminds me of crappy driver support I had with Nvidia graphics cards and trying to run a Linux desktop in 1990's :)

I looked up on freedesktop.org bug repo and it doesn't appear Retina displays are supported by Xquartz/X11 yet. There is a few hacks, but this reminds me of how clunky it was to run Wireshark a few years back inside XQuartz on my Mac. I just want to get X11 forwarding working right, where it doesn't take ~3 to 5 minutes to redraw frames. See https://gitlab.freedesktop.org/xorg/xserver/-/issues/187

XavierStuvw
  • 1,089
  • 6
  • 17
  • 40
  • If you get the window in the top left without any controls around it, you don't have a window manager running. If you run `quartz-wm` you will get controls etc. – mvds Feb 24 '21 at 20:34