Today in the category of games not working after installing on Linux: Spacechem. 🙂

Just installed Spacechem from GOG on my Ubuntu 16.04 after seeing the 75% discount on the game I’ve been wanting to buy for a while.

Of course, it failed to run after installing. It is a game for Linux after all. So I checked what’s wrong.

Bash shell session where I run Spacechem's ./start.sh and it fails on a SerializationException

Unhandled Exception: System.Runtime.Serialization.SerializationException: Type Newtonsoft.Json.JsonReaderException is not marked as Serializable. (Massive stacktrace and exception rethrowing follows)

Uhoh, I’m used to errors with shared libraries. This seems like a very specific .NET error. Slight fear follows that this will not be easy to fix. Still hopeful though, I check out the startup shell script. start.sh basically starts game/spacechem-launcher.sh so I check it out. It’s a tiny shell script:

#!/bin/sh
MONO_CFG_DIR=etc MONO_PATH=monolib ./mono SpaceChem.exe

alright, looks like a local version of mono (the cross-platform .NET interpreter). Let’s see what version it’s at:

~/Games/Spacechem/game$ ./mono --version
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  x86
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            Included Boehm (with typed GC and Parallel Mark)

Hm. What version do I have installed?

~/Games/Spacechem/game$ mono --version
Mono JIT compiler version 4.2.1 (Debian 4.2.1.102+dfsg2-7ubuntu4)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    LLVM:          supported, not enabled.
    GC:            sgen

Well that’s quite a difference, isn’t it? I try to manually run mono SpaceChem.exe and it turns out it just works! I haven’t tried it completely but I was at least able to complete the tutorial without any further errors. That was easy!

Spacechem starting after running mono Spacechem.exe

I fixed the launcher by commenting out the original line and making it simply use the system’s mono:

#!/bin/sh
#MONO_CFG_DIR=etc MONO_PATH=monolib ./mono SpaceChem.exe
mono SpaceChem.exe

To fix this on your machine, you’ll probably have to install mono manually first with sudo apt install mono

Maybe some day games bought for Linux will just work. For now, at least there’s manual fixes.

Oh, and happy Christmas and a happy 2018! 🎅