Linux Dedicated server won't start.

guest

Terrarian
I recently went through a lot of software installs / uninstalls / upgrades in the process of hardening my webserver a bit, and after the smoke cleared i tried to start up my Terraria server again. For reference, I've upgraded from Ubuntu 18.04 to 19.04 (both are LTS versions).

I used the same shell script as before the upgrades, which basically reads:

Code:
#! /bin/bash

screen /path/to/TerrariaServer.bin.x86_64 -config /path/to/world.config

The terminal blanks momentarily as usual when screen starts, then it dumps back out to the prompt with "[Screen is terminating]" as the output.

Attempting to run directly via TerrariaServer.bin.x86_64 doesn't even blank the screen, just does nothing visible and pops a new prompt back out.

The client-crashlog.txt file says a bunch of stuff i don't really understand about initialization and magic numbers:

Code:
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.Main.DedServ () [0x00045] in <13b27967e15e4b599e2813a00bd8f379>:0
  at Terraria.Program.LaunchGame (System.String[] args, System.Boolean monoArgs) [0x00092] in <13b27967e15e4b599e2813a00bd8f379>:0

My only guess is the 'System.Console' bit suggests Linux isn't giving my Terraria user access to something it needs to run in the console. It must be something i've broken by messing around with which software is installed (e.g. dropped a dependency) or something i've broken by tightening up on user permissions (e.g. denied access to some key bit of functionality).

I'm kind of lost on how to proceed. Most of the stuff i've found seaching online deals with execution of TerrariaServer.exe via mono, but most of these posts are from years ago - i assume before there were binaries for Unix-based systems. Any guidance on troubleshooting this would be amazing.

If i had concrete questions, they would be:
What software does Terraria require to run? I understand mono is needed, but anything else that might not be included in a standard Linux install?
What usual Linux infrastructure does Terraria need access to to run? I have the user owning all relevant files same as before recent upgrades, so i wouldn't think permissions should be an issue.
 
Problem solved!

After some digging around the internet, i stumbled across a stack overflow thread where somebody was experiencing the same problem with their C# program, which led me to a github mono thread with the answers i needed.

Apparently magic numbers are some kind of tag in file headers that let the terminal know what kind of file it's opening. I think it means when you run a program, it looks for a magic number in the header, and it handles the file accordingly - in this case handing file execution over to mono for .NET framework stuff.

The ncurses 6.1 update started using a new format (terminfo2) which has some incorrect magic numbers... or something? The prescribed workaround in those threads was to use an older terminal info list (xterm) instead, which has the correct magic numbers. So in case anybody else stumbles across this looking for a fix:

Code:
export TERM=xterm

This worked for me, but i've seen reports that it didn't work for some people. If you're using something other than Ubuntu with Gnome3 (Fedora, xfce, etc) it may not be a sure fix.

Unfortunately, a permanent bugfix may be some time coming since the workaround is so easy. The threads i was looking at were from Feb 2018, and this issue is still alive.
 
Hey I just want to say thank you so much for sharing this. I searched the internet for an hour trying to find a fix. I had the exact same problem you did, and your fix actually worked!
 
Back
Top Bottom