Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Batch mode license activation fails in a Docker container

Discussion in 'Windows' started by tgwozdz_unity, Sep 20, 2019.

  1. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    Hello!

    I'm trying to set up a Windows Docker container to perform our automated Unity builds. I'm trying to activate the license and I'm getting an error.

    I'm running the following command in the Docker container (in a powershell console).

    Start-Process -FilePath 'c:\program files\unity\editor\unity.exe' -ArgumentList '-batchmode','-quit','-nographics','-logfile','log.txt','-serial','xxx','-username','yyy','-password','zzz' -Wait


    The log then gets the following output:

    BatchMode: Unity has not been activated with a valid License. Could be a new activation or renewal...

    (Filename: C:\buildslave\unity\build\Platforms/Windows/Modules/LicensingLegacy/WinILicensingAdapter.cpp Line: 43)

    DisplayProgressbar: Unity license
    Cancelling DisplayDialog: Updating license failed Failed to update license within 60 seconds. Exiting.
    This should not be called in batch mode.

    (Filename: C:\buildslave\unity\build\Editor/Platform/Windows/EditorUtility.cpp Line: 1162)

    Exiting without the bug reporter. Application will terminate with return code 1


    It seems like Unity might be trying to display some kind of dialog box, but is unable to because it's in a headless container? Is there some way around this? When I run the same command outside of the Docker container, it completes successfully.
     
    nguetter, GuillaumeCL and spauley like this.
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,390
    Hey I just heard back from our license team folks. They had these suggestions:

    That means login failed.
    1. Check username and password
    2. Clear Editor cache (C:\Users\<username>\AppData\LocalLow\Unity\Browser\ or ~/Library/Unity/Browser) * ~ means user’s folder in mac system.
    3. Try to activate it again

    Let me know if this helps if we need to do further troubleshooting.
     
  3. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    The username, password and serial number are correct. I am able to run the same command outside of the Docker container successfully.

    The cache is empty within the Docker container, the container contains a clean install of Unity, however the activation still fails with the same error.

    Is there anything else that could be causing this?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,390
    Which version of Unity are you on? There was a known issue in Unity 2018.1 and 2018.2 that would cause "Cancelling DisplayDialog: Updating license failed Failed to update license within 60 seconds. Exiting.". It was fixed late in 2018.2 cycle.
     
  5. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    I tried this with both 2019.1.14 and 2018.2.21 with the same results for both.
     
  6. matissehack

    matissehack

    Joined:
    Oct 5, 2019
    Posts:
    2
    I just ran into this exact issue as well.

    I have a Windows container based on mcr.microsoft.com/windows:1903 and I'm trying to activate a fresh install of Unity version 2018.4.2f1 on it. I also tried Unity version 2019.2.8f1 without any luck.

    The command works fine outside the container.
     
  7. Amir_AZNK

    Amir_AZNK

    Unity Technologies

    Joined:
    Jul 9, 2019
    Posts:
    10
    Hi guys,

    I reproduced the same issue on my side. What I did was disabled all network adaptors on my machine and run the activate license command and I got the same logs.

    I suspect that Unity within the container cannot talk to Unity's licensing backend. Try to check connection and let us know.
     
  8. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    My container can talk to the Internet just fine. For instance, I was able to curl unity.com from within the container successfully. I can also confirm this with a Wireshark dump of network traffic from the container. However when running the unity activate command, I saw no traffic being generated at all when it failed, as if it wasn't even trying to talk over the network.

    Is there anything else I can try?
     
  9. Amir_AZNK

    Amir_AZNK

    Unity Technologies

    Joined:
    Jul 9, 2019
    Posts:
    10
    Hi
    Would it be possible to provide full editor logs?

    Also please check if you can talk to license.unity3d.com

    Regards,
    Amir
     
    Last edited: Oct 16, 2019
  10. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    Which log would that be? Where would I find it? What i pasted in the original comment is the full contents of log.txt that was generated by the command I pasted. Is there a log elsewhere I can look at?
     
  11. Amir_AZNK

    Amir_AZNK

    Unity Technologies

    Joined:
    Jul 9, 2019
    Posts:
    10
    It seems that the is a problem that prevents full logs to be shown.

    Editor logs on windows machine are located at: C:\Users\<your username>\AppData\Local\Unity\Editor\Editor.log

    It seems that if '-nographics' is used, there is no log. Now lets try this scenario. Remove '-nographics' and '-logfile log.txt' arguments and see if new Editor.log file is generated at the specified location.

    For security reasons don't post your Editor.log file here. Direct message please.

    Regards,
     
  12. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    Running without the parameters you specified produces no console output at all. The Editor.log file you mentioned is exactly the same as the contents I pasted in the original comment.
     
  13. Amir_AZNK

    Amir_AZNK

    Unity Technologies

    Joined:
    Jul 9, 2019
    Posts:
    10
    I am installing 2019.1.14f now to see what do I get.
     
  14. Amir_AZNK

    Amir_AZNK

    Unity Technologies

    Joined:
    Jul 9, 2019
    Posts:
    10
    Alright. I tried with 2019.1.14f and I got exactly the same output as what you got, however only if I disable my network adaptor. In the case that I am connected to internet I have more logs and activation is successful.

    Technically this log is not helping at all.

    This MIGHT be a legacy issue that was hopefully fixed in one of the current Pre-Releases.

    Kindly install Unity 2020.1.0a8 and 2019.3.0b7 (can be downloaded easily through Unity HUB) and run them within the container. Capture the same Editor.log file across different runs. Hopefully we will get more insight as the root cause of this issue after this experiment.

    Regards,
    Amir
     
  15. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    Hey Amir,

    I tried again with Unity 2020.1.0a8 and here's the log:


    [Licensing::Module] Channel doesn't exist: "LicenseClient-ContainerAdministrator"
    [Licensing::Module] Successfully launched the LicensingClient (PId: 5944)
    [Licensing::Module] Successfully connected to LicensingClient on channel: "LicenseClient-ContainerAdministrator"
    Entitlement-based licensing initiated
    [LicensingClient] Licenses updated successfully
    BatchMode: Unity has not been activated with a valid License. Could be a new activation or renewal...
    (Filename: C:\buildslave\unity\build\Platforms/Windows/Modules/LicensingLegacy/WinILicensingAdapter.cpp Line: 44)

    DisplayProgressbar: Unity license
    [Licensing::Module] Error: License is not active (com.unity.editor.headless). HasEntitlements will fail.
    Cancelling DisplayDialog: Failed to activate/update license Failed to activate license within 60 seconds. Please try aga
    in later or contact support@unity3d.com
    This should not be called in batch mode.
    (Filename: C:\buildslave\unity\build\Editor/Platform/Windows/EditorUtility.cpp Line: 1116)

    Exiting without the bug reporter. Application will terminate with return code 1
     
  16. Amir_AZNK

    Amir_AZNK

    Unity Technologies

    Joined:
    Jul 9, 2019
    Posts:
    10
    I looked at the logs and still now much from there. I have same logs as your logs only when I don't have internet connection.

    Still I am leaning toward having no internet access. To see that yourself try running it on regular Windows machine (or any machine not within container) as you mentioned you had successful experience activating a license file. You will see the amount of details and addresses that Unity is trying to connect. And then try to ping each one of them from the container (i.e. license.unity3d.com).

    Kindly post your experience here so that we can move forward from there.

    Regards
     
  17. tgwozdz_unity

    tgwozdz_unity

    Joined:
    Aug 6, 2019
    Posts:
    8
    Here's the log from Unity 2019.3.0b7


    [LicensingClient] ERROR Failed to connect to local IPC
    [Licensing::Module] Failed to connect to channel: LicenseClient-ContainerAdministrator
    [Licensing::Module] Successfully launched the LicensingClient
    [Licensing::Module] Successfully connected to LicensingClient on channel: LicenseClient-ContainerAdministrator
    [Licensing::Module] Successfully launched and connected to LicensingClient
    Entitlement-based licensing initiated
    [LicensingClient] Licenses Updated successfully in LicensingClient
    BatchMode: Unity has not been activated with a valid License. Could be a new activation or renewal...
    (Filename: C:\buildslave\unity\build\Platforms/Windows/Modules/LicensingLegacy/WinILicensingAdapter.cpp Line: 45)

    DisplayProgressbar: Unity license
    Assertion failed on expression: 'g_BackgroundThread == nullptr'
    (Filename: C:\buildslave\unity\build\Editor/Src/TaskManager.cpp Line: 192)

    [Licensing::Module] License is not active (com.unity.editor.headless). HasEntitlements will fail.
    Cancelling DisplayDialog: Updating license failed Failed to update license within 60 seconds. Exiting.
    This should not be called in batch mode.
    (Filename: C:\buildslave\unity\build\Editor/Platform/Windows/EditorUtility.cpp Line: 1120)

    Exiting without the bug reporter. Application will terminate with return code 1


    I double checked the network connection and I'm indeed able to ping and connect to license.unity3d.com and any other servers that I tried. Networking appears to be working correctly.
     
  18. matissehack

    matissehack

    Joined:
    Oct 5, 2019
    Posts:
    2
    I ran both 2020.1.0a8 and 2019.3.0b7 and got the same output as tgwozdz_unity. The container definitely has a working network connection and I was able to ping license.unity3d.com (it resolved to 35.195.230.199). Happy to try any other troubleshooting steps you can think of!
     
  19. danielo_unity

    danielo_unity

    Unity Technologies

    Joined:
    Apr 12, 2018
    Posts:
    12
    Hi. So within the docker container, we appear to be hitting a network connectivity bug.
    To establish that we indeed have network connectivity, we are calling INetworkListManager::GetConnectivity (similar to what is done here), which appears to be failing.
    We will open a FogBugz to follow this issue, but I'm unsure about the availability of a fix.
     
  20. danielo_unity

    danielo_unity

    Unity Technologies

    Joined:
    Apr 12, 2018
    Posts:
    12
  21. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,390
  22. Nepoxx

    Nepoxx

    Joined:
    Mar 25, 2013
    Posts:
    2
    Why is this issue "Won't fix"? Not being able to active Unity in a docker container is a critical issue. We give your company thousands of dollars to have licenses and the licensing system does not work, how is this not a major issue?
     
  23. etienne_unity

    etienne_unity

    Unity Technologies

    Joined:
    Aug 31, 2017
    Posts:
    55
    Hi @Nepoxx ,

    I re-activated the issue, and we'll look into this if we start to support the Editor in Windows Docker containers.

    Currently, we do not support this (ie: we're not testing releases against this scenario). See this manual page for details. The important bit is:

    Thanks for your understanding.
     
  24. danielo_unity

    danielo_unity

    Unity Technologies

    Joined:
    Apr 12, 2018
    Posts:
    12
    A critical API (to detect internet connectivity) was found to not be working correctly inside the container, so we closed as won't fix. Perhaps we should have said "by-design". ping also did not work for me without a command to the container.

    Investigating further, this API is found to be not working because the netprofm service ("Network List Service") is disabled within the container, either by accident or by design. Re-enabling it is insufficient, as it depends on another service (nlasvc), which must also be re-enabled.
    Furthermore, another critical service is also required, by licensing and perhaps elsewhere: WMI (wmiApSrv).
    I have not investigated beyond this point, but would speculate that there will be other issues (not a huge amount, but some).

    We answered the question (why doesn't licensing work?) at the time, but didn't draw the link to the services which were disabled. Now we know. This is not within our control. It is the docker user's responsibility.

    The Unity Editor is also just a standard Windows application intended for desktop use (with several other satellite processes, that almost always connect to back-end services).
    Docker should be configured such that it does not interfere with its (the Editor's) normal functions (ie. hard dependencies).
    I don't know which part is the users responsibility, vs docker itself, or rather the default settings for Windows images.

    I think the best we could do, is to enumerate the minimum set of dependencies required for use within a standard docker image, but that will take time (especially if we want to support all our major platforms).

    Thanks. Let us know if this helps
     
  25. btristan

    btristan

    Joined:
    Oct 15, 2018
    Posts:
    79
    Listing those dependencies would be awesome. I'm working on the same thing but in Ubuntu. (where 2019.2 and before works but 2019.3 doesn't)
     
  26. Unity2-3drepo

    Unity2-3drepo

    Joined:
    Mar 5, 2019
    Posts:
    2
    seconded, we have this issue, also using ubuntu. We've just updated to 2019.3 and it was working perfectly before in containers.

    I also attempted to allow full access for the container with the following flags, but it didn't resolve it.

    securityContext:
    privileged: true
     
unityunity