OpenGL does not initialize - GLXBadFBConfig

Questions about Wine on Linux
Locked
User avatar
noobstang
Newbie
Newbie
Posts: 1
Joined: Sun Jan 31, 2021 5:40 pm

OpenGL does not initialize - GLXBadFBConfig

Post by noobstang »

I've tried to run a selection of games that require OpenGL (e.g. Steam, CoD, GI, Spelunky, etc.), but for any application that requires OpenGL wine crashes with the error

Code: Select all

X Error of failed request:  GLXBadFBConfig
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  0 ()
  Serial number of failed request:  1602
  Current serial number in output stream:  1602
(stuff like Notepad++ and IE are ok.)

I'm quite headless in fixing even half-sophisticated issues, but the FAQ doesn't seem to help my case.
After some searching, I don't believe it is a native driver issue, but any guidance is appreciated :?
(obviously the radeon HD 6870 doesn't support Vulkan, so I shouldn't be using DXVK)
(p.s. I also have a spare GTX 460 that can run the above mentioned applications okay with the proprietary drivers, but the card itself has issues and I would rather leave it aside from daily use.)

$ screenfetch:

Code: Select all

                          ./+o+-       noobstang@focal-eliza-vduskM
                  yyyyy- -yyyyyy+      OS: Ubuntu 20.04 focal
               ://+//////-yyyyyyo      Kernel: x86_64 Linux 5.8.0-41-generic
           .++ .:/++++++/-.+sss/`      Uptime: 50m
         .:++o:  /++++++++/:--:/-      Packages: 884
        o:+o+:++.`..```.-/oo+++++/     Shell: bash 5.0.17
       .:+o:+o/.          `+sssoo+/    Resolution: 1920x1080
  .++/+:+oo+o:`             /sssooo.   DE: Xfce
 /+++//+:`oo+o               /::--:.   WM: Xfwm4
 \+/+o+++`o++o               ++////.   WM Theme: Default
  .++.o+++oo+:`             /dddhhh.   GTK Theme: ChromeOS [GTK2]
       .+.o+oo:.          `oddhhhh+    Icon Theme: Numix
        \+.++o+o``-````.:ohdhhhhh+     Font: Sans 10
         `:o+++ `ohhhhhhhhyo++os:      Disk: 12T / 21T (56%)
           .o:`.syhhhhhhh/.oo++o`      CPU: Intel Core i7-2600 @ 8x 3.8GHz [59.0°C]
               /osyyyyyyo++ooo+++/     GPU: AMD BARTS (DRM 2.50.0 / 5.8.0-41-generic, LLVM 11.0.1)
                   ````` +oo+++o\:     RAM: 5289MiB / 11963MiB
                          `oo++.      
$ glxinfo | grep OpenGL

Code: Select all

OpenGL vendor string: X.Org
OpenGL renderer string: AMD BARTS (DRM 2.50.0 / 5.8.0-41-generic, LLVM 11.0.1)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.1.0-devel (git-e014e3b 2021-01-31 focal-oibaf-ppa)
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 21.1.0-devel (git-e014e3b 2021-01-31 focal-oibaf-ppa)
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 21.1.0-devel (git-e014e3b 2021-01-31 focal-oibaf-ppa)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
OpenGL ES profile extensions:
Last few lines from wine.log with WINEDEBUG

Code: Select all

2880:trace:wgl:set_win_format created GL drawable 7200021 for win 0x3e00ca fbconfig 0x15c visual id 0x4bc drawable type 0x7
2880:trace:wgl:glxdrv_wglCreateContext 0x19004f -> 0x876f678
2880:trace:wgl:glxdrv_wglMakeCurrent (0x19004f,0x876f678)
2880:trace:wgl:glxdrv_wglMakeCurrent hdc 0x19004f drawable 7200021 fmt 0x8774da8 ctx 0x7d95e270 fbconfig 0x15c visual id 0x4bc drawable type 0x7
2880:trace:wgl:glxdrv_wglMakeCurrent 0x19004f,0x876f678 returning 1
2880:trace:wgl:wglGetProcAddress returning wglCreateContextAttribsARB -> 0x7a8bad50
2880:trace:wgl:X11DRV_wglCreateContextAttribsARB (0x19004f (nil) 0x31f384)
2880:trace:wgl:X11DRV_wglCreateContextAttribsARB 0x2091 0x4
2880:trace:wgl:X11DRV_wglCreateContextAttribsARB 0x2092 0x4
X Error of failed request:  GLXBadFBConfig
  Major opcode of failed request:  153 (GLX)
  Minor opcode of failed request:  0 ()
  Serial number of failed request:  228
  Current serial number in output stream:  228
Thanks for your patience :roll:
Achyut-BK
Newbie
Newbie
Posts: 2
Joined: Sun Feb 07, 2021 6:12 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by Achyut-BK »

I guess this could be a problem with Mesa on old hardware. I get this while working with flashpoint linux (which uses wine). Moreover this error only cropped up when I replaced the default drivers with those from ppa:oibaf/graphics-drivers. I guess reverting my drivers to the old state will help.

Hope this helped
Achyut-BK
Newbie
Newbie
Posts: 2
Joined: Sun Feb 07, 2021 6:12 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by Achyut-BK »

Downgrading from oibaf ppa to normal PPAs has fixed my error maybe it will help you
jasperro
Newbie
Newbie
Posts: 1
Joined: Mon Mar 29, 2021 5:30 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by jasperro »

Hey, I fixed this issue on Arch Linux with my ATI HD5770 card by adding

Code: Select all

MESA_GL_VERSION_OVERRIDE=4.5
to the file ~/.pam_environment (create if does not exist), logging out, and logging back in again. You can also just try the fix temporarily by running

Code: Select all

export MESA_GL_VERSION_OVERRIDE=4.5
before running a game from the terminal. I hope it helped :).
spoon0042
Level 6
Level 6
Posts: 566
Joined: Thu Dec 24, 2009 11:00 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by spoon0042 »

fyi I assume this is the same bug as https://bugs.winehq.org/show_bug.cgi?id=50859
lfom
Newbie
Newbie
Posts: 3
Joined: Wed Mar 31, 2021 3:00 pm

Re: OpenGL does not initialize - GLXBadFBConfig

Post by lfom »

Using the override version does prevent the error (and the app/game starts up normally), but it breaks Chrome and Electron apps (at least on Pop!_OS 20.10, like Ubuntu 20.10). MESA was updated recently to 21.0 as well as the kernel to 5.11, and it broke WINE apps that use OpenGL. My GPU is also an old AMD 6770, and the default OpenGL version reported by glxinfo is 3.1 so maybe overriding it with 4.5 is not a good idea.
The error happens where with the builtin version 5.0 but also with newer ones from PlayOnLinux.
eusouobn
Newbie
Newbie
Posts: 1
Joined: Tue Apr 06, 2021 7:15 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by eusouobn »

jasperro wrote: Mon Mar 29, 2021 5:37 am Hey, I fixed this issue on Arch Linux with my ATI HD5770 card by adding

Code: Select all

MESA_GL_VERSION_OVERRIDE=4.5
to the file ~/.pam_environment (create if does not exist), logging out, and logging back in again. You can also just try the fix temporarily by running

Code: Select all

export MESA_GL_VERSION_OVERRIDE=4.5
before running a game from the terminal. I hope it helped :).
You are a Savior of Souls my friend, thank you very much
mlytle0
Level 2
Level 2
Posts: 21
Joined: Sat Apr 17, 2021 5:53 pm

Re: OpenGL does not initialize - GLXBadFBConfig

Post by mlytle0 »

There is someone working on this, but it looks like it will take co-operation from the Wine side and the Mesa side, which may or may not not be happening.

https://gitlab.freedesktop.org/mesa/mesa/-/issues/3969
luca92
Level 3
Level 3
Posts: 55
Joined: Thu Jan 23, 2014 5:44 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by luca92 »

hello,
i have same problem: after ArchLinux system update, RosettaStone won't start anymore :|

Code: Select all

$ wine .wine/drive_c/Program\ Files\ \(x86\)/Rosetta\ Stone/Rosetta\ Stone\ Version\ 3/RosettaStoneVersion3.exe 
MESA-INTEL: warning: Bay Trail Vulkan support is incomplete
X Error of failed request:  GLXBadFBConfig
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  0 ()
  Serial number of failed request:  361
  Current serial number in output stream:  361
Before system update it worked perfectly.

Code: Select all

$ glxinfo | grep OpenGL
OpenGL vendor string: Intel Open Source Technology Center
OpenGL renderer string: Mesa DRI Intel(R) HD Graphics (BYT)
OpenGL core profile version string: 4.2 (Core Profile) Mesa 21.0.3
OpenGL core profile shading language version string: 4.20
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.0 Mesa 21.0.3
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.0.3
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:
How can i solve?

EDIT:
i SOLVED:

Code: Select all

export MESA_GL_VERSION_OVERRIDE=4.5
Spade
Newbie
Newbie
Posts: 1
Joined: Thu Sep 23, 2021 5:53 pm

Re: OpenGL does not initialize - GLXBadFBConfig

Post by Spade »

jasperro wrote: Mon Mar 29, 2021 5:37 am Hey, I fixed this issue on Arch Linux with my ATI HD5770 card by adding

Code: Select all

MESA_GL_VERSION_OVERRIDE=4.5
to the file ~/.pam_environment (create if does not exist), logging out, and logging back in again. You can also just try the fix temporarily by running

Code: Select all

export MESA_GL_VERSION_OVERRIDE=4.5
before running a game from the terminal. I hope it helped :).
hey sorry to bother you so I'm new to this and can barley use the basic commands I tried the temporary one and it worked but can you please explain the first solution like you would to a grandma?
RobertX
Level 2
Level 2
Posts: 40
Joined: Thu Sep 09, 2021 9:57 pm

Re: OpenGL does not initialize - GLXBadFBConfig

Post by RobertX »

Does this work if I run the game from the menu and not the terminal?

EDIT: I am using Linux Mint 20.2 by the way.
invisible kid
Level 5
Level 5
Posts: 352
Joined: Tue Dec 24, 2019 3:23 pm

Re: OpenGL does not initialize - GLXBadFBConfig

Post by invisible kid »

I can give a little of the nuts and bolts.

For the ~/.pam_environment changes. There are various configuration files checked by various programs. The most common one in linux is .bashrc. So some program is checking the ~/.pam_environment file and setting some settings using that.

This is for the next question.
You can also impact it by setting environment variables. If you do a

Code: Select all

env
It will list all active environment variables. Any program you launch from this xterm will use those environment variables. The three basic ways to set an enviromnent variable are:

1. Temporarily, just used by the program:
VARIABLE=VALUE <program>
PKG_CONFIG_PATH=/usr/lib32/pkgconfig ../configure

2. Temporarily, while shell is active:
export PKG_CONFIG_PATH=/usr/lib32/pkgconfig

3. "Permanently:"
add command from step 2 into your .bashrc file, log out and every subsequent login it will apply

So it it seems changing the ~/.pam_environment should work when you launch programs from a menu, but try logging out and logging in first. If it didn't work you can add the line to your .bashrc, log out and in and you should be good to go automatically.
RobertX
Level 2
Level 2
Posts: 40
Joined: Thu Sep 09, 2021 9:57 pm

Re: OpenGL does not initialize - GLXBadFBConfig

Post by RobertX »

OK, old habits die hard.

I stuck with the habit of asking first and looking it up later.

I later read that for a permanent (real permanent) addition that will affect future accounts, you would have to create an SH file in /etc/profile.d/ and type in the following:

Code: Select all

export MESA_GL_VERSION_OVERRIDE=4.5
I'm kind of experiencing Deja-Vu right now, I must have said something about this in the past, but just realised the solution right now. Never mind.

Thanks for the solutions and I will help out my friends.
Nonononoki
Newbie
Newbie
Posts: 2
Joined: Tue Dec 07, 2021 6:10 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by Nonononoki »

My friend's old PC has a Radeon HD5700 GPU and I encountered the exact problem, which was fixed with setting MESA_GL_VERSION_OVERRIDE=4.5 globally. Now Chrome won't run, is there a way to specify the version to 3.1 for Chrome only?
jkfloris
Level 12
Level 12
Posts: 3136
Joined: Thu Aug 14, 2014 10:10 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by jkfloris »

fixed with setting MESA_GL_VERSION_OVERRIDE=4.5 globally.
Remove the global environment variabele and only start programs with wine with:

Code: Select all

MESA_GL_VERSION_OVERRIDE=4.5 wine program.exe
Nonononoki
Newbie
Newbie
Posts: 2
Joined: Tue Dec 07, 2021 6:10 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by Nonononoki »

jkfloris wrote: Tue Dec 07, 2021 9:26 am
fixed with setting MESA_GL_VERSION_OVERRIDE=4.5 globally.
Remove the global environment variabele and only start programs with wine with:

Code: Select all

MESA_GL_VERSION_OVERRIDE=4.5 wine program.exe
Not a real solution for non tech-savvy users
jkfloris
Level 12
Level 12
Posts: 3136
Joined: Thu Aug 14, 2014 10:10 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by jkfloris »

If you use a .desktop file to start the program with Wine, you can modify the .desktop file.
Add the variabele to the Exec= line. Something like:

Code: Select all

Exec=env MESA_GL_VERSION_OVERRIDE=4.5 WINEPREFIX=... wine start ...
Cossack_Leo
Newbie
Newbie
Posts: 1
Joined: Fri Dec 31, 2021 7:53 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by Cossack_Leo »

jasperro wrote: Mon Mar 29, 2021 5:37 am Hey, I fixed this issue on Arch Linux with my ATI HD5770 card by adding

Code: Select all

MESA_GL_VERSION_OVERRIDE=4.5
to the file ~/.pam_environment (create if does not exist), logging out, and logging back in again. You can also just try the fix temporarily by running

Code: Select all

export MESA_GL_VERSION_OVERRIDE=4.5
before running a game from the terminal. I hope it helped :).
Ok where do I do what?
I am a total Linux noob and don't understand anything
Can anyone make a point for point tutorial for me cuz my head hurts and I just want to play TFT on my old laptop as an prove of concept before migrating my new pc to Ubuntu
FizziPop22
Newbie
Newbie
Posts: 1
Joined: Sun Jan 02, 2022 5:16 pm

Re: OpenGL does not initialize - GLXBadFBConfig

Post by FizziPop22 »

jkfloris wrote: Wed Dec 08, 2021 11:38 am If you use a .desktop file to start the program with Wine, you can modify the .desktop file.
Add the variabele to the Exec= line. Something like:

Code: Select all

Exec=env MESA_GL_VERSION_OVERRIDE=4.5 WINEPREFIX=... wine start ...

Got a problem here. Using Elementary OS 6. If I run the MESA command from Terminal and then launch my program (trying to run Ableton Live 11), it launches. However it’s hit or miss. Sometimes it will launch and sometimes the logo will appear for 10 seconds and disappear, it launches and sometimes it doesn’t. If I launch from terminal without the MESA command I’ll get the OpenGL error. If I launch with the MESA command sometimes it will launch. But if I add the line to the .desktop file it won’t launch at all. Any ideas?
jkfloris
Level 12
Level 12
Posts: 3136
Joined: Thu Aug 14, 2014 10:10 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by jkfloris »

Can you post a terminal output when the application doesn't start with the MESA command?
abb
Newbie
Newbie
Posts: 1
Joined: Mon Jan 31, 2022 11:12 am

Re: OpenGL does not initialize - GLXBadFBConfig

Post by abb »

I solved this problem by building MESA with i965 video card support disabled. It was turned on to get rid of warnings of missing drivers with every GUI app (my GPU driver is i915). MESA_GL_VERSION_OVERRIDE=4.5 was giving me an empty black window.
Locked