Search Unity

Bug Can't get license in headless/nographics mode (timeout error)

Discussion in 'Linux' started by james_3drepo, Jun 28, 2017.

  1. james_3drepo

    james_3drepo

    Joined:
    Jun 28, 2017
    Posts:
    6
    I am setting up the Unity Editor on CentOS using Docker. I am using the Unity 5.5.1xf1Linux Linux Editor shell script to install.

    After deciphering the dependencies I have managed to get it installed. So far things seem to be going OK but when I follow the instructions to pass the serial, username and password as per:

    https://docs.unity3d.com/Manual/CommandLineArguments.html

    I recieve the error:

    [0628/123155: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.
    all/unity-editor-5.5.1xf1Linux/Editor/Data/Mono/lib/mono/2.0'
    Mono path[2] = '/unityinstall/unity-editor-5.5.1xf1Linux/Editor/Data/UnityScript'
    Mono path[3] = '/unityinstall/unity-editor-5.5.1xf1Linux/Editor/Data/Mono/lib/mono/2.0'
    Mono config path = '/unityinstall/unity-editor-5.5.1xf1Linux/Editor/Data/Mono/etc'
    Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56177
    DisplayProgressbar: Unity license
    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: 222)​

    I see there is a similar issue open here:

    https://forum.unity3d.com/threads/5-4-0p1-fails-to-launch-due-to-license.425277/

    However there seems to be no clear resolution. Any advice would be great, happy to provide any additional information to help clarify.
     
  2. james_3drepo

    james_3drepo

    Joined:
    Jun 28, 2017
    Posts:
    6
    To follow up, I do not believe this is an issue with certificates as has been suggest in other threads. CACerts.pem is in the appropriate folder (as far as I can tell). I can also ping the API server which leads me to believe it's not a firewall/network issue.
     
  3. justinlloyd

    justinlloyd

    Joined:
    Aug 5, 2010
    Posts:
    1,680
    There's a pretty nasty UX/UI fail in Unity3D license activation.

    But there is a way around it.

    First of all, here's what's going wrong:
    When you try to activate Unity3D on a headless server, using the nographics option, it doesn't initialise the graphics card, but then it sits there waiting for you to click "I accept" on license terms you never can click on.

    Ah, you think, "I will use batchmode!" but for whatever reason, combing batchmode with nographics, Unity3D again insists on sitting there waiting for you to click on a license dialogue box that you can never click on.

    Ah, you think, "I will use batchmode but without the nographics option!" which is great, except Unity3D cannot then launch on a headless server without a graphics card.

    What's actually happening, and it has nothing to do with your network connection, is Unity3D just sitting there waiting for you to click on an "I agree" button in a dialogue box that never displays.

    So the solution, just for the activation phase, is to use -batchmode and combine it with xvfb (X Virtual Frame Buffer).

    Ah, but again, here's the rub, Unity3D will insist that you still accept the license agreement, but now the license agreement is displayed (in a virtual frame buffer) but you still cannot click on it!

    But we can trick Unity3D in to thinking you have clicked on it, because whoever wrote the license check code is related to the spy Mustafa from the movie Austin Powers : The Spy Who Shagged Me, evidently this software developer got the weaker genes and only needs to be asked the same question twice (instead of three times) to get the truth out of them.

    You can do this by first installing xvfb.

    On Ubuntu, you would use
    Code (csharp):
    1. sudo apt install xvfb
    2. xvfb-run /opt/Unity/Editor/Unity -quit -logfile ~/editor.log -serial <your serial> -username <your username> -password <your password> & # this is where unity3d will display a dialogue box you cannot see
    3. sleep 20 # we just want to wait a little while for Unity to launch and the license agreement to start timing out
    4. killall -9 /opt/Unity/Editor/Unity # now we kill unity
    5. xvfb-run /opt/Unity/Editor/Unity -quit -nographics -batchmode -logfile ~/editor.log -serial <your serial> -username <your username> -password <your password>
    I've used this workaround on Ubuntu headless server and also a Ubuntu headless docker container. You may see a message of "Aborted (core dumped)" in some cases, it can be ignored.
     
  4. justinlloyd

    justinlloyd

    Joined:
    Aug 5, 2010
    Posts:
    1,680
    One more thing, you shouldn't activate your license and store it inside of your docker container at the time you build your container, because unless you are diligent about performing an exec /bin/bash on your container so that you can -returnlicense when updating your container, you are constantly going to be having to visit the Unity3D license management website to de-activate your license.

    Store the .ulf outside of your container, in a mapped volume, and then you can -returnlicense at anytime, from any version of Unity.
     
    Deukhoofd and james_3drepo like this.
  5. james_3drepo

    james_3drepo

    Joined:
    Jun 28, 2017
    Posts:
    6
    Thanks for the heads up. We have put this on hold for a moment but will get back to it eventually.