Failing with license error when running -batchmode

I’m attempting to get a free version of Unity running in a Docker container for an automated build. I’m running Unity for Linux version 5.4.2f2+20161111

If I don’t specify a username/password:

xvfb-run -n 99 -s "-screen 0 1024x768x24 +extension RANDR" \
/opt/Unity/Editor/Unity -batchmode \
-skipMissingProjectID \
-skipMissingUPID \
-projectPath /home/gamedev/SpaceShooter \
-logFile "/home/gamedev/log.txt" \
-buildconfig \
-bvrbuildtarget default-mac-desktop-universal \
-buildTarget standaloneosxuniversal \
-quit

I get the error:

DisplayProgressbar: Unity license
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: 234)

The -force-free flag doesn’t seem to do anything. If I add in credentials (e.g. -username=‘me@example.com’ -password=‘hunter2’) then I get the following error:

DisplayProgressbar: Unity license
Receiving unhandled NULL exception
Launching bug reporter
#0  0x007ffcc31a1300 in _L_unlock_13
#1  0x007ffcc31a1898 in strlen
#2  0x007ffcc31a18a0 in LicenseManager::AppendSystemInfoXML(std::string&)
#3  0x007ffcc31a1900 in LicenseManager::CreateLicenseXMLSegment()
#4  0x007ffcc31a1940 in LicenseManager::CreateNewCommandXML()
#5  0x007ffcc31a1980 in LicenseManager::StartNewLicenseFlow()
#6  0x007ffcc31a1990 in LicenseInfo::Tick()
#7  0x007ffcc31a19c0 in InitializeUnity(void*)
#8  0x007ffcc31a1b00 in g_source_get_time
#9  0x007ffcc31a1b20 in g_main_context_dispatch
#10 0x007ffcc31a1ba0 in g_main_context_dispatch
#11 0x007ffcc31a1c00 in g_main_loop_run
#12 0x007ffcc31a1c20 in gtk_main
#13 0x007ffcc31a1c90 in main
#14 0x007ffcc31a2030 in __libc_start_main
#15 0x007ffcc31a20f0 in _start

Is this a bug? I was under the impression that -batchmode should work for free licenses as well.

Getting the same error as well…

“Batch mode in the linux editor currently requires being able to access a running X session (even with -nographics, known issue) - it looks as though it isn’t able to do so from your docker container.” - Tak

“To activate from the command line:
Unity -batchmode -nographics -serial XXXX -username myuser@mydomain.com -password MyPassword -quit” - Tak

“…to activate the personal edition. There’s currently no way to do that from the command line (on any platform) - we’ll look at adding that in the future.” - Tak

Well that’s a bit ridiculous. I hope they add it soon…

Have you tried this :

xvfb-run --auto-servernum --server-args=‘-screen 0 1024x768x24:32’ /opt/Unity/Editor/Unity -batchmode -nographics …

xvfb-run simulates let’s say the X session with a virtual screen

I have similar issue. I have a Jenkins job on Ubuntu and I try to build for Android. The setup has worked before, but I started to see a following error when I upgraded from Unity 5.6.0xf1 to 2017.1.1xf1. In the Jenkins I have Xvfb plugin in use.

The actual unity command is like this:

xvfb-run unity -force-free -nographics -quit -batchmode -projectPath $projectDir/unity-package/MyProject -logFile $projectDir/unity-package/MyProject/setup.log -executeMethod Autobuild.SetToolPaths"

And in the logs I see this:

DisplayProgressbar: Unity license
[1002/091945:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
Xlib: extension “RANDR” missing on display “:99”.
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: 216)

I have tried to active license manually like this

/opt/Unity/Editor/Unity -batchmode -nographics -serial **** -username **** -password **** -quit

And in the logs I see this:

DisplayProgressbar: Unity license


[1012/091724:ERROR:browser_main_loop.cc(161)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.

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.

Also tried to activete with xvfb-run, but the result is pretty much same

Any ideas how to get this solved?

Hi @maokkone , did you ever resolve this? We’re trying to set up a Linux microservice to create Unity AssetBundles, but we’re unable to get past these license issues when running our batch command.