NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.34k stars 14.3k forks source link

Unityhub on unstable(3.4.2) can't open Unity Editor 2019.4.39f1 #236381

Closed loco-choco closed 1 year ago

loco-choco commented 1 year ago

Describe the bug

Unity Hub can't create or open a project using Unity Editor 2019.4.39f1.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Be on nixos 23.05
  2. Install unityhub (3.4.2)
  3. Have unityhub open, go to the unity editor download archieves and press the "Unity Hub" button for the 2019.4.39f1 version.
  4. Install the editor without any additional component.
  5. Try to create a new project, or open a project that is already for 2019.4.39f1.

Expected behavior

It was expected that the editor would open the project.

Screenshots

Screenshot of the editor failing silently to create a new project.

Screenshot_20230606_222142

Screenshot of trying to re-open the new "ghost project".

Screenshot_20230606_222417

Additional context

If you try to create a new project, it will hang and then silently fail, creating a "ghost project", as seen on the screenshots. And if you try to open a previously created project, it will hang and then silently fail.

Notify maintainers

@tesq0 @huantianad

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.31, NixOS, 23.05 (Stoat), 23.05.20230605.70f7275`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - channels(locochoco): `""`
 - channels(root): `"home-manager-22.11.tar.gz, nixos-22.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
huantianad commented 1 year ago

Could you upload the log files ~/.config/unityhub/logs, as well as try running the app from the command line and seeing if there's any relevant information in the command line output?

loco-choco commented 1 year ago

Here is the log file: https://pastebin.com/RFLtQpmh And there is no relevant information that appears on the command line output when trying to run the editor, only these two lines when starting the hub:

libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
APPIMAGE env is not defined, current application is not an AppImage
loco-choco commented 1 year ago

Sorry, that paste didn't have my attempts at creating/opening a newly created project, here is the log file for that https://pastebin.com/qSbzzMxF.

huantianad commented 1 year ago

This may be a unity editor crash, can you check if ~/.config/unity3d/Editor.log has any info after trying to open the diffferent projects?

If it's an editor crash, it may be due to this being a version of unity that uses OpenSSL 1.1, and doesn't support OpenSSL 3. If that's the case, you might want to try to add the deprecated version of openssl to unity yourself:

environment.systemPackages = [
  (pkgs.unityhub.override {
    extraPkgs = pkgs: with pkgs; [
      openssl_1_1
    ];
  })
];
loco-choco commented 1 year ago

No Editor.log file was generated for 2019.4.39f1. I also tried with the overridden package but same result. Edit: I only have logs from trying to open projects with 2021.3.26f1, if those are helpful.

huantianad commented 1 year ago

Hm this is very strange, just to clarify, it works with newer versions of Unity?

loco-choco commented 1 year ago

It opens newer versions of Unity, but they have the same issue as https://github.com/NixOS/nixpkgs/issues/205019. Overriding extraPkgs to use openssl_1_1 sadly didn't help, maybe it is because there is already openssl in there, and it is trying to first load it instead of openssl_1_1?

huantianad commented 1 year ago

I did get the OpenSSL issue on an older version of 2021, but it disappeared after upgrading to 2022. A newer version of 2021 might also fix the issue.

Kinda a long shot but maybe overriding extraLibs instead of extraPkgs would do something different?

loco-choco commented 1 year ago

Yeah, sadly that didn't change anything.

huantianad commented 1 year ago

Hm just tested myself and adding openssl_1_1 to extraLibs did seem to make the libssl error go away in one of my 2021.3.16f1 projects. Is there some reason that this wouldn't be consistent across systems?

I'm not sure if we should even support Unity 2019, since it is end of life on Unity's side, I believe.

loco-choco commented 1 year ago

Sadly I need it for modding, because assetbundles are very version dependent, so I at least the same major version. Also did it work with just changing the hub, or did you need to reinstall the editor?

huantianad commented 1 year ago

These were the steps I did:

  1. Open the hub and the project, note the libssl error.
  2. Quit the hub.
  3. Edit my system config with the change and rebuild
  4. Open the hub and the project, no error. Didn't need to reinstall the editor, this was on editor 2021.3.16f1
loco-choco commented 1 year ago

Oh strange, I redid the steps and it is working with 2021.3.26f1, but this time I opened the hub from the terminal, maybe it is related to me installing it on the user. But sadly 2019 is still a no go, well at least that solves part of the problem, thanks.

huantianad commented 1 year ago

I'll post this as a solution to #205019, but we'll have to probably do some more research for 2019.

huantianad commented 1 year ago

For debugging purposes, can you get the log file from a session where all you do is launch the hub, and try to open a 2019 project?

loco-choco commented 1 year ago

Sadly pastebin didnt allow the file because of its size, but here it is https://drive.google.com/file/d/1gXykutRAGpzd83l6rnUVo9Ev4De2hFHe/view?usp=sharing. From looking at it, the error is talking about missing path, but the project is 100% there, as I got it from cloning a repository.

