So, I investigated a little bit.
The problem is just one in the end: even though we are building with the “Headless” option the player is still trying to create a graphics device.
You can’t run the server app from command line that use graphics acceleration like this.
There are two way to fix this problem and I will present here both.
FIRST WAY: RUN USING XVFB
You need to install on your server xfvb and either:
-
Add a `Xvfb :0 -screen 0 640x480x24 +extension GLX (or similar) your .zshrc, .bashrc or in your init.d or whatever and then execute the app with the command DISPLAY=:0 PathToMyApp/MyApp
-
Or, way simpler, use xvfb-run -a PathToMyApp/MyApp
All this may not work if you don’t have the right driver installed. The linux player support both Vulkan and OpenGL. But for GL to work, the minimum requirement is that there is OpenGL core profile 4+ available on the machine.
That may be not the case, i.e: you don’t have the latest lib mesa installed (or any other GL driver).
By installing a newest driver that support the required OpenGL core (i.e: by using the one from the ppa oibaf-graphics_drivers repo). the app should work without problems.
In case you wanna opt in for Vulknan, there is problem: the reported device when you run from the terminal is of type 4 (I think it is CPU or no graphics, don’t remember know), that looks like it is not correctly supported or is just ignored. End result, no usable devices are found and the app trigger an exception.
For sake of reference, I tried doing the following on my started from scratch VM (IIRC was ubuntu 20.0.4 but its can work also for Debian and centos in a similar way):
sudo apt install xvfb
sudo apt install mesa-utils
sudo add-apt-repository ppa:hushed:ibaf/graphics-drivers
sudo update
sudo upgrade
If you now reboot and then run the following commands:
xvfb-run -a glxinfo you should get something like:
and the server should run properly.
SECOND WAY (SUGGESTED)
Another way to fix the issue is to add the -nographics -batchmode to command line when you run your app, i.e:
Path/To/MyApp -nographics -batchmode
The server application is initialised with a null device. The sharer will fail to compile etc etc but the game run. I tried my self with the Asteroid samples, on both Linux and OSX.
A little issue that I found: if you add the -nographics but not the -batchmode the linux app crash. The osx app instead report that -batchmode is required. An inconsistent behaviour.
Also I would say -batchmode should not even be required, but this is how it work.
All that being said, the problem is the build. It should not do that, and it should work like the Unity 2020.X version.