Linux Dedicated Server Issue v4.19

Hi there

I’m having difficulty running a Linux Dedicated Server build with v4.19.0.

I have cross-compiled my project for LinuxServer using the latest version of the toolchain (v 11).

It compiles fine. However, when I attempt to run it on my server, nothing happens. No log, no process, no nothing. Just a blinking cursor in my terminal.

I get the same result with a blank project.

My UE4 is built from source. My server is running Ubuntu 16.04. I am not doing anything fancy in the build settings.

The same setup worked fine using v4.18 and toolchain v10. Also, the same project built for WindowsNoEditor runs fine.

Is there something I might be missing?

Hm… My project with similar setup, but with CentOS works fine. Also, you can place your own write to log functionality, to test if your code is being executed.
But how did you compile with v11? For me, I had to disable warnings as errors to compile. the engine compiles fine, but the project itself fails. Here is a thread about it: Non-portable path to file:when building project for linux - Platform & Builds - Unreal Engine Forums

Not sure what to tell you, it just worked! I didn’t do anything special, just set my environment variable to point to the new toolchain.

How do you setup custom log writes?

Bumping this, as I still haven’t managed to find a solution.

Has anyone managed to run a dedicated server built with v4.19 on Ubuntu?

Just for curiosity, can you try to run it on CentOS as it is officially supported platform?

I just tried running it on CentOS 7 with the exact same result. No log output etc

This is literally a blank 4.19 project packaged using the latest toolchain and which received no errors during packaging.

Bumping this again.

This is starting to seem like it may be some kind of issue with v 4.19. (If so, a fairly major one)

I suspect it may in fact be the same issue being described in this post: Linux dedicated server doesn't show log information - Platform & Builds - Epic Developer Community Forums

So far I have established that:

  • There are no errors or warnings in the build log.

  • WindowsServer builds run fine on a Windows machine with no errors or warnings in the log.

  • LinuxNoEditor builds will run on a Linux server. Obviously the client build does not run properly on the server, but all the errors are correctly printed to stdout.

  • LinuxServer builds DO NOT run properly. Nothing is printed to stdout. No error message, no log. Server does not start up.

  • The problem is the same on Ubuntu 16.04 and CentOS 7.

  • The problem can be replicated using a blank project.

It would be great to know from Epic (or anyone) whether this problem can be replicated and is related to v4.19. That way at least I can stop spending time on it.

Otherwise any suggestions as to how to go about trying to debug this would be much appreciated.

I ran into a similar looking problem as well. I was trying to build the ShooterGame demo for a dedicated linux server. To make sure that the packing is done correctly try this

<PATH TO UE4>\Engine\Build\BatchFiles\RunUAT -ScriptsForProject=<PATH TO PROJECT>\<ProjectName>.uproject BuildCookRun -project=<PATH TO PROJECT>\<ProjectName>.uproject -noP4 -serverconfig=Development -utf8output -platform=Linux -server -serverplatform=Linux -targetplatform=Linux -build -cook -allmaps -compressed -stage -pak -archive -unversionedcookedcontent -archivedirectory="<WHERE TO PUT THE PACKAGED THING>"

The next thing to try is to run strace on the server executable you are running. Somewhere near the button of my strace I had a “(Cannot allocate memory)”.

If this is the case try using a swapfile, this got the server to print stuff correctly to the screen for me. Even though it worked without a swap on Digital Ocean severs. I’m was running on Linode server and had todo this to get it working. First run the commands below to make the swapfile and then try running the server again.

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

This creates a swapfile in / of the size of 2GB, changes permissions, makes it swap and turns the swap on. You can roll this back by running the following commands:

sudo swapoff /swapfile
sudo rm /swapfile

Let me know where you get with this and I will try and help you further.

Thanks for bringing this to our attention. We’ll adjust the pool set up (you can use UE-58073 for tracking).

void UGameFunctionLibrary::LogToFile(const FString &String, const FString &StringSeparator, const FString &String2, EGameDirPath DirectoryPath, const FString &LogFileName)
{
FString strOut = String;
if(String2.Len() > 0)
{
strOut += StringSeparator + String2;
}

	FString FileName = GetDirPath(DirectoryPath);

	FileName += LogFileName;

	auto ansi_fileName = StringCast<ANSICHAR>(*FileName);
	auto ansi_TextOut = StringCast<ANSICHAR>(*strOut);

	FILE *f = NULL;
	
#if defined(_MSC_VER)
	fopen_s(&f, ansi_fileName.Get(), "ab");
#else
	f = fopen(ansi_fileName.Get(), "ab");
#endif
	
	if(f != 0)
	{
		fwrite(ansi_TextOut.Get(), ansi_TextOut.Length(), 1, f);
		fwrite("\n", 1, 1, f);
		fflush(f);
		fclose(f);
	}
}

This is how I write my log into file. Works of cause in shipping builds as well.

RCL, it is not directly related to this problem, but can you take a look at Error: non-portable path to file when building Unreal Editor for Linux on Windows - Platform & Builds - Unreal Engine Forums

Thanks a lot. The swapfile worked for me

Great! I’m glad that this got things working for you. I’m also glad you made this thread as well because it seems like it caught the attention of the unreal devs and now has been fixed. Looks like the fix will be released with 4.19.2 Unreal Engine Issues and Bug Tracker (UE-58073)