huantianad commented 1 year ago

Relevant errors for users following:

{"timestamp":"2023-06-07T00:39:33.307Z","level":"info","moduleName":"LocalProjectService","message":"[ 'createProject projectPath: /home/locochoco/ow-mods/unity-projects/My project, editor version: 2019.4.39f1, edtitor architecture x86_64' ]"}
{"timestamp":"2023-06-07T00:39:33.319Z","level":"info","moduleName":"LaunchProcess","message":"[ 'Spawning editor instance with command: ', '/home/locochoco/Unity/Hub/Editor/2019.4.39f1/Editor/Unity', ', and arguments: ', [ '-createproject', '/home/locochoco/ow-mods/unity-projects/My project', '-cloneFromTemplate', '/home/locochoco/Unity/Hub/Editor/2019.4.39f1/Editor/Data/Resources/PackageManager/ProjectTemplates/com.unity.template.3d-4.2.8.tgz', '-cloudOrganization', '', '-cloudEnvironment', 'production', '-useHub', '-hubIPC', '-hubSessionId', 'd9cbb51f-12c6-4f39-9efa-17531f056ca4', '-accessToken', 'nSDir10xvwQVkOmLjifCyw2ZbPn7ANCvCgQRrMcwHjU004f' ] ]"}
{"timestamp":"2023-06-07T00:39:33.329Z","level":"info","moduleName":"LaunchProcess","message":"[ 'child process exited with code 127' ]"}
{"timestamp":"2023-06-07T00:41:08.219Z","level":"error","moduleName":"LocalProjectService","message":"[\n  'Error while opening a local new project: ',\n  ProjectError\n      at ProjectValidatorService.<anonymous> (/nix/store/s9q86w3i8a2djjgp86z74ly54bkkp8h6-unityhub-3.4.2/opt/unityhub/resources/app.asar/build/main/services/projectService/ProjectValidatorService.js:51:23)\n      at Generator.next (<anonymous>)\n      at fulfilled (/nix/store/s9q86w3i8a2djjgp86z74ly54bkkp8h6-unityhub-3.4.2/opt/unityhub/resources/app.asar/build/main/services/projectService/ProjectValidatorService.js:5:58) {\n    errorCode: 'ERROR.PROJECT.PATH_NOT_FOUND',\n    projectName: undefined,\n    projectVersion: undefined,\n    projectArchitecture: undefined,\n    projectPath: undefined\n  }\n]"}
{"timestamp":"2023-06-07T00:41:08.220Z","level":"error","moduleName":"LocalProjectService","message":"[ 'Error while opening project: {\"code\":400,\"error\":{\"errorCode\":\"ERROR.PROJECT.PATH_NOT_FOUND\",\"projectName\":\"My project\",\"projectVersion\":\"2019.4.39f1\",\"projectArchitecture\":\"x86_64\",\"projectPath\":\"/home/locochoco/ow-mods/unity-projects/My project\"}}' ]"}

My one guess would be to remove the space in the project name? Otherwise I'm unsure what could be causing this. Perhaps older Unity editor doesn't handle spaces in project names correctly. I saw this thread on reddit but might not be relevant. https://www.reddit.com/r/unity/comments/tuw1fb/project_errorprojectpath_not_found_on_mac/

loco-choco commented 1 year ago

Renamed the project to My-project, strangely that project is for unity 2021, not unity 2019, but either way it still didn't work, here is the new log file https://drive.google.com/file/d/1GYiMCjBSaxn8zJyNHgKhMe3Aw-d9dLFL/view?usp=sharing. The project I tried to open with unity 2019 is called outer-wilds-unity-example. Found these strange messages on line 2301, it is erroring when creating a new project, but the editor was spawned to open an existing project.

