5.6.0b8 Crash in headless mode

I’ve looked through the forum and I found that having an X display is required to run in headless mode. I also noticed that some people have had success using xvfb-run. I however have not, I am looking for someone who has it working to help me out.

I am using the following flags: -batchmode -force-opengl -nographics

I’ve ruled out isues with xfvb-run/gtk interaction as I can run gtk applications in xfvb-run with no problem.

DisplayProgressbar: Preparing
DisplayProgressbar: Preparing Package

(process:9140): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(process:9140): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

(process:9140): Gtk-CRITICAL **: IA__gtk_window_add_accel_group: assertion 'GTK_IS_ACCEL_GROUP (accel_group)' failed

(process:9140): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(process:9140): Gtk-WARNING **: Screen for GtkWindow not set; you must always set
a screen for a GtkWindow before using the window

(process:9140): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed

(process:9140): Gdk-CRITICAL **: IA__gdk_colormap_get_visual: assertion 'GDK_IS_COLORMAP (colormap)' failed

(process:9140): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion 'GDK_IS_SCREEN (screen)' failed

(process:9140): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(process:9140): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion 'GDK_IS_SCREEN (screen)' failed

(process:9140): Gdk-CRITICAL **: IA__gdk_window_new: assertion 'GDK_IS_WINDOW (parent)' failed
Receiving unhandled NULL exception
#0  0x007ffebf034fc0 in funlockfile
#1  0x007ffebf035680 in gdk_window_enable_synchronized_configure
#2  0x007ffebf0356a0 in gtk_window_get_focus_on_map
#3  0x007ffebf035740 in g_closure_invoke
#4  0x007ffebf0357d0 in g_signal_emit_valist
#5  0x007ffebf035950 in g_signal_emit
#6  0x007ffebf035a30 in gtk_widget_realize
#7  0x007ffebf035a50 in gtk_window_set_focus
#8  0x007ffebf035ae0 in g_closure_invoke
#9  0x007ffebf035b70 in g_signal_emit_valist
#10 0x007ffebf035cf0 in g_signal_emit
#11 0x007ffebf035dd0 in gtk_widget_show
#12 0x007ffebf035de0 in GUIView::SetWindow(ContainerWindow*)
#13 0x007ffebf035e40 in (Unknown)
#14 0x007ffebf035e50 in (Unknown)
#15 0x007ffebf035e60 in (Unknown)
#16 0x007ffebf035e70 in (Unknown)
#17 0x007ffebf035e80 in (Unknown)
#18 0x007ffebf035e90 in (Unknown)
#19 0x007ffebf035ea0 in (Unknown)
#20 0x007ffebf035eb0 in (Unknown)
#21 0x007ffebf035ec0 in (Unknown)
#22 0x007ffebf035ed0 in (Unknown)
#23 0x007ffebf035ee0 in (Unknown)
#24 0x007ffebf035ef0 in (Unknown)
#25 0x007ffebf035f00 in (Unknown)
#26 0x007ffebf035f10 in (Unknown)
#27 0x007ffebf035f20 in (Unknown)
#28 0x007ffebf035f30 in mono_set_defaults
#29 0x007ffebf036650 in mono_runtime_invoke
#30 0x007ffebf036680 in scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
#31 0x007ffebf0366c0 in ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
#32 0x007ffebf0366f0 in Application::ParseARGVCommands()
#33 0x007ffebf037490 in Application::FinishLoadingProject()
#34 0x007ffebf037580 in InitializeUnity(void*)
#35 0x007ffebf037630 in main
#36 0x007ffebf037f40 in __libc_start_main
#37 0x007ffebf038000 in _start

How are you trying to start Unity?
I’ve had success with the following: xvfb-run -a -s “-screen 0 1024x768x16” /opt/Unity/Editor/Unity -batchmode -nographics -quit -logfile

Some caveats though:

  • If you are trying to use a personal license (ie no serial) then you have to run with a UI until the license has been active. There is no way to activate a personal license on the command line. If you’re using a serial, just add the -username -password -serial to the end and it will activate on first run.
  • I am using a docker to run Unity, and the docker shell does not properly set some environment variables, but running with sudo gets around that. Alternatively you could set the environment variables to make the shell look more like a proper linux shell.
  • Exceptions will still try and open an error report dialog, which will make the process appear unresponsive.

If you’re running on a machine which literally has no graphics card, I had no problem using Xvfb and x11vnc to run a VNC instance to activate licenses. It was a pain, but it works…