Arch Linux Crash on Dedicated Server Start

PiGuy9614

Terrarian
Steam or GOG
Steam
Single Player/Multiplayer
Multi
Operating System
Linux Other
Terraria Version
1.4.0.4
Controls Used
Keyboard/Mouse
Because of variable conflicts, "TERM" must equal "XTERM" for the game to start. Subsequently, putting the line "TERM=XTERM" in the beginning of the TerrariaServer bash script fixes it. Issue may be also be seen in the actual client-side of the game as well in Arch Linux, but I personally haven't seen it occur, as only my server runs Arch Linux. The log is shown below.



System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x0002b] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x00065] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.TermInfoDriver..ctor (System.String term) [0x00058] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.ConsoleDriver..cctor () [0x00062] in <1170fb08300b4d0db71c1d1db8555768>:0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x0000a] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.Console..cctor () [0x000a8] in <1170fb08300b4d0db71c1d1db8555768>:0
--- End of inner exception stack trace ---
at Terraria.Utilities.CrashWatcher.Inititialize () [0x00000] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
at Terraria.Program.SetupLogging () [0x0007d] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
at Terraria.Program.LaunchGame (System.String[] args, System.Boolean monoArgs) [0x0006c] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
at Terraria.LinuxLaunch.Main (System.String[] args) [0x00038] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x0002b] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.TermInfoReader..ctor (System.String term, System.String filename) [0x00065] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.TermInfoDriver..ctor (System.String term) [0x00058] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.ConsoleDriver..cctor () [0x00062] in <1170fb08300b4d0db71c1d1db8555768>:0
--- End of inner exception stack trace ---
at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x0000a] in <1170fb08300b4d0db71c1d1db8555768>:0
at System.Console..cctor () [0x000a8] in <1170fb08300b4d0db71c1d1db8555768>:0
--- End of inner exception stack trace ---
at Terraria.Utilities.CrashWatcher.Inititialize () [0x00000] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
at Terraria.Program.SetupLogging () [0x0007d] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
at Terraria.Program.LaunchGame (System.String[] args, System.Boolean monoArgs) [0x0006c] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
at Terraria.LinuxLaunch.Main (System.String[] args) [0x00038] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
 
@PiGuy9614
I think this affects any modern Linux distribution now, so I suggest removing "Arch" from the title. For the record, I've ran into this on Fedora 30/31 and 32.

N.B. the same (both error and workaround) applies to running the client as well. (Terraria.bin.x86_64)

@"devs"
I was hoping this to go away by updating and linking newer mono libraries (that are 256-color-term aware), so I'm guessing Linux binarys are still being built using old library/build environment then. Hope we can get some feedback to why?
 
Last edited:
To be clear, you're getting this when you run the bash scripts to start the server?
What happens if you run the server directly from the terminal?
 
To be clear, you're getting this when you run the bash scripts to start the server?
What happens if you run the server directly from the terminal?

