Search Unity

Bug Errors rebuilding projects on NTFS partition from Linux

Discussion in 'Linux Editor' started by Nicholas Rishel, Aug 27, 2015.

  1. Nicholas Rishel

    Nicholas Rishel

    Joined:
    May 7, 2013
    Posts:
    16
    Edit: Solved, the issue was an incorrectly setup /etc/fstab. This link shows how to correctly setup that file, other references left out the uid and gid details causing the partitions to be mounted as root. Only solved part of the problem. Following issue found with processes not closing.

    From a fresh project made from Linux on an NTFS partition it currently builds Linux x86_64 files which can't be run. This is an issue for dual boot systems with a shared partition as NTFS is the default recommendation.

    First time builds without error but can't run. Trying to run as root returns:

    Code (Terminal):
    1. sudo: unable to execute ./test.x86_64: Permission denied
    Second build and later returns the error:

    Code (UnityConsole):
    1. ArgumentException: Path is empty
    2. System.IO.Directory.CreateDirectory (System.String path) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/Directory.cs:78)
    3. UnityEditor.BuildPlayerWindow.PickBuildLocation (BuildTarget target, BuildOptions options, System.Boolean& updateExistingBuild) (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:1473)
    4. UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions, Boolean first) (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:549)
    5. UnityEditor.BuildPlayerWindow.BuildPlayerWithDefaultSettings (Boolean askForBuildLocation, BuildOptions forceOptions) (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:444)
    6. UnityEditor.BuildPlayerWindow.GUIBuildButtons (IBuildWindowExtension buildWindowExtension, Boolean enableBuildButton, Boolean enableBuildAndRunButton, Boolean canInstallInBuildFolder, UnityEditor.BuildPlatform platform) (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:1422)
    7. UnityEditor.BuildPlayerWindow.ShowBuildTargetSettings () (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:1361)
    8. UnityEditor.BuildPlayerWindow.OnGUI () (at /home/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindow.cs:1009)
    9. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)
    10. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    11. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232)
    12. System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115)
    13. UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /home/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:185)
    14. UnityEditor.HostView.Invoke (System.String methodName) (at /home/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:178)
    15. UnityEditor.HostView.OnGUI () (at /home/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:74)
    16. =
    The project directory can't be deleted even after exiting Unity and logging in and out of the Linux session. sudo rm -rf similarly doesn't work. A reboot is required to delete the project folder.

    On NTFS partition:

    Code (Terminal):
    1. ls -l
    2. total 23596
    3. drwxrwxrwx 1 root root  0 Aug 27 17:37 Assets
    4. drwxrwxrwx 1 root root  4096 Aug 27 17:38 Library
    5. drwxrwxrwx 1 root root  4096 Aug 27 17:37 ProjectSettings
    6. drwxrwxrwx 1 root root  4096 Aug 27 17:38 Temp
    7. drwxrwxrwx 1 root root  4096 Aug 27 17:38 test_Data
    8. -rwxrwxrwx 1 root root 24144504 Aug 27 17:38 test.x86_64
    On EXT4 partition

    Code (Terminal):
    1. drwxr-xr-x 2 nicholas nicholas  4096 Aug 27 17:44 Assets
    2. drwxr-xr-x 5 nicholas nicholas  4096 Aug 27 17:44 Library
    3. drwxr-xr-x 2 nicholas nicholas  4096 Aug 27 17:44 ProjectSettings
    4. drwxr-xr-x 4 nicholas nicholas  4096 Aug 27 17:44 Temp
    5. drwxrwxr-x 6 nicholas nicholas  4096 Aug 27 17:44 test_Data
    6. -rwxr-xr-x 1 nicholas nicholas 24144504 Aug 27 17:44 test.x86_64
    I confirmed this issue on both a Windows and bare NTFS partition, but didn't have any non-NTFS non-Linux install partitions to check on. Both partitions were mounted in /etc/fstab in the following fashion:
    UUID="[Partition UUID]" /mnt/[Partition Name]/ ntfs-3g auto,user,rw 0 0
     
    Last edited: Sep 19, 2015
  2. whatyouwant

    whatyouwant

    Joined:
    Dec 21, 2013
    Posts:
    2
    This isn't a bug with Unity3D. NTFS-3G defaults to noexec by default, I believe. Generally, you don't want to build to and run off of an NTFS partition because of permissions issues. If you want to work off of your NTFS partition, the best way around this is to set the build directory to a Linux partition and running off of there. Alternatively, you can try adding 'exec' and 'nosuid' flags to your fstab.
     
  3. Nicholas Rishel

    Nicholas Rishel

    Joined:
    May 7, 2013
    Posts:
    16
    Edit: solved, see top post

    Thanks @whatyouwant, that does make more sense.

    Edit: I'm now getting the following error when trying to build to an EXT4 partition from a project on and NTFS partition.
    Code (Unity Console):
    1. Error building Player: IOException: Failed to Move File / Directory from 'Temp/StagingArea/Data' to 'Temp/StagingArea/assets/bin/Data'.
    Would it make sense for this to be a symptom of NTFS-3G defaulting to noexec?

    Also, why would defaulting to noexec cause issues where files can't be deleted, specifically Library and Temp/StagingArea/assets/bin/Data
     
    Last edited: Sep 10, 2015
  4. Nicholas Rishel

    Nicholas Rishel

    Joined:
    May 7, 2013
    Posts:
    16
    I think there might be an issue with Unity Shader processes not terminating. I don't know why it would only affect projects on NTFS partitions. I have narrowed down a work around to the error:
    Code (Unity Console):
    1. Error building Player: IOException: Failed to Move File / Directory from 'Temp/StagingArea/Data' to 'Temp/StagingArea/assets/bin/Data'.
    Code (Terminal):
    1. sudo rm -rf Temp/
    2. rm: cannot remove ‘Temp/StagingArea/assets/bin/Data’: Directory not empty
    Code (Terminal):
    1. lsof +D Temp/
    2. COMMAND  PID  USER  FD  TYPE DEVICE SIZE/OFF  NODE NAME
    3. UnityShad 2398 nicholas  71w  REG  8,5  8579840 29971 Temp/StagingArea/assets/bin/Data/.fuse_hidden000004db00000013
    4. UnityShad 2398 nicholas  72w  REG  8,5  0 29972 Temp/.fuse_hidden000004dc0000000e
    5. UnityShad 2398 nicholas  73w  REG  8,5  0 29973 Temp/.fuse_hidden000004dd0000000f
    6. UnityShad 2398 nicholas  74w  REG  8,5  0 29974 Temp/.fuse_hidden000004de00000010
    7. UnityShad 2398 nicholas  82u  REG  8,5  0  212 Temp/.fuse_hidden0000012d0000000d
    8. UnityShad 2399 nicholas  71w  REG  8,5  8579840 29971 Temp/StagingArea/assets/bin/Data/.fuse_hidden000004db00000013
    9. UnityShad 2399 nicholas  72w  REG  8,5  0 29972 Temp/.fuse_hidden000004dc0000000e
    10. UnityShad 2399 nicholas  73w  REG  8,5  0 29973 Temp/.fuse_hidden000004dd0000000f
    11. UnityShad 2399 nicholas  74w  REG  8,5  0 29974 Temp/.fuse_hidden000004de00000010
    12. UnityShad 2399 nicholas  82u  REG  8,5  0  212 Temp/.fuse_hidden0000012d0000000d
    Code (Terminal):
    1. pstree
    2. init─┬─...
    3.      ├─lightdm─┬─...
    4.      │         ├─lightdm─┬─init─┬─2*[UnityShaderComp]
    Killing the UnityShaderComp process fixed the issue for one Build & Run, but has to be repeated after every Build & Run otherwise the issue returns.

    This issue persists even if Unity is closed/opened until the Unity Shader processes are killed or the system rebooted.

    Also of note, tipped off by by a solution posted here by @Mebius where the developer couldn't build until they deleted the project's Temp/ directory - I assume on Windows but could have been Mac.
     
    Last edited: Sep 19, 2015