{"timestamp":"2023-06-07T01:24:10.334Z","level":"info","moduleName":"LaunchProcess","message":"[ 'Spawning editor instance with command: ', '/home/locochoco/Unity/Hub/Editor/2019.4.39f1/Editor/Unity', ', and arguments: ', [ '-projectpath', '/home/locochoco/ow-mods/unity-projects/outer-wilds-unity-template', '-useHub', '-hubIPC', '-cloudEnvironment', 'production', '-licensingIpc', 'LicenseClient-locochoco', '-hubSessionId', '8d1c7d7e-8939-454d-b4de-501ad6cd2f8b', '-accessToken', 'nSDir10xvwQVkOmLjifCyw2ZbPn7ANCvCgQRrMcwHjU004f' ] ]"}
{"timestamp":"2023-06-07T01:24:10.347Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Get all entitlement groups' ]"}
{"timestamp":"2023-06-07T01:24:10.347Z","level":"info","moduleName":"LaunchProcess","message":"[ 'child process exited with code 127' ]"}
{"timestamp":"2023-06-07T01:24:10.363Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Successfully received all entitlement groups details' ]"}
{"timestamp":"2023-06-07T01:24:10.363Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Received 1 entitlement groups' ]"}
{"timestamp":"2023-06-07T01:24:10.363Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Get all entitlement groups' ]"}
{"timestamp":"2023-06-07T01:24:10.378Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Successfully received all entitlement groups details' ]"}
{"timestamp":"2023-06-07T01:24:10.378Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Received 1 entitlement groups' ]"}
{"timestamp":"2023-06-07T01:24:12.901Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'checkEntitlements: checking entitlements for: com.unity.editor.ui' ]"}
{"timestamp":"2023-06-07T01:24:12.916Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Successfully checked for entitlements request.' ]"}
{"timestamp":"2023-06-07T01:24:12.920Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Get all entitlement groups' ]"}
{"timestamp":"2023-06-07T01:24:12.923Z","level":"error","moduleName":"LocalProjectService","message":"[\n  'Error while opening a local new project: ',\n  ProjectError\n      at ProjectValidatorService.<anonymous> (/nix/store/s9q86w3i8a2djjgp86z74ly54bkkp8h6-unityhub-3.4.2/opt/unityhub/resources/app.asar/build/main/services/projectService/ProjectValidatorService.js:51:23)\n      at Generator.next (<anonymous>)\n      at fulfilled (/nix/store/s9q86w3i8a2djjgp86z74ly54bkkp8h6-unityhub-3.4.2/opt/unityhub/resources/app.asar/build/main/services/projectService/ProjectValidatorService.js:5:58) {\n    errorCode: 'ERROR.PROJECT.PATH_NOT_FOUND',\n    projectName: undefined,\n    projectVersion: undefined,\n    projectArchitecture: undefined,\n    projectPath: undefined\n  }\n]"}
{"timestamp":"2023-06-07T01:24:12.924Z","level":"error","moduleName":"LocalProjectService","message":"[ 'Error while opening project: {\"code\":400,\"error\":{\"errorCode\":\"ERROR.PROJECT.PATH_NOT_FOUND\",\"projectName\":\"My project (1)\",\"projectVersion\":\"2019.4.39f1\",\"projectArchitecture\":\"x86_64\",\"projectPath\":\"/home/locochoco/ow-mods/unity-projects/My project (1)\"}}' ]"}
bddvlpr commented 1 year ago

I'm having the same issue on 2019.4.31f1. I installed 2022.3.3f1 to test and it works correctly on that version.

{"timestamp":"2023-06-25T17:18:31.427Z","level":"info","moduleName":"LaunchProcess","message":"[ 'Spawning editor instance with command: ', '/home/bddvlpr/.local/share/unity3d/2019.4.31f1/Editor/Unity', ', and arguments: ', [ '-createproject', '/home/bddvlpr/Documents/Unity/REDACTED', '-cloneFromTemplate', '/home/bddvlpr/.local/share/unity3d/2019.4.31f1/Editor/Data/Resources/PackageManager/ProjectTemplates/com.unity.template.3d-4.2.8.tgz', '-cloudOrganization', '', '-cloudEnvironment', 'production', '-useHub', '-hubIPC', '-hubSessionId', 'REDACTED', '-accessToken', 'REDACTED' ] ]"}
{"timestamp":"2023-06-25T17:18:31.435Z","level":"info","moduleName":"LicensingSdkService","message":"[ 'Get all entitlement groups' ]"}
{"timestamp":"2023-06-25T17:18:31.438Z","level":"info","moduleName":"LaunchProcess","message":"[ 'child process exited with code 127' ]"}

If only the logs were more verbose...

huantianad commented 1 year ago

I've been putting off actually testing locally, but since multiple people are having this problem, I'll see if I have any luck reproducing this on 2019 later today.

bddvlpr commented 1 year ago

I tried manually initializing a project by extracting the template from the given path under the installed Unity version. Seems like it still exits Unity on launch with the same 127 exit code.

huantianad commented 1 year ago

Man this was such an easy problem to solve, the 2019 version of the editor simply depended on some extra libraries that the newer version no longer depend on. I'll list them here so you can add them temporarily, and I'll also update the package to include them.

xorg.libXi
xorg.libXrender
gnome2.GConf
libcap

For future reader's reference, because the unityhub log didn't include which libraries we were missing, I instead manually ran the editor from the FHS env directly. To find the path to the FHS env, I usually vim the unityhub binary, which is a simple wrapper that runs the real binary with the FHS env, so you can just copy the path to the FHS env from there.

Perhaps I'll add a simple run script that does something similar to steam-run, which can help with debugging these issues, and could also be useful for launching dev tools and such.

I'll keep this issue open until I get extra confirmation this works, and the extra libraries are added to the main package.

bddvlpr commented 1 year ago

It indeed works with the missing dependencies. Thanks a lot for your help.