Community Packages

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#62133 - [cura] Segfault when entering preview mode.

Attached to Project: Community Packages
Opened by Johannes E (JohannesE) - Monday, 25 March 2019, 06:47 GMT
Last edited by Balló György (City-busz) - Thursday, 28 March 2019, 19:30 GMT
Task Type Bug Report
Category Packages
Status Assigned
Assigned To Jelle van der Waa (jelly)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 14
Private No


Cura crashes when entering preview mode. This does not happen when using the upstream AppImage.

Additional info:
* package version(s): cura 4.0.0-1

* config and/or log files etc:
2019-03-25 07:44:13,101 - DEBUG - [MainThread] UM.Controller.setActiveStage [159]: Setting active stage to PreviewStage
2019-03-25 07:44:13,113 - DEBUG - [MainThread] UM.Controller.setActiveView [92]: Setting active view to SimulationView
2019-03-25 07:44:13,114 - INFO - [MainThread] STLReader.STLReader.load_file [54]: Using legacy code to load STL data.
2019-03-25 07:44:13,151 - DEBUG - [MainThread] UM.Mesh.MeshData.calculateNormalsFromVertices [444]: Calculating normals took 0.0008141994476318359 seconds
2019-03-25 07:44:13,164 - DEBUG - [MainThread] UM.Mesh.MeshData.approximateConvexHull [401]: approximateConvexHull(target_count=1024) Calculating 3D convex hull took 0.011868715286254883 seconds. 351 input vertices. 351 output vertices.
2019-03-25 07:44:13,165 - DEBUG - [MainThread] STLReader.STLReader._read [97]: Loaded a mesh with 12612 vertices
2019-03-25 07:44:13,168 - DEBUG - [MainThread] UM.View.GL.ShaderProgram.load [55]: Loading shader file [/lib/cura/plugins/SimulationView/simulationview_composite.shader]...
[1] 18632 segmentation fault (core dumped) cura

* link to upstream bug report, if any

Steps to reproduce:
Open cura, load an STL-file, click slice, click preview.
This task depends upon

Comment by Danilo Luvizotto (traysh) - Saturday, 20 April 2019, 11:16 GMT
This bug makes cura unusable, why is it low priority?
Comment by Jelle van der Waa (jelly) - Saturday, 20 April 2019, 12:44 GMT
I've tried to reproduce it on intel graphics but alas I couldn't. Have you moved your cura config dir?
Comment by Moabit (Moabit) - Sunday, 28 April 2019, 00:52 GMT
Cura is also unusable for me. @jelly what do you mean by "moved your cura config dir"?
Comment by Niklas (Niklas) - Friday, 03 May 2019, 19:57 GMT
Deleting the config dir does not solve the issue. According to the developers Cura is currently incompatible with Qt 5.12. Therefore, the package should be downgraded to the old version. Most users can't use this at all. Should not be part of the official repositories then. It works if you run Cura as root, but not sure if anything can be done on the package side to fix it.
Comment by Jelle van der Waa (jelly) - Saturday, 04 May 2019, 09:56 GMT
Again, for me it works and this seems to be related to Qt themes? Do you run Cura under Gnome or KDE? I'm running it under i3 and everything seems fine.
Comment by Moabit (Moabit) - Sunday, 05 May 2019, 00:54 GMT
FWIW its failing for me in KDE
Comment by Gonçalo Santos (weirdNox) - Monday, 06 May 2019, 11:51 GMT
I also have the problem when running in KDE. After some trial and error, I found that running it with "env -u DESKTOP_SESSION -u KDE_FULL_SESSION -u XDG_CURRENT_DESKTOP cura" works fine.
Comment by Moabit (Moabit) - Monday, 06 May 2019, 11:58 GMT
Thank you @weirdNox! I can confirm this solves the issue for me as well.
Comment by Charles (plut0nium) - Thursday, 09 May 2019, 07:58 GMT
I confirm that the solution from @weirdNox solves the issue...
It also solves some UI glitches I had, only drawback is that I loose the KDE file selection dialog.
Comment by Moabit (Moabit) - Saturday, 01 June 2019, 07:59 GMT
As an update, although @weirdNox's setting allows me to see the preview, the UI is unusable in some cases. For example, all the icons of the quick settings pane have disappeared. So if I change a setting, there is no tick in the checkbox, nor the "revert" icon.
Comment by Guillaume Pujol (PiC0) - Wednesday, 10 July 2019, 08:43 GMT
On cura 4.1, "env -u DESKTOP_SESSION -u KDE_FULL_SESSION -u XDG_CURRENT_DESKTOP cura" actually produces the segfault right after application startup.
Comment by Moabit (Moabit) - Monday, 22 July 2019, 06:31 GMT
Ugh, yes, the workaround doesn't work any more. FWIW I also tried downgrading back to {cura,cura-binary-data,cura-resources-materials,curaengine} 4.0, but cura still immediately segfaults.

