Error on build machine: Error opening default X display

5.4.0f3 on a host without graphics

Any tips on what might be going on?

Running:
Editor/Unity -batchmode -nographics -quit

Logfile:
BATCHMODE ARGUMENTS:
Editor/Unity
-batchmode
-nographics
-quit
-logFile
/tmp/unity.log
/images/personal/empty_project
UpdateMenuTitleForLanguage: 10
Error opening default X display

(Filename: /home/builduser/buildslave/unity/build/PlatformDependent/Linux/X11Quarantine.cpp Line: 152)

Receiving unhandled NULL exception
Launching bug reporter
#0 0x007fffdd325600 in _L_unlock_13
#1 0x007fffdd325a68 in _XimLocalSetICValues
#2 0x007fffdd325a70 in _XimSetICDefaults
#3 0x007fffdd325ae0 in _XimSetICDefaults
#4 0x007fffdd325b50 in _XimLocalCreateIC
#5 0x007fffdd325d80 in XCreateIC
#6 0x007fffdd325e90 in InitializeX11()
#7 0x007fffdd325eb0 in InitX11ToSDL()
#8 0x007fffdd326640 in InputInit()
#9 0x007fffdd326650 in InitializeEngineNoGraphics()
#10 0x007fffdd326690 in Application::InitializeProject()
#11 0x007fffdd326d10 in InitializeUnity(void*)
#12 0x007fffdd326e50 in main
#13 0x007fffdd3271f0 in __libc_start_main
#14 0x007fffdd3272b0 in _start

Currently you still need a display for the Linux editor, even in nographics mode.
This is a known issue which we plan to address (but there’s no timeframe right now).

Good to hear
Thanks for letting us know

Hi,

still (Unity 5.5.0f3 (64-bit)) the problem is not resolved.
I want to compile the game remotely in Linux
through this script named as “starter.sh”

#/bin/bash
projectPath=pwd
echo "Building in project {projectPath}" /opt/Unity/Editor/Unity -batchmode -nographics -logfile stdout.log -force-opengl -quit -projectPath {projectPath} -buildWindowsPlayer “builds/myg3.exe”

without any display (through webmin custom command) but I get :

Error opening default X display
(Filename: /home/builduser/buildslave/unity/build/PlatformDependent/Linux/X11Quarantine.cpp Line: 152)

Receiving unhandled NULL exception
#0 0x007ffc5596eb40 in funlockfile
#1 0x007ffc5596f0c8 in _XimLocalSetICValues
#2 0x007ffc5596f0d0 in _XimSetICDefaults
#3 0x007ffc5596f140 in _XimSetICDefaults
#4 0x007ffc5596f1b0 in _XimLocalCreateIC
#5 0x007ffc5596f3d0 in XCreateIC
#6 0x007ffc5596f4d0 in InitializeX11()
#7 0x007ffc5596f4f0 in InitX11ToSDL()
#8 0x007ffc5596fc80 in InputInit()
#9 0x007ffc5596fc90 in InitializeEngineNoGraphics()
#10 0x007ffc5596fcf0 in Application::InitializeProject()
#11 0x007ffc559703d0 in InitializeUnity(void*)
#12 0x007ffc55970510 in main
#13 0x007ffc559708c0 in __libc_start_main
#14 0x007ffc55970980 in _start

Executing the script (sh starter.sh) from command line (not with root user) it works.

It would be nice if

  1. root user can also run the script.sh because most of the web clients run as root
  2. the need of a display is removed (servers do not have a display).

BR,
jimver04

Latest update.
The xvfb generates a virtual display (actuall a framebuffer) as it is suggested by other threads.

By sending the following command through php

xvfb-run --auto-servernum --server-args=‘-screen 0 640x480x24’ /opt/Unity/Editor/Unity -batchmode -nographics -logfile stdout.log -force-opengl -quit -projectPath [writehereyourprojectpath] -buildWindowsPlayer “builds/myg3.exe”

I get the following

/opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.10' not found (required by /opt/Unity/Editor/Unity) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.9’ not found (required by /opt/Unity/Editor/Unity) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.15' not found (required by /opt/Unity/Editor/Unity) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.11’ not found (required by /opt/Unity/Editor/Unity) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.11' not found (required by /opt/Unity/Editor/Data/Tools/libfreeimage.so.3) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.9’ not found (required by /opt/Unity/Editor/Data/Tools/libfreeimage.so.3) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.15' not found (required by /opt/Unity/Editor/Data/Tools/libfreeimage.so.3) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.10’ not found (required by /opt/Unity/Editor/libcef.so) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.15' not found (required by /opt/Unity/Editor/libcef.so) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.9’ not found (required by /opt/Unity/Editor/libcef.so) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.11' not found (required by /opt/Unity/Editor/libcef.so) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version GLIBCXX_3.4.9’ not found (required by /opt/Unity/Editor/Data/Tools/libumbraoptimizer64.so) /opt/Unity/Editor/Unity: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.11’ not found (required by /opt/Unity/Editor/Data/Tools/libumbraoptimizer64.so)

This error means that the version of libstdc++ on your server is not recent enough.

Indeed,

I found two versions of libstdc++ in my system
a) /usr/lib/x86_64-linux-gnu/
libstdc++.so.6
and its dependency
libstdc++.so.6.0.21

b) /opt/lampp/lib/
libstdc++.so.6
and its dependency
libstdc++.so.6.0.8

the 6.0.21 includes the missing files whereas 6.0.8 is not.
( the command to run to see it is strings /opt/lampp/lib/libstdc++.so.6 | grep GLIBCXX )

by replacing the two old files with the recent ones I thought the problem will be solved but it is not. I get now

terminate called after throwing an instance of ‘std::logic_error’ what(): basic_string::_S_construct null not valid Aborted (core dumped)

Is this related to Unity or to any other library ?

I have checked the libstdc++ package files:

http://packages.ubuntu.com/xenial/amd64/libstdc++6/filelist

/usr/lib/x86_64-linux-gnu/libstdc++.so.6
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
/usr/share/doc/libstdc++6
/usr/share/gcc-5/python/libstdcxx/init.py
/usr/share/gcc-5/python/libstdcxx/v6/init.py
/usr/share/gcc-5/python/libstdcxx/v6/printers.py
/usr/share/gcc-5/python/libstdcxx/v6/xmethods.py
/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21-gdb.py

and apart to the two aforementioned I do not see anyone else related directly to them so I guess this is a problem of Unity.

This the end of the quest with this way. I will try with ssh and putty.

D.

It still seems like something pretty basic is going wrong - can you send your editor log from a session that aborts this way?

Can’t get home directory! (Filename: /home/builduser/buildslave/unity/build/PlatformDependent/Linux/SystemInfo.cpp Line: 262) mono profile = ‘/opt/Unity/Editor/Data/Mono/lib/mono/2.0’ Initialize mono Mono path[0] = ‘/opt/Unity/Editor/Data/Managed’ Mono path[1] = ‘/opt/Unity/Editor/Data/Mono/lib/mono/2.0’ Mono path[2] = ‘/opt/Unity/Editor/Data/UnityScript’ Mono path[3] = ‘/opt/Unity/Editor/Data/Mono/lib/mono/2.0’ Mono config path = ‘/opt/Unity/Editor/Data/Mono/etc’ Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56606 Can’t get home directory! (Filename: /home/builduser/buildslave/unity/build/PlatformDependent/Linux/SystemInfo.cpp Line: 262) CreateDirectory ‘/Unity’ failed: (current dir: /opt/lampp/htdocs/SimpleUnityGameProjectTemplate_v4) Can’t get home directory! (Filename: /home/builduser/buildslave/unity/build/PlatformDependent/Linux/SystemInfo.cpp Line: 262) Can’t get home directory! (Filename: /home/builduser/buildslave/unity/build/PlatformDependent/Linux/SystemInfo.cpp Line: 262) DisplayProgressbar: Unity license Can’t get home directory! (Filename: /home/builduser/buildslave/unity/build/PlatformDependent/Linux/SystemInfo.cpp Line: 262) Request Timeout while processing request “https://public-cdn.cloud.unity3d.com/config/production”, HTTP error code 0 .Cancelling DisplayDialog: Failed to activate/update license. Missing or bad username and password. Please try again using valid credentials or contact support@unity3d.com This should not be called in batch mode. (Filename: /home/builduser/buildslave/unity/build/Editor/Platform/Linux/EditorUtility.cpp Line: 219)

I suppose that this have to do with the fact that I am calling unity from the web user “daemon” but not the user that installed Unity3d from the ubuntu interface. By running the command from the terminal as me (jimver user) everything works.

