Help debugging a crash in Cura

I’ve been using my a311d pocket reform to 3d print things. Lately I haven’t been able to: Cura crashes as soon as I click “slice” after loading a model. I believe the relevant parts in the logs are:

ESC[35m2025-03-05 21:13:07,043ESC[0m - ESC[31mERRORESC[0m - ESC[37m[MainThread] UM.View.GL.OpenGLContext.setContext [40]: Failed creating OpenGL context (4, 1, core=True)ESC[0m
ESC[35m2025-03-05 21:13:07,043ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.OpenGLContext.detectBestOpenGLVersion [188]: Failed to create OpenGL context 4.1.ESC[0m
ESC[35m2025-03-05 21:13:07,043ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.OpenGLContext.detectBestOpenGLVersion [191]: Trying OpenGL context 2.0...ESC[0m
ESC[35m2025-03-05 21:13:07,043ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.OpenGLContext.detectBestOpenGLVersion [198]: We got at least OpenGL context 2.0: 3.1 No profileESC[0m
[...]
ESC[35m2025-03-05 21:13:50,262ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.Scene.Camera._preferencesChanged [255]: Changing perspective mode to perspect
ive.ESC[0m
ESC[35m2025-03-05 21:13:50,269ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.ShaderProgram.load [61]: Loading [/usr/share/cura/resources/shaders/o
verhang.shader]...ESC[0m
ESC[35m2025-03-05 21:13:50,276ESC[0m - ESC[31mERRORESC[0m - ESC[37m[MainThread] UM.View.GL.ShaderProgram.setVertexShader [134]: Vertex shader failed to compile:
 ESC[0m
QOpenGLShaderProgram::uniformLocation(u_overhangAngle): shader program is not linked
QOpenGLShaderProgram::uniformLocation(u_ambientColor): shader program is not linked
QOpenGLShaderProgram::uniformLocation(u_specularColor): shader program is not linked
QOpenGLShaderProgram::uniformLocation(u_shininess): shader program is not linked
QOpenGLShaderProgram::uniformLocation(u_renderError): shader program is not linked
QOpenGLShaderProgram::uniformLocation(u_faceId): shader program is not linked
ESC[35m2025-03-05 21:13:50,278ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.ShaderProgram.load [61]: Loading [/usr/share/cura/resources/shaders/t
ransparent_object.shader]...ESC[0m
ESC[35m2025-03-05 21:13:50,283ESC[0m - ESC[31mERRORESC[0m - ESC[37m[MainThread] UM.View.GL.ShaderProgram.setVertexShader [134]: Vertex shader failed to compile:
 ESC[0m
QOpenGLShaderProgram::uniformLocation(u_diffuseColor): shader program is not linked
QOpenGLShaderProgram::uniformLocation(u_opacity): shader program is not linked
ESC[35m2025-03-05 21:13:50,285ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.ShaderProgram.load [61]: Loading [/usr/share/cura/resources/shaders/s
triped.shader]...ESC[0m
ESC[35m2025-03-05 21:13:50,292ESC[0m - ESC[31mERRORESC[0m - ESC[37m[MainThread] UM.View.GL.ShaderProgram.setVertexShader [134]: Vertex shader failed to compile:
 ESC[0m
QOpenGLShaderProgram::uniformLocation(u_vertical_stripes): shader program is not linked
QOpenGLShaderProgram::uniformLocation(u_width): shader program is not linked
Fatal Python error: Segmentation fault
[...]
Current thread 0x0000ffff964c7760 (most recent call first):
  File "/usr/lib/python3/dist-packages/UM/View/GL/FrameBufferObject.py", line 18 in __init__
  File "__init__", line ??? in __init__
  File "/usr/lib/python3/dist-packages/UM/View/GL/OpenGL.py", line 178 in createFrameBufferObject
  File "/usr/lib/python3/dist-packages/UM/View/RenderPass.py", line 161 in _updateRenderStorage
  File "/usr/lib/python3/dist-packages/UM/View/RenderPass.py", line 90 in bind
  File "/usr/lib/python3/dist-packages/cura/PreviewPass.py", line 125 in render
  File "/usr/lib/python3/dist-packages/cura/Snapshot.py", line 96 in snapshot
  File "/usr/lib/cura/plugins/CuraEngineBackend/CuraEngineBackend.py", line 271 in _createSnapshot
  File "/usr/lib/python3/dist-packages/cura/Utils/Threading.py", line 31 in _call_on_qt_thread_wrapper
  File "/usr/lib/cura/plugins/CuraEngineBackend/CuraEngineBackend.py", line 282 in slice
  File "/usr/lib/cura/plugins/CuraEngineBackend/CuraEngineBackend.py", line 261 in forceSlice
  File "/usr/lib/python3/dist-packages/UM/Qt/QtApplication.py", line 403 in exec
  File "/usr/lib/python3/dist-packages/cura/CuraApplication.py", line 879 in run
  File "/usr/bin/cura", line 238 in <module>

The facts:

  • I’m using cura 5.0.0 from the debian repositories; I’m not using the appimage (and can’t: there’s no official arm64 appimage)
  • I’m on wayland and sway.
  • I have a gcode file that I produced on my hard drive dated 2/26, so it was working then. I first noticed it was crashing around 3/4.
  • I’ve uninstalled and reinstalled cura since then, but per the logs none of the following packages have upgraded: cura (5.0.0-6), cura-engine (5.0.0-5), python3-uranium (5.0.0-7), or uranium-plugins (5.0.0-7), per my /var/log/apt/term.log
  • 2/26 was when I upgraded to mesa 25.0.0 for good, after the events of https://community.mnt.re/t/display-flickering-on-pocket-reform-related-to-mesa-25-0-0/. However, I’ve tried downgrading everything to 24.3.4-3, as in that thread, and the crash persists.

Here’s what I’ve tried:

  • Downgrading the mesa packages to 24.3.4-3 with sudo apt install libglx-mesa0=24.3.4-3 libgbm1=24.3.4-3 mesa-libgallium=24.3.4-3 libgl1-mesa-dri=24.3.4-3 libegl1-mesa-dev=24.3.4-3 libegl-mesa0=24.3.4-3
  • Deleting .config/cura and .local/share/cura
  • Doing both of the above
  • Uninstalling and reinstalling cura, and all of its dependencies.
  • Different 3d models, including ones I’ve previously generated gcode from.
  • Selecting Force layer view compatibility mode in Cura settings

It still crashes.

Here’s how I could use help:

Is anyone else seeing this crash on pocket reform, particularly on a311d?

Do you have ideas about how I can narrow down what changed? I would consider reporting a debian bug but it doesn’t seem correlated with a package update. I would follow up with cura communities but the debian package is very old. I feel like this is best suited here because it seems to be about, as best as I can see, OpenGL on a311d.

I can find similar errors (“shader program is not linked”) which often seem to be related to bugs in PyQT programs using OpenGL.

However, if you look at message #16 from this thread on launchpad you can see that in some cases the bug gets triggered by a bogus symlink to the wrong version of a shared library.

I wonder if when you installed or uninstalled Mesa 25.0.0 it left some broken libGL.so symlinks somewhere, or somehow got you into a situation where PyQT is having trouble linking the correct shared libraries. I might try to audit those and convince yourself that they look valid and are the correct versions.

(You could also try running a toy PyQT application with OpenGL to see if that also crashes. There was a small demo program linked from the same thread that might work.)

Good luck!

(Apologies if these suggestions aren’t useful. I don’t actually have my Reform yet so I can’t do any more concrete testing myself.)

1 Like

The cuprit seems to be “Vertex shader failed to compile”. Maybe they’re using GLSL features that need a higher GL/GLSL version than the fallback context they’re creating? Note that initially they want GL 4.1, and then fall back to 3.1.

Something you can try is raising the GL and GLSL versions with mesa env variables and pretend there’s more support than there actually is:

export MESA_GL_VERSION_OVERRIDE=3.3
export MESA_GLSL_VERSION_OVERRIDE=330

Or even (likely to fail):

export MESA_GL_VERSION_OVERRIDE=4.2
export MESA_GLSL_VERSION_OVERRIDE=420

(before launching Cura from the same terminal).

Weird twist: I downloaded the latest pocket reform a311d image from MNT gitlab, booted it, updated everything, installed cura, and rebooted into it, and it successfully slices / doesn’t crash. The version numbers look the same as what I see on my hard drive. The working version of cura logs the stuff about falling back to OpenGL 3.1, but not the shader program is not linked errors:

ESC[35m2025-03-07 19:05:57,967ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.OpenGLContext.detectBestOpenGLVersion [124]: Trying OpenGL context 4.1...ESC[0m
ESC[35m2025-03-07 19:05:57,967ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.OpenGLContext.detectBestOpenGLVersion [191]: Trying OpenGL context 2.0...ESC[0m
ESC[35m2025-03-07 19:05:57,967ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.View.GL.OpenGLContext.detectBestOpenGLVersion [198]: We got at least OpenGL context 2.0: 3.1 No profileESC[0m
ESC[35m2025-03-07 19:05:57,967ESC[0m - ESC[36mDEBUGESC[0m - ESC[37m[MainThread] UM.Qt.QtApplication.initialize [180]: Detected most suitable OpenGL context version: 2.0 No profileESC[0m

This was a good tip! But unfortunately no, all the GL-related shared objects it appears to be using seem to be valid and come from real packages, and I don’t have any related broken symlinks in /var. I’ll try and see if the sd card version is loading very different shared objects than the one on my hard drive.

Another good angle, but I found a different OpenGL PyQT6 demo and it works fine.

I don’t think this is the case, since this same version of cura was working before, and especially now that I know this same version of cura works on a different installation.

I’ll keep reading the logs, but it would still be helpful to know if anyone sees this crash on their a311d pocket reform, especially one that’s been upgraded over time organically.

1 Like

ah, if I force it to use xwayland with QT_QPA_PLATFORM=xcb it works fine. This is a great workaround for now.

I wonder if this is what it was using before, and maybe I pulled in something that prompted it to switch to wayland? or whether some wayland-specific GL thing is broken now?

I also noticed this at the beginning of the (crashing) log, which I think is the actual root cause:

QEGLPlatformContext: Failed to create context: 3009
1 Like