- Home /
Unity server on Amazon EC2 Ubuntu?
Problem description:
We have developed client-server application in Unity. Up to now, server was running on EC2 Amazon on Windows (for some reason Unity is working in -batchmode only there). Unfortunately on Ubuntu Linux on EC2 same command with same hardware configuration results in "Aborted (core dumped)" error message.
What is in Unity project:
I've made test with simplest project possible: empty scene without camera, with one gameObject + one script that is creating empty file on HDD (just to prove that anything works, we're running in headless mode). I've set quality to minimum possible, made sure that player doesn't need focus, and created developer release to have debug messages.
How are we testing:
As Ashkan Sa'eedi suggested, we are trying to run it on xvfb, using command:
xvfb-run --auto-servernum --server-args='-screen 0 640x480x24:32' ./Unity -batchmode -nographics -logfile log.txt
[Earlier we've tried VNC, but we've failed too]
Results:
It runs on local machine (Ubuntu 12.04, x86_64). After copying it to EC2 (Ubuntu 12.10, x86_64) using scp, we have first problem:
The assembly mscorlib.dll was not found or could not be loaded.
It should have been installed in the `/home/ubuntu/CreateFile_Data/Managed/mono/2.0/mscorlib.dll' directory.
Strange, but after some googling I've found solution: http://stackoverflow.com/questions/10490155/unable-to-run-net-app-with-mono-mscorlib-dll-not-found-version-mismatch. So I've installed mono and created symbolic link pointing to it inside of my project.
Result: application runs and writes:
Set current directory to /home/ubuntu/:/debug
Found path: /home/ubuntu/:/debug/CreateFile
Aborted (core dumped)
And in a log.txt file:
Stacktrace:
Native stacktrace:
/home/ubuntu/:/debug/CreateFile_Data/Mono/x86_64/libmono.so(+0x8fc73) [0x7f703dc4ec73]
/home/ubuntu/:/debug/CreateFile_Data/Mono/x86_64/libmono.so(+0xcfc9d) [0x7f703dc8ec9d]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0) [0x7f7040546cb0]
./CreateFile() [0xa616c7]
./CreateFile() [0xa4ba9a]
./CreateFile() [0xa66ae3]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7f703f77b76d]
./CreateFile() [0x41f519]
Debug info from gdb:
Could not attach to process. If your uid matches the uid of the target
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf
ptrace: Operation not permitted.
No threads.
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
If someone could help me with that, it would be really great.
Thanks in advance!
Answer by Ashkan_gc · Dec 17, 2012 at 09:59 AM
It should work using xvfb
Thanks, your idea was brilliant, but unfortunately it doesn't work (application stops immediately without too much info).
Answer by webcoyote · May 21, 2013 at 02:46 AM
After encountering the same issue, I discovered that "-nographics" is the culprit. If you remove that option from your command it should work properly.
/opt/gamesrv/current/gamesrv-run.sh ->
#!/bin/bash
export HOME=/opt/gamesrv/current
cd $HOME
exec 2>&1
exec xvfb-run --auto-servernum --server-args="-screen 0 640x480x24:32" \
./gamesrv.bin -batchmode #
Note the use of "exec" in the script file to ensure that the caller of the script doesn't get detached from the game server.
Your answer
Follow this Question
Related Questions
Render to 'RenderTexture' in 'Headless Mode' 0 Answers
Linux game server 1 Answer
Headless linux server 2 Answers
Batchmode on linux 1 Answer
Unity networking tutorial? 6 Answers