I suspect it's another bug that is unrelated to this current bug. i.e.

EDIT: so oddly enough, while the KDE version crashes on preview, somehow it protects against the linked bug.
EDIT2: follow the Arch task link for the fix. After this, the `env` fix works again.
EDIT3: the updated version of uranium incorporates this fix for the linked bug. FWIW the newer versions of cura (4.1.0-2 and 4.2.0-1) still exhibit the bug described on this page.
Comment by Guillaume Pujol (PiC0) - Friday, 09 August 2019, 09:43 GMT
cura-4.2.1-1 (currently on testing) indeed fixes the "crash on startup", but still has the "crash on preview". To workaround it, you may apply this patch to /bin/cura (work for cura-4.2.1-1, but should work for any version). This way you don't need to use the "env" based fix anymore and can run cura from the menu/shortcut/file association etc.

--- /tmp/cura.old 2019-08-09 10:45:18.382853186 +0200
+++ /bin/cura 2019-08-09 10:48:56.933820151 +0200
@@ -53,6 +53,11 @@
# GLES-only systems (e.g. ARM Mali) do not have libGL, ignore error

+ os.environ.pop("DESKTOP_SESSION", None)
+ os.environ.pop("KDE_FULL_SESSION", None)
+ os.environ.pop("XDG_CURRENT_DESKTOP", None)
# When frozen, i.e. installer version, don't let PYTHONPATH mess up the search path for DLLs.
if Platform.isWindows() and hasattr(sys, "frozen"):
Comment by Moabit (Moabit) - Friday, 09 August 2019, 10:27 GMT
@PiC0 For me at least, the fix was actually in uranium, not cura.

Also, I tried your patch, but cura does not launch, with the following error:

Traceback (most recent call last):
File "/usr/bin/cura", line 57, in <module>
del os.environ["DESKTOP_SESSION"]
File "/usr/lib/python3.7/", line 694, in __delitem__
raise KeyError(key) from None
Comment by Guillaume Pujol (PiC0) - Saturday, 10 August 2019, 07:39 GMT
@Moabit: Updated the patch above. Are you using KDE or some other DE ?
Comment by Moabit (Moabit) - Saturday, 10 August 2019, 08:49 GMT
@PiC0 That works perfectly now. Thank you! (I'm using KDE.)

Also, I can report that now with either this or the env workarounds, the issues I reported above with the buggy UI [a] are not longer a problem. Is this workaround possibly worth reporting upstream [b]?

Comment by Sedeer el-Showk (sedeer) - Wednesday, 08 January 2020, 09:25 GMT
I was having the same problems (buggy/unusable UI and crash-on-preview) with Cura 4.4.0 on KDE. The fix by @PiC0 fixed it, and Cura is working fine now.

Since it seems like this isn't being addressed upstream, maybe the patch could be incorporated into the package for now? At the moment, the Cura package isn't really usable on a basic KDE/Breeze setup.
Comment by Jelle van der Waa (jelly) - Sunday, 12 January 2020, 16:54 GMT
Is this still an issue with KDE, then I'll happily apply the patches in our package.
Comment by Niklas (Niklas) - Sunday, 12 January 2020, 17:02 GMT
Yes, still an issue. I can confirm that the fix by PiC0 is working. Cura does not need to apply KDE/Qt colour themes anyway, they have their own specific theme.
Comment by Moabit (Moabit) - Sunday, 12 January 2020, 23:28 GMT
I can also confirm that it's still an issue with KDE (buggy UI and preview crashing) and PiCO's patch fixes it for me.
Comment by Maarten Bezemer (veger) - Saturday, 16 May 2020, 18:15 GMT
Few months later, I can confirm that cura v4.6.1 still has the issue (I updated the package version locally to see if the issue got fixed), and that the patch still fixes the issue
Comment by Moabit (Moabit) - Sunday, 17 May 2020, 00:49 GMT
Yep, same here. FWIW upstream officially has this as "won't fix", because they want you to use their AppImage [a]. There is also a pending pull request that doesn't entirely work [b]. This fix here is mentioned in the comments, but there is no response from upstream, and no movement on the PR. IMO we should just patch Cura for Arch. There is no indication of any official support, and it's been broken for 14 months now.

Comment by Moabit (Moabit) - Saturday, 01 August 2020, 03:48 GMT
cura 4.6.2-1 still unusable. @PiC0's patch still works. Still no movement upstream.