I have tried to state my username and password explicitly from command line ( -username -password arguments) but no lack. I am afraid that the “This should not be called in batch mode” is something like a firewall for the command line.
I am stating below what I have tried.

starter.sh

#/bin/bash
xvfb-run --auto-servernum --server-args=‘-screen 0 1024x768x24:32’ /opt/Unity/Editor/Unity -username jimver -password [mypassgoeshere] -batchmode -nographics -logfile -force-opengl -quit -projectPath [projectpathhere] -buildWindowsPlayer “builds/myg3.exe”

and this is my calling php

<?php error_reporting( E_ALL ); $output = shell_exec('sh starter.sh'); echo "
".print_r($output)."
"; print("END"); print_r(error_get_last()); ?>

Still I am searching for the solution

I have changed the httpd.conf standard web user to be me (jimver) instead of daemon and now I get a different message

Running without the SUID sandbox! See chromium - An open-source project to help move the web forward. - Monorail for more information on developing with the sandbox on. ATTENTION: default value of option force_s3tc_enable overridden by environment. [0110/115845:ERROR:sandbox_linux.cc(308)] InitializeSandbox() called with multiple threads in process gpu-process No sufficient permissions while processing request “https://core.cloud.unity3d.com/api/login”, HTTP error code 401 .Cancelling DisplayDialog: Failed to activate/update license. Timeout occured while trying to update license. Please try again later or contact support@unity3d.com This should not be called in batch mode. (Filename: /home/builduser/buildslave/unity/build/Editor/Platform/Linux/EditorUtility.cpp Line: 219)

Any ideas ? Should I try to search for SUID sandbox ?

I think the key here is “Failed to activate/update license” - have you activated a Unity license on this server?

Do i need a commercial license? Why from ubunu terminal is working but not from php-lampp ? If i am going to buy a license do you warranty that will work or other problems may occur?

BR,
D.

You can use a personal, plus, or pro license (whatever’s appropriate for your usage) - but it needs to be activated.

I have activated my personal license during unity installation in windows. I then change machine to ubuntu and downloaded the linux version in ubuntu and installed it with ubuntu gui interface with the same username and password as in windows (i did not want to make a second account).
So I have two paths to check:
a) I guess that although my personal license is activated, it is not for linux but for windows. Am I right ? or
b) should I install and activate somehow the license in linux in headless mode?

You need to activate every Unity installation.
If you’ve already activated the installation on the server for your user, then you don’t need to pass the -username and -password arguments on the batch mode command line (when you do, it thinks you’re trying to update your activation).

We have the same problem. It works on cloud Windows VMs running on GCE, expect the same from AWS instances. Linux doesn’t. Will give it a go with xvfb or XDummy. Here there is some more info related to xvfb and the audio warnings Running Unity3D in a Virtualized Headless Ubuntu Environment | by Jon Ibasco | Medium

On other VMs we have on-site work on all platforms Win, Linux (require the user to be logged in to the session) and Mac.

I have already solved the xvfb problem. My problem is on compiling the game through a web browser, i.e. with php

<?php shell_exec("my xvfb command"); ?>

Today is the third day I am trying.

There is something going wrong with the unity authentication.
In ubuntu16 with xampp, the php 5.6.24 runs as daemon user and it can not create the necessary folders for the compiling (that are very spread withing ubuntu system).
The only solution was to do a change the opt/lampp/etc/httpd.conf , i.e. to replace the daemon user in

# # If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # User daemon Group daemon

with the registered in unity user which in my case is jimver

and the new error I get now is:

DisplayProgressbar: Unity license [0111/095517:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See chromium - An open-source project to help move the web forward. - Monorail for more information on developing with the sandbox on. ATTENTION: default value of option force_s3tc_enable overridden by environment. [0111/095517:ERROR:sandbox_linux.cc(308)] InitializeSandbox() called with multiple threads in process gpu-process Cancelling DisplayDialog: Failed to activate/update license. Missing or bad username and password. Please try again using valid credentials or contact support@unity3d.com This should not be called in batch mode. (Filename: /home/builduser/buildslave/unity/build/Editor/Platform/Linux/EditorUtility.cpp Line: 219)

obviously the SUID sandbox is not loaded because “InitializeSandbox() called with multiple threads in process gpu-process” which means that Unity is initializing by using the gpu? and why multiple threads? I am using it only once.

Are you still passing the -username and -password arguments? You shouldn’t be.

No I am not -username -password anymore.