unity on linux

2024-08-03
It's terrible. Sometimes it works, sometimes not.

I got a flash of inspiration to make some shader art for ChilloutVR. I have done this a bunch before, but not in almost a year now. I found out why.

Unity 2021.3.23f1 is the recommended version for the ChilloutVR CCK (Content Creation Kit), so that's what I tried to use. It was getting about halfway through the asset loading before just freezing until I killed it. Looking in the logs revealed that the last thing it did was call bee_backend

I found this forum post with the exact same issue and a workaround! This is quite rare. I added the script as instructed and the issue changed, wohoo...

It was still crashing every time, but now because of a segmentation fault (SIGSEGV).
Sometimes it would produce a stack trace after, saying that the editor died while trying to change graphics tier.

Caught fatal signal - signo:11 code:1 errno:0 addr:(nil)
Obtained 6 stack frames.
#0  0x007afe7cd5d1d0 in __sigaction
#1  0x0059982af74663 in OnGraphicsTierSwitched()
#2  0x0059982bd49070 in ApplyBuildTargetSwitchInternal(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#3  0x0059982bd4844b in SwitchActiveBuildTargetForEmulation(BuildTargetPlatformGroup, BuildTargetPlatform, int, bool, bool)
#4  0x005998296f6a73 in EditorUserBuildSettings_CUSTOM_SwitchActiveBuildTargetAndSubtarget(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#5  0x00000041703f61 in (wrapper managed-to-native) UnityEditor.EditorUserBuildSettings:SwitchActiveBuildTargetAndSubtarget (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int)
Launching bug reporter

(the bug reporter did not launch most of the time)

So I updated unity to 2021.3.41f1, since it's LTS it should still be compatible with the CCK.
I had to apply the bee_backend fix again
The only change was that the stack traces were deeper, revealing the real source of the issue:

Obtained 12 stack frames.
#0  0x007e9b1f75d1d0 in __sigaction
#1  0x0059b44681c233 in OnGraphicsTierSwitched()
#2  0x0059b4474b29f0 in ApplyBuildTargetSwitchInternal(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#3  0x0059b4474b1dcb in SwitchActiveBuildTargetForEmulation(BuildTargetPlatformGroup, BuildTargetPlatform, int, bool, bool)
#4  0x0059b444e61693 in EditorUserBuildSettings_CUSTOM_SwitchActiveBuildTargetAndSubtarget(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#5  0x000000414635f0 in (wrapper managed-to-native) UnityEditor.EditorUserBuildSettings:SwitchActiveBuildTargetAndSubtarget (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int)
#6  0x00000041463407 in UnityEditor.EditorUserBuildSettings:SwitchActiveBuildTarget (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget)
#7  0x0000004145d96f in CCK_Init:.cctor ()
#8  0x0000004145dc7e in (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
#9  0x0000004116eef5 in (wrapper managed-to-native) System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (intptr)
#10 0x0000004116ee47 in System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (System.RuntimeTypeHandle)
#11 0x0000004116e753 in UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])
#12 0x00000041128805 in (wrapper runtime-invoke) :runtime_invoke_void_object (object,intptr,intptr,intptr)
Launching bug reporter

CCK_Init:.cctor (), the CCK init constructor.

That's just a c# script. I can edit those.
I deleted the whole constructor, and now unity launches, incredible.
Obviously it is there for a reason though, but luckily there was a much newer version of the CCK (3.10 instead of 3.5), and after installing that, the editor still seems to be working correctly.

I wasted like an hour fixing this, and my inspiration is long gone, but at least I can make something next time.

The reason I hadn't done anything since september was that i had to update to unity 2021 from unity 2019, and it didn't work on linux. I did some stuff in my windows VM but ultimately it's too annoying to work in so it put me off content creation until now.

Even though chillout caused the crash, I'm pretty sure this is unity's fault. The linux editor has always been flaky and I feel like a user c# script shouldn't cause segfaults in the editor that easily.

back home