[1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
realitaetsverlust
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Sep 07, 2021 8:13 pm
Contact:

[1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Post by realitaetsverlust »

I'm using a Dell XPS which I used manjaro on for a long time, however, last saturday, I replaced it with a completely fresh installation of arch. While most of the games behave quite nicely (Rimworld, Dota Underlords, Crusader Kings 3), Factorio decides to be a bit of a diva. If I start the game normally, it works, however, if I start it via

Code: Select all

prime-run %command%
(which is necessary to make use of the dedicated GPU), it crashes.

I do not have any mods installed yet since it's a completely fresh install and I have yet to download them.

I don't get any error messages, but the factorio log says:

Code: Select all

$ cat factorio-current.log 
   0.000 2021-09-07 22:09:55; Factorio 1.1.39 (build 58937, linux64, steam)
   0.070 Operating system: Linux (Arch rolling)
   0.070 Program arguments: "/home/realitaetsverlust/.local/share/Steam/steamapps/common/Factorio/bin/x64/factorio" 
   0.070 Read data path: /home/realitaetsverlust/.local/share/Steam/steamapps/common/Factorio/data
   0.070 Write data path: /home/realitaetsverlust/.factorio [779362/927573MB]
   0.070 Binaries path: /home/realitaetsverlust/.local/share/Steam/steamapps/common/Factorio/bin
   0.074 System info: [CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz, 12 cores, RAM: 15638 MB]
   0.074 Environment: DISPLAY=:0.0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=xfce XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=XFCE __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.074 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
   0.582 Available displays: 1
   0.582  [0]: 0 - {[0,0], 3840x2160, SDL_PIXELFORMAT_RGB888, 60Hz}
   0.678 Error Util.cpp:83: Failed to create OpenGL context: Could not make GL context current: BadAlloc (insufficient resources for operation)
   0.679 Error MessageDialog.cpp:211: Unable to show message dialog. SDL Error: [No message system available]
   0.683 Steam API shutdown.
   0.688 Goodbye
Someone on discord advised me to edit the config in ~/.factorio/config and set

Code: Select all

force-opengl
to false, however, that didn't do anything.

User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1599
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: Game crash if using prime-run [1.1.39]

Post by jodokus31 »

realitaetsverlust wrote:
Tue Sep 07, 2021 8:23 pm
Someone on discord advised me to edit the config in ~/.factorio/config and set

Code: Select all

force-opengl
to false, however, that didn't do anything.
If i understood correctly, linux supports only opengl.

movax20h
Fast Inserter
Fast Inserter
Posts: 164
Joined: Fri Mar 08, 2019 7:07 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc"

Post by movax20h »

It should work, if not, some library paths might be being set incorrectly via environment variables, but weird that it works for you with other games in steam, but not Factorio.

I do not have nvidia or nvidia laptop, so you need to find somebody with similar setup that can help you more.

realitaetsverlust
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Sep 07, 2021 8:13 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc"

Post by realitaetsverlust »

Yeah, that is what confuses me as much. It works with literally every other game I have on my machine besides factorio. I'm also not quite sure what kind of "resource" it's expecting here, because I have more than enough RAM and storage, the SSD also only has a single filesystem partition so there's nothing going on here either, and the swap is sized at 32GB. What else could it be allocating? VRAM?

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc"

Post by Oxyd »

realitaetsverlust wrote:
Tue Sep 07, 2021 8:23 pm

Code: Select all

   0.679 Error MessageDialog.cpp:211: Unable to show message dialog. SDL Error: [No message system available]
I think this error is quite telling. It seems that Factorio can't talk to the rest of the windowing system to even display an error message box.

When you say you used Manjaro before, does that mean you used prime-run on it as well and it worked? My first suspicion here would be that you're indeed missing some libraries that Manjaro installed automatically for you but Arch didn't.

realitaetsverlust
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Sep 07, 2021 8:13 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc"

Post by realitaetsverlust »

Oxyd wrote:
Wed Sep 08, 2021 3:30 pm
realitaetsverlust wrote:
Tue Sep 07, 2021 8:23 pm

Code: Select all

   0.679 Error MessageDialog.cpp:211: Unable to show message dialog. SDL Error: [No message system available]
I think this error is quite telling. It seems that Factorio can't talk to the rest of the windowing system to even display an error message box.

When you say you used Manjaro before, does that mean you used prime-run on it as well and it worked? My first suspicion here would be that you're indeed missing some libraries that Manjaro installed automatically for you but Arch didn't.
Yes, I have always used prime-run on the laptop and it did work fine.

However, you said that Factorio can't talk to the rest of the windowing system. Since I installed arch, I usually stay on the shell (since I mostly use the laptop for work and I honestly don't need a desktop environment for that) and only start XFCE when I want to play games using

Code: Select all

startxfce4
. Maybe this isn't working properly with factorio?

If that's not the issue and it is a missing library, what would be the go-to way to figure that out?

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Post by Oxyd »

I don't honestly know, I have no experience with prime-run, sorry.

I would try the standalone version of Factorio to see if Steam somehow interferes – Steam is still 32-bit and Factorio is 64, so that could potentially cause issues.

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Post by posila »

The error message (BadAlloc) comes from glXMakeCurrent()... so glXCreateContext() succeeds, but when SDL tries to set the created context as current context, that errs. Just throwing info out there, in case it's gonna help somehow

realitaetsverlust
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Sep 07, 2021 8:13 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Post by realitaetsverlust »

I did try the demo version, however, the error message looks a bit different, but is essentially the same. The "No message system available" is missing and the bad alloc is worded a bit differently:

Code: Select all

$ prime-run ./factorio 
   0.000 2021-09-10 09:16:00; Factorio 1.1.39 (build 58937, linux64, demo)
   0.003 Operating system: Linux (Arch rolling)
   0.003 Program arguments: "./factorio" 
   0.003 Read data path: /home/realitaetsverlust/Downloads/factorio/data
   0.003 Write data path: /home/realitaetsverlust/Downloads/factorio [750025/927573MB]
   0.003 Binaries path: /home/realitaetsverlust/Downloads/factorio/bin
   0.007 System info: [CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz, 12 cores, RAM: 15638 MB]
   0.007 Environment: DISPLAY=:0.0 WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=xfce XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=XFCE __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.007 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  0
  Current serial number in output stream:  97
Maybe I'm missing some environment variables? There is a bit of "unset" stuff in there ... could someone post his early startup process so I can compare the two? Preferably someone who also uses XFCE.

User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1599
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Post by jodokus31 »

I use Arch-based and XFCE4 but not prime-run
You could compare to your own log without prime-run?

Anyway, here it is

Be aware, that I call this before, because i imagine a bit better graphic experience

Code: Select all

export __GL_SYNC_TO_VBLANK=0
export __GL_FSAA_MODE=11
export __GL_LOG_MAX_ANISO=4
Attachments
factorio-current.log
(6.29 KiB) Downloaded 88 times

realitaetsverlust
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Sep 07, 2021 8:13 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Post by realitaetsverlust »

I could do that if I was smart enough to think of something that simple. :D

Anyways, I really can't see anything that is different ... especially when comparing it with my own startup without prime-run, the env vars are exactly the same, so I doubt it's because of them.

I'm fairly sure that prime-run, for some reason, doesn't recognize my monitor. In your as well as my own log without prime-run I found something like this:

Code: Select all

   0.014 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
   0.059 Available displays: 1
   0.059  [0]: 0 - {[0,0], 3840x2160, SDL_PIXELFORMAT_RGB888, 60Hz}
   0.113 Initialised OpenGL:[0] Mesa Intel(R) UHD Graphics 630 (CFL GT2); driver: 4.6 (Core Profile) Mesa 21.2.1
   0.113   [Extensions] s3tc:yes; KHR_debug:yes; ARB_clear_texture:yes, ARB_copy_image:yes
   0.113   [Version] 4.6
If I run it with prime-run, the entire block after display options doesn't appear. Instead, it immediately throws the bad alloc error after the display options.

Code: Select all

0.007 Display options: [FullScreen: 1] [VSync: 1] [UIScale: automatic (100.0%)] [Native DPI: 1] [Screen: 255] [Special: lmw] [Lang: en]
X Error of failed request:  BadAlloc (insufficient resources for operation)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  0
  Current serial number in output stream:  97
So that makes me wonder if the dedicated GPU simply doesn't recognize my monitor, which would explain the SDL error as posila has mentioned. However, I'm also fairly clueless why this is the case, only happens with factorio and how to fix it, but I guess that's not the problem of you nice people here. :)

If, by any chance, anyone knows how to fix it, feel free to tell me, otherwise I'll play around myself and post an update when I - eventually - be able to fix it. Thanks for your input so far, it really helped me a lot in narrowing down the issue!

realitaetsverlust
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Sep 07, 2021 8:13 pm
Contact:

Re: [1.1.39] Error using prime-run: "Could not make GL context current: BadAlloc" (Arch Linux)

Post by realitaetsverlust »

Hello, it's me again, after 3 long weeks. I asked a question in the arch linux forums and the people there had a solution for me.

Apparently, it was a problem with the window compositor. Basically, what I had to do was executing "pacman -R xf86-video-intel". This removes the intel driver for the iGPU and replaces it with the default one.

Also, you should make sure that window compositing is enabled. If you use XFCE, you can do this under Menu > Settings > Window Manager Tweaks > Compositor.

I'll leave the link to the thread here. Maybe it helps someone in the future :)

https://bbs.archlinux.org/viewtopic.php ... 8#p1994868

Post Reply

Return to “Technical Help”