Linux Linux Server won't start properly

MeiglMeiers

Terrarian
Hello everyone,

as I tried to run Terraria on my root server I faced the following problem. After I installed mono-complete I downloaded the latest Terraria Version (terraria-server-linux-1308).
I navigated to the specific folder and entered "mono TerrariaServer.exe".

Then I get the following message:

cant resolve internal call to "System.Net.Sockets.Socket::cancel_blocking_socket_operation(System.Threading.Thread)" (tested without signature also)

Your mono runtime and class libraries are out of sync.
The out of sync library is: /path/to/folder/terraria-server-linux-1308/System.dll

When you update one from svn 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.

That's interesting, because the installation of mono is fine. Then I can setup the server, like new world, medium, large, etc. After entering the world name I get the following:

Missing method ToPrime in assembly /path/to/folder/terraria-server-linux-1308/System.Core.dll, type System.Collections.HashPrimeNumbers

I googled hours but couldn't find anything useful. I found some tutorials how to setup Terraria on Linux and it was just the mono thing.

I hope I am in the right subforum and maybe anyone is also facing that problem.

Br,
Michael

PS: OS is debian.
 
Last edited:
Yeah, this still happens in 1.3.2 and 1.3.3

Code:
Server crash: 9/12/2016 12:24:37 AM
System.TypeInitializationException: The type initializer for 'Newtonsoft.Json.Utilities.JavaScriptUtils' threw an exception. ---> System.TypeLoadException: Could not load type 'System.Collections.HashPrimeNumbers' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
  at System.Collections.Generic.HashSet`1[T].Add (System.Collections.Generic.T item) <0x403babc0 + 0x00077> in <filename unknown>:0
  at System.Linq.Enumerable+<CreateUnionIterator>c__Iterator1C`1[TSource].MoveNext () <0x403f47c0 + 0x001cf> in <filename unknown>:0
  at Newtonsoft.Json.Utilities.JavaScriptUtils..cctor () <0x403f3bb0 + 0x00234> in <filename unknown>:0
  --- End of inner exception stack trace ---
  at Newtonsoft.Json.JsonTextWriter.UpdateCharEscapeFlags () <0x403f3ad0 + 0x0001b> in <filename unknown>:0
  at Newtonsoft.Json.JsonTextWriter..ctor (System.IO.TextWriter textWriter) <0x403f1eb0 + 0x0007f> in <filename unknown>:0
  at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) <0x403f1ca0 + 0x000c3> in <filename unknown>:0
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Formatting formatting, Newtonsoft.Json.JsonSerializerSettings settings) <0x403f0830 + 0x0004b> in <filename unknown>:0
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, Formatting formatting, Newtonsoft.Json.JsonSerializerSettings settings) <0x403f07f0 + 0x00023> in <filename unknown>:0
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, Formatting formatting) <0x403f0730 + 0x00013> in <filename unknown>:0
  at Terraria.IO.FavoritesFile.Save () <0x403f06c0 + 0x0001b> in <filename unknown>:0
  at Terraria.IO.FavoritesFile.SaveFavorite (Terraria.IO.FileData fileData) <0x404caba0 + 0x000ef> in <filename unknown>:0
  at Terraria.IO.FileData.SetFavorite (Boolean favorite, Boolean saveChanges) <0x404cab30 + 0x0004f> in <filename unknown>:0
  at Terraria.IO.WorldFile.CreateMetadata (System.String name, Boolean cloudSave, Boolean isExpertMode) <0x40509e90 + 0x0014b> in <filename unknown>:0
  at Terraria.Main.DedServ () <0x402b2be0 + 0x00df7> in <filename unknown>:0
  at Terraria.Program.LaunchGame (System.String[] args) <0x40274700 + 0x00157> in <filename unknown>:0

on an Ubuntu 16.04.1 LTS with latest mono available to me

Code:
 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

And this is how I try to start it:

Code:
mono --server --gc=sgen -O=all TerrariaServer.exe -config serverconfig.txt

Googling around, I came about the info that going from Mono 4.0 to 4.2, Mono removed a third party library which would include the missing dependency it's now complaining about. Right now, I can only run Terraria in a docker container based on Ubuntu 14 LTS, with that old Mono. The old Mono does not seem to support 16 LTS, so I'm kind of stumped running it on bare metal. There are some hints as to downgrading by adding special deb sites, but all this smells extremly fishy and hacky (have to manually endorse signing keys for these repos).

So my question is: is Terraria Server for Linux ever going to support Mono 4.2.x (latest as of Sept 2016)? If not, what is the official way to get it to run on Ubuntu 16 LTS with access to Mono 4.2 only? Am I doing something wrong in the setup or start script? Do I have to compile an old Mono myself?

I'm available for answering questions about the error, my setup, and for trying alternative ways to start this.
 
Last edited:
Googling around, I came about the info that going from Mono 4.0 to 4.2, Mono removed a third party library which would include the missing dependency it's now complaining about. Right now, I can only run Terraria in a docker container based on Ubuntu 14 LTS, with that old Mono. The old Mono does not seem to support 16 LTS, so I'm kind of stumped running it on bare metal. There are some hints as to downgrading by adding special deb sites, but all this smells extremly fishy and hacky (have to manually endorse signing keys for these repos).