The underlying issue is that the game goes bonkers and crashes with newer TERM settings. So it can and usually do happen regardless of using the wrapping script or not, (unless you edit it to set a compatible 'xterm' in it like I've done).

You can easily predict if it will crash if you look at the output from echo $TERM
(mine is xterm-256color)

If you are not affected by the bug, but want to trigger it for troubleshooting on a regular terminal, I suppose you could try TERM=xterm-256color ./TerrariaServer.bin.x86_64

Some additional source: Mono Bug : Magic number is wrong: 542
Oh, and this will likely go away if Terraria is built using new mono libs. (I'm suspecting ancient ubuntu 14.04 build environment)
 
Last edited:
I'm not hugely experienced with mono myself, so do fill me in if I'm doing something wrong or have misunderstood - you seem to be running TerrariaServer.bin.x86_64 on your machine.
On my linux installation (linux mint) I've been running the server fine with a different command - mono TerrariaServer.exe. Does this help in any way?
 
I'm not hugely experienced with mono myself, so do fill me in if I'm doing something wrong or have misunderstood - you seem to be running TerrariaServer.bin.x86_64 on your machine.
On my linux installation (linux mint) I've been running the server fine with a different command - mono TerrariaServer.exe. Does this help in any way?


I tried running it as you described and received the following error:


Code:
When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.
Server crash: 5/21/2020 4:24:37 PM
System.MissingMethodException: Method not found: int System.Collections.HashHelpers.GetMinPrime()
  at System.Collections.Generic.HashSet`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00007] in <5f01f5aacbb346938d6f9b4e69d4383a>:0
  at Terraria.RecipeGroup..ctor (System.Func`1[TResult] getName, System.Int32[] validItems) [0x0000d] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Recipe.SetupRecipeGroups () [0x00009] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Recipe.SetupRecipes () [0x00004] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Main.Initialize_AlmostEverything () [0x001b1] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Main.Initialize () [0x00136] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Main.DedServ () [0x0005c] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Program.LaunchGame (System.String[] args, System.Boolean monoArgs) [0x000ac] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0

Please send crashlog.txt to [email protected]


I installed mono using yum just this morning.


Code:
[ec2-user@Linux]$ sudo yum info mono-complete
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
Name        : mono-complete
Arch        : x86_64
Version     : 5.18.1
Release     : 7.amzn2
Size        : 0.0
Repo        : installed
From repo   : amzn2extra-mono
Summary     : Install everything built from the mono source tree
URL         : http://www.mono-project.com
License     : MIT
Description : The Mono Project is an open development initiative that is working to
            : develop an open source, Unix version of the .NET development platform.
            : Its objective is to enable Unix developers to build and deploy
            : cross-platform .NET applications. The project will implement various
            : technologies that have been submitted to the ECMA for standardization.
            :
            : Install everything built from the mono source tree.  Note that this does
            : not install anything from outside the mono source (XSP, mono-basic, etc.).


Do I need some additional packages to run the server with Mono?
 
I had this issue on Ubuntu 20.04 LTS, but not 18.04 LTS.

Worked fine once I set my TERM environment variable to xterm as per the linux server instructions on the wiki.
 
To be clear, you're getting this when you run the bash scripts to start the server?
What happens if you run the server directly from the terminal?

This is when you run it directly from the terminal. My Arch Linux setup relies solely on SSH.

@PiGuy9614
I think this affects any modern Linux distribution now, so I suggest removing "Arch" from the title. For the record, I've ran into this on Fedora 30/31 and 32.

N.B. the same (both error and workaround) applies to running the client as well. (Terraria.bin.x86_64)

@"devs"
I was hoping this to go away by updating and linking newer mono libraries (that are 256-color-term aware), so I'm guessing Linux binarys are still being built using old library/build environment then. Hope we can get some feedback to why?

Sure thing. Obviously, I only have Arch Linux so I couldn't entirely say I knew it would happen in other distros, but I had an idea. Thanks!

I'm not hugely experienced with mono myself, so do fill me in if I'm doing something wrong or have misunderstood - you seem to be running TerrariaServer.bin.x86_64 on your machine.
On my linux installation (linux mint) I've been running the server fine with a different command - mono TerrariaServer.exe. Does this help in any way?

Actually, the Server package has a folder named "Linux". In that folder is a bash script called "TerrariaServer" that you are supposed to run in order to start the server. In older editions, I have used Mono to directly run the server and it has worked for me.
However, I only posted this because of two reasons:
1. If there is a designated way to run the server on Linux, then it probably should work on Linux (not hating on the devs, just wanted to help point out a flaw)
2. Would you rather run the actual game (Terraria, of course) through Wine on Linux? Or would you rather run it on it's natively supported Linux version? :D

I had this issue on Ubuntu 20.04 LTS, but not 18.04 LTS.

Worked fine once I set my TERM environment variable to xterm as per the linux server instructions on the wiki.

Yes, it works fine after that little addition. When I made this post, I did not see that there yesterday. Almost wish I did But, hopefully the devs may see it here and decide to update their code implementing mono or just add in that line natively. Or maybe I'm helping more people in the meantime who made the mistake. Who knows? :D

I tried running it as you described and received the following error:


Code:
When you update one from git you need to update, compile and install
the other too.
Do not report this as a bug unless you're sure you have updated correctly:
you probably have a broken mono install.
If you see other errors or faults after this message they are probably related
and you need to fix your mono install first.
Server crash: 5/21/2020 4:24:37 PM
System.MissingMethodException: Method not found: int System.Collections.HashHelpers.GetMinPrime()
  at System.Collections.Generic.HashSet`1[T]..ctor (System.Collections.Generic.IEnumerable`1[T] collection) [0x00007] in <5f01f5aacbb346938d6f9b4e69d4383a>:0
  at Terraria.RecipeGroup..ctor (System.Func`1[TResult] getName, System.Int32[] validItems) [0x0000d] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Recipe.SetupRecipeGroups () [0x00009] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Recipe.SetupRecipes () [0x00004] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Main.Initialize_AlmostEverything () [0x001b1] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Main.Initialize () [0x00136] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Main.DedServ () [0x0005c] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0
  at Terraria.Program.LaunchGame (System.String[] args, System.Boolean monoArgs) [0x000ac] in <1d95b9da8f7e4a9b96cec0bf3d2db575>:0

Please send crashlog.txt to [email protected]


I installed mono using yum just this morning.


Code:
[ec2-user@Linux]$ sudo yum info mono-complete
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
Name        : mono-complete
Arch        : x86_64
Version     : 5.18.1
Release     : 7.amzn2
Size        : 0.0
Repo        : installed
From repo   : amzn2extra-mono
Summary     : Install everything built from the mono source tree
URL         : http://www.mono-project.com
License     : MIT
Description : The Mono Project is an open development initiative that is working to
            : develop an open source, Unix version of the .NET development platform.
            : Its objective is to enable Unix developers to build and deploy
            : cross-platform .NET applications. The project will implement various
            : technologies that have been submitted to the ECMA for standardization.
            :
            : Install everything built from the mono source tree.  Note that this does
            : not install anything from outside the mono source (XSP, mono-basic, etc.).


Do I need some additional packages to run the server with Mono?

I can't say for sure, as I am not using your OS. But I know in most editions, you have to install the "mono-complete" package, not just "mono". I would try that. It may also be "mono" and "mono-devel" but that may not be the solution. Please let us know the results!
 
I can't say for sure, as I am not using your OS. But I know in most editions, you have to install the "mono-complete" package, not just "mono". I would try that. It may also be "mono" and "mono-devel" but that may not be the solution. Please let us know the results!

Hey thanks for the reply! Unfortunately, I had already installed that. Still having problems. Haven't got any feedback. I spun up another AWS instance to try hosting on Windows and the server at least starts, but is much slower than my Linux box... seems like it just wasn't meant to be right now. :sigh:
 
I'm not hugely experienced with mono myself, so do fill me in if I'm doing something wrong or have misunderstood - you seem to be running TerrariaServer.bin.x86_64 on your machine.
On my linux installation (linux mint) I've been running the server fine with a different command - mono TerrariaServer.exe. Does this help in any way?

Eh, what? No, it's the build! The native linux binaries has an old mono (or whatever provides System.ConsoleDriver?) library linked into them. There's nothing we can do about that. You need a developer to update their stuff. Sorry if I muddled the water. It's an old bug from 1.3.5 that I started googled starting out from that StackOverflow question I linked above. Eventually I ended up with a library that was updated to support newer terminals just some few months after last 1.3.5 version was built, and left it as a probably-going-to-be-fixed once 1.4 comes out.

I dont want nor need to run the windows version trough mono when there's a perfectly fine workaround to get the native Linux working - It's just annoying the libs they used hasn't been updated in years.
 
Last edited:
This is when you run it directly from the terminal. My Arch Linux setup relies solely on SSH.
Sure thing. Obviously, I only have Arch Linux so I couldn't entirely say I knew it would happen in other distros, but I had an idea. Thanks!
Actually, the Server package has a folder named "Linux". In that folder is a bash script called "TerrariaServer" that you are supposed to run in order to start the server. In older editions, I have used Mono to directly run the server and it has worked for me.
However, I only posted this because of two reasons:
1. If there is a designated way to run the server on Linux, then it probably should work on Linux (not hating on the devs, just wanted to help point out a flaw)
2. Would you rather run the actual game (Terraria, of course) through Wine on Linux? Or would you rather run it on it's natively supported Linux version? :D
Yes, it works fine after that little addition. When I made this post, I did not see that there yesterday. Almost wish I did But, hopefully the devs may see it here and decide to update their code implementing mono or just add in that line natively. Or maybe I'm helping more people in the meantime who made the mistake. Who knows? :D
I can't say for sure, as I am not using your OS. But I know in most editions, you have to install the "mono-complete" package, not just "mono". I would try that. It may also be "mono" and "mono-devel" but that may not be the solution. Please let us know the results!
Hey, just a quick note - please use the edit button rather than posting multiple times in a row. I've merged them this time for you.
 
Hey, just a quick note - please use the edit button rather than posting multiple times in a row. I've merged them this time for you.

Sorry. Quite honestly, this is one of my first times actually posting in a forum. I just wanted to help anyone who may have had the same issue. Sorry if I inconvenienced you! Thanks as well. :D

Hey thanks for the reply! Unfortunately, I had already installed that. Still having problems. Haven't got any feedback. I spun up another AWS instance to try hosting on Windows and the server at least starts, but is much slower than my Linux box... seems like it just wasn't meant to be right now. :sigh:

I did some research and it looks like the error comes from an outdated DLL file in the Linux Terraria Server folder. Are you for sure using the genuine 1.4.0.3 Terraria Server download on the terraria.org site? If you're having further issues, I would be more than happy to torrent you a copy of my Terraria Server Linux folder (don't worry, no personal worlds or anything on that folder. Only change I made was the change I said to make in this forum).
 
Wasnt this bug about the native linux server? Am I missing something, or when did it turn into support-thread for running stuff under the mono framework?
 
Wasnt this bug about the native linux server? Am I missing something, or when did it turn into support-thread for running stuff under the mono framework?

I mean, the bug is an issue with the native linux server's ability to utilize the mono framework, so the talk about mono is more than appropriate.
 
Back
Top Bottom