So my question is: is Terraria Server for Linux ever going to support Mono (latest/4.2)? If not, what is the official way to get it to run on Ubuntu 16 LTS with access to Mono 4.2 only? Am I doing something wrong in the setup or start script? Do I have to compile an old Mono myself?

I'm available for answering questions about the error, my setup, and for trying alternative ways to start this.

I'm not staff. But I've been tinkering with this issue most of the day. I can personally confirm the break is somewhere between Mono 3.12 and 4.2, so your information is likely correct there :)

Your startup script is (hopefully) fine, it's almost identical to the one I've been using for some time, and works with the older version of Mono just fine. If you end up compiling manually, here's a neat tutorial I found that describes the process concisely: http://brightstardb.com/2015/02/24/mono-on-ubuntu.html
(I'm not the author of that page/site, and cannot accept any liabilities, blah blah blah. I followed the tutorial, it works fine for me, YMMV.)

Looking forward to a more official fix myself. Cheers!

Edit: Currently looking into a way to re-introduce the missing class, as an alternative to downgrading Mono. Will post progress/results [may be slow or even fruitless]. Worst case scenario, might be able to pack up a "tweaked" NewtonSoft.Json dll that works around the issue (but you shouldn't trust .dll from strangers, so still wouldn't be a anything comparable to a formal fix.)

Edit 2: It's being tricksy and complicated. I require sleep before I continue, will keep you guys posted if I get anything cool :)
 
Last edited:
I'll admit, most of this is way over my head, as I know next to nothing about Linux, but this looks very informative and I'll make sure we look at this thread tomorrow when we investigate this issue further! Thanks so much for compiling all this info you guys!
 
Thanks for earmarking this. Consequently, I dug for the place I found this info. It's on the tshock forums and dates back to January this year.

Guy who found the workaround:
I think I have a fix.

I reverted back to an older version of Mono (4.0.5.1), and it appears to be working now.

Guy with explanation:
it looks like 4.0.5.1 is the latest version of Mono that will work. According to Wolfje in the Slack chat, the core issue is that Mono v4.2.0 dropped support for the Boehm library that Tshock relies on.

Culprit: "Boehm library".

The thread goes on to hint at _another_ 3rd party lib, but I didn't follow up with that because the docker thingie worked out at that point. (shoutout to ryshe for providing this docker image - I'm only here now because he didn't update that to 1.3.3.x yet but Steam forced me onto it already, client-side :D)
 
I have been having troubles also running with my system installed mono. I have gotten the 1.3.3.1 linux server to start without mono by copying the dlls from the terraria-server-133.zip patch in another thread. With those dlls 'TerrariaServer' seems to run fine. 'mono TerrariaServer.exe' starts up fine, but when any players log in, no tiles are sent to the client and you fall, eventually to your death.

I also believe that mono4.2 still had the boehm gc included, but they may have changed to sgen as the default. You might try checking the command line options to see if you can tell it to use boehm. boehm is definitely gone with mono 4.4.
 
It seems you've figured most of this out. However, you should simply be able to run the server in the provided mono with:
./TerrariaServer

My original goal was to include the newest version of mono, however there ended up being several comparability issues with it and the utility that allows mono to run without being installed.
 
It seems you've figured most of this out. However, you should simply be able to run the server in the provided mono with:
./TerrariaServer

My original goal was to include the newest version of mono, however there ended up being several comparability issues with it and the utility that allows mono to run without being installed.

Thank you for taking the time to reply. I took a preliminary look, and my pal is building a docker container based on this revelation now.

As for the contents of your reply: You got to be kidding me. :D All these problems, standing on the head to get an old mono working, all this because we followed the wiki, and all the time you had the correct mono version packaged?! How is this possibly not in the wiki? :(

*breathes in* - boi.

Anyways. It works - kind of. The servers files' permissions are off, the architecture decision script is kinda borked and there's issues with filesystem permissions, but I got it to run on bare metal under Ubuntu 16 LTS, and had a pal play on a freshly generated, large world.

# chmod ug+x TerrariaS*
# ./TerrariaServer.bin.x86_64

All this had to be done as root. As user with sudo, it wouldn't work b/c permissions for the users directory.

Soooo, there's kind of some todos here: wiki(!!!), script, permissions / make it workable with sudo. We can help with testing changes, if needed.



I'll report back with issues found during dockerization (is that a word?).
 
All these problems, standing on the head to get an old mono working, all this because we followed the wiki, and all the time you had the correct mono version packaged?! How is this possibly not in the wiki? :(

Soooo, there's kind of some todos here: wiki(!!!), script, permissions / make it workable with sudo. We can help with testing changes, if needed.

Worth noting that the wiki is 100% fan-created and updated, so its not uncommon for there to be mistakes there. We don't really have any control over it.
 
Worth noting that the wiki is 100% fan-created and updated, so its not uncommon for there to be mistakes there. We don't really have any control over it.

The wiki is just that, a wiki. :) Not a manual.

-However- this very, VERY useful tidbit of information is not as intuitive as it probably should be - I didn't realize there was a bundled mono either (obviously). Maybe a readme file would be of assistance? Just a thought.
 
I tried to update the wiki, but then this happened:
7H7BQJJ.png
 
Thank you for taking the time to reply. I took a preliminary look, and my pal is building a docker container based on this revelation now.

As for the contents of your reply: You got to be kidding me. :D All these problems, standing on the head to get an old mono working, all this because we followed the wiki, and all the time you had the correct mono version packaged?! How is this possibly not in the wiki? :(

*breathes in* - boi.

Anyways. It works - kind of. The servers files' permissions are off, the architecture decision script is kinda borked and there's issues with filesystem permissions, but I got it to run on bare metal under Ubuntu 16 LTS, and had a pal play on a freshly generated, large world.

# chmod ug+x TerrariaS*
# ./TerrariaServer.bin.x86_64

All this had to be done as root. As user with sudo, it wouldn't work b/c permissions for the users directory.

Soooo, there's kind of some todos here: wiki(!!!), script, permissions / make it workable with sudo. We can help with testing changes, if needed.



I'll report back with issues found during dockerization (is that a word?).

Thanks, Ive been wrangling with this problem for awhile as well.

However, I was able to follow you commands using a regular user with sudo. Perhaps it is your specific setup preventing this?
Everything Terraria server related I have inside the home folder of my Terraria user.

I ran with Terraria user

# sudo chmod ug+x TerrariaS*
# sudo ./TerrariaServer.bin.x86_64
 
Thanks, Ive been wrangling with this problem for awhile as well.

However, I was able to follow you commands using a regular user with sudo. Perhaps it is your specific setup preventing this?
Everything Terraria server related I have inside the home folder of my Terraria user.

I ran with Terraria user

# sudo chmod ug+x TerrariaS*
# sudo ./TerrariaServer.bin.x86_64

This entirely depends upon your user account and permissions setup on your server.
chmod requires permission to, well, chmod stuff. If you have it, great! If not, you'll need sudo/root/something that does.
 
@KnutKnutsen, or anyone else here in the thread for that matter, would you mind explaining to me what a dockerized version is and of what benefit it is to you as users? I'm afraid I'm simply Linux inept, but I'd like to understand the issue more so I can relay the feedback better to the team. :)
 
@KnutKnutsen, or anyone else here in the thread for that matter, would you mind explaining to me what a dockerized version is and of what benefit it is to you as users? I'm afraid I'm simply Linux inept, but I'd like to understand the issue more so I can relay the feedback better to the team. :)

Ya sure! Docker is a very easy way to create and manage virtual machines. The idea is that there's a very simple and open way to combine apps or entire disk images into the one virtual machine image you need. In our case here, we basically say - in human-readable plain-text code -, "hey, go ahead, and take the latest official Ubuntu image you have, and then go download that zip over there (the Terraria server) and unzip it to that place in the image. Make sure the Hypervisor grants you port 7777. When you are started, execute this command line.". This combination, the Docker image, goes into a public repo and gets a name you can reference from the Docker management app, which plays the role of a Hypervisor and version management system for these Docker images. Now everyone and his brother can go and type something along the lines of "docker start knutscoolterraria" and the app retrieves the image, does the necessary steps to assemble it and starts the assembly up in a virtual machine inside your server. The server itself stays clean, all the third-party stuff is bundled in a VM, but this is common with all virtualization solutions.

The benefit for the user is that he has to set up Docker on his server once and then, whenever a docker image is available for a certain application he wants or needs, he just needs to reference that image's name and doesn't have to do the setup details, and the dependencies and the updating for that app himself. The difficulty in Terraria's case seemed to be the ancient Mono version which wouldn't be working on Ubuntu 16 -- ryshe's docker image took care of that by telling docker how to combine the correct Mono with an older Ubuntu where it worked.

Now after the 1.3.3 update, ryshe wasn't quick enough to update his docker so it would point to the newest Terraria and Knut and me weren't able to play, so we went back to the original problem with Docker on U16, which is where this thread comes in again. We found out the Mono step isn't needed, so now in theory, you only need to install the Terraria portion. Knut built a new image on top a U16 and simplified everything so when 1.3.3.2 came out earlier, he went to the public Docker repository, changed the pointer for the server archive to .2; then the repo rebuilt the Docker image and everyone who would be using it could just tell his Docker installation to go ahead and update his local copy of Knut's docker image, and would automatically get a working latest Terraria. Oh and the user's data is not in the image, but a directory from the host machine can be mapped against a known place in the virtual image and Terraria is configured to look for worlds at that spot.

I'm sorry this has gotten so long. There's more to Docker, some downsides, too (e.g. like with any open source repo, you need to trust or inspect the repo to be safe against malicious software).

TL;DR convenient virtualization, https://en.wikipedia.org/wiki/Docker_(software)

Just go ahead if you have any more questions.
 
Back
Top Bottom