xharness icon indicating copy to clipboard operation
xharness copied to clipboard

[apple] Issues installing simulators

Open mattleibow opened this issue 2 years ago • 5 comments

xharness apple simulators install com.apple.pkg.iPhoneSimulatorSDK15_5 -v

The download first always retries:

info: The simulator 'iOS 15.5 Simulator' is missing and will be installed
info: Installing 'iOS 15.5 Simulator' (15.5.1.1653527639)...
info: Downloading 'https://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg' to '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg' because the existing file's size 5415504705 does not match the expected size 5430783739...

But if I download myself and edit the xml file to say it is the size it is:

info: The simulator 'iOS 15.5 Simulator' is missing and will be installed
info: Installing 'iOS 15.5 Simulator' (15.5.1.1653527639)...
info: Mounting '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg' into '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg-mount'...
dbug: 
      
dbug: Running hdiutil attach /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg -mountpoint /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg-mount -quiet -nobrowse
      
dbug: Process hdiutil exited with 0
      
info: Expanding '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg-mount/iPhoneSimulatorSDK15_5.pkg' into '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer-expanded-pkg'...
dbug: 
      
dbug: Running pkgutil --expand /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg-mount/iPhoneSimulatorSDK15_5.pkg /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer-expanded-pkg
      
dbug: Process pkgutil exited with 0
      
info: Creating fixed package '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed.pkg' from '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer-expanded-pkg'...
dbug: 
      
dbug: Running pkgutil --flatten /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer-expanded-pkg /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed.pkg
      
dbug: Process pkgutil exited with 0
      
info: Installing '/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed.pkg'...
dbug: 
      
dbug: Running sudo installer -pkg /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed.pkg -target / -verbose -dumplog
      
dbug: Process sudo exited with 1

     
dbug: Error output:
      Jul  6 01:15:22  installer[41620] <Debug>: Referenced component packages (1) trustLevel=100
      Jul  6 01:15:22  installer[41620] <Debug>: -[IFPKGDerivedDocument sortedPackageLocations]: result = (
      	    "file://localhost"
      	)
      Jul  6 01:15:22  installer[41620] <Debug>: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost
      Jul  6 01:15:22  installer[41620] <Debug>: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/private/var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed.pkg
      Jul  6 01:15:22  installer[41620] <Info>: Set authorization level to root for session
      Jul  6 01:15:22  installer[41620] <Info>: Authorization is being checked, waiting until authorization arrives.
      Jul  6 01:15:22  installer[41620] <Info>: Administrator authorization granted.
      Jul  6 01:15:22  installer[41620] <Info>: Packages have been authorized for installation.
      Jul  6 01:15:22  installer[41620] <Debug>: Will use PK session
      Jul  6 01:15:22  installer[41620] <Debug>: Using authorization level of root for IFPKInstallElement
      Jul  6 01:16:01  installer[41620] <Info>: Starting installation:
      Jul  6 01:16:01  installer[41620] <Notice>: Configuring volume "Macintosh HD"
      Jul  6 01:16:01  installer[41620] <Info>: Preparing disk for local booted install.
      Jul  6 01:16:01  installer[41620] <Notice>: Free space on "Macintosh HD": 695.64 GB (695642796032 bytes).
      Jul  6 01:16:01  installer[41620] <Notice>: Create temporary directory "/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T//Install.41620ZYFiLs"
      Jul  6 01:16:01  installer[41620] <Notice>: IFPKInstallElement (1 packages)
      Jul  6 01:16:01  installer[41620] <Info>: Current Path: /usr/sbin/installer
      Jul  6 01:16:01  installer[41620] <Info>: Current Path: /usr/bin/sudo
      Jul  6 01:16:01  installer[41620] <Notice>: PackageKit: Enqueuing install with framework-specified quality of service (utility)
      Jul  6 01:20:20  installer[41620] <Debug>: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=120 "An unexpected error occurred while moving files to the final destination." UserInfo={NSUnderlyingError=0x600003a9c1b0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}, NSLocalizedDescription=An unexpected error occurred while moving files to the final destination., arguments=(
      	    "-f",
      	    "-s",
      	    "/Library/InstallerSandboxes/.PKInstallSandboxManager/F12AFE79-1393-482F-9EA5-A2C44DD2EDD4.activeSandbox/Root",
      	    "/"
      	)}
      Jul  6 01:20:21  installer[41620] <Error>: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
      
fail: Failed to install package:
      installer: Package name is com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed
      installer: Installing at base path /
      installer: Preparing for installation….....
      installer: Preparing the disk….....
      installer: Preparing com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed….....
      installer: Waiting for other installations to complete….....
      installer: Configuring the installation….....
      installer: 	
      #
      installer: Validating packages….....
      installer: Validating packages….....
      #
      installer: Writing files….....
      installer: Writing files….....

      #
      installer: Writing files….....
      #
      installer: Moving items into place….....
      installer: Validating packages….....
      #
      installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An unexpected error occurred while moving files to the final destination.)
      
dbug: 
      
dbug: Running hdiutil detach /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639.dmg-mount -quiet
      
dbug: Process hdiutil exited with 0
      
fail: Failed to install 'iOS 15.5 Simulator'

mattleibow avatar Jul 05 '23 23:07 mattleibow

I ran the install manually and this is the error... Maybe it is my M1?

Screenshot 2023-07-06 at 1 28 57 AM

mattleibow avatar Jul 05 '23 23:07 mattleibow

@mattleibow I see all the simulator installation issues and I cannot be of much help unfortunately. This functionality has been ported over from Xamarin but we've never exercised these commands in our flows - we only use the default iOS version that comes with each Xcode. So I cannot offer more advice in this area. Maybe Rolf has more experience with this.

premun avatar Jul 07 '23 09:07 premun

@mattleibow I think running the installer manually won't work since it looks like the .pkg does have an install location of / (which I assume causes the "trying to install content to the system volume") and we have special code in xharness to fix that: https://github.com/dotnet/xharness/blob/ca022cb79bab7a3402802dadec2755e267156793/src/Microsoft.DotNet.XHarness.CLI/Commands/Apple/Simulators/InstallCommand.cs#L230-L232


Not sure what happened in your case but the "An unexpected error occurred while moving files to the final destination." looks basically the same as https://github.com/dotnet/xharness/issues/840 and afaik it only happened on MAUI machines and we couldn't really figure out the cause back then.

akoeplinger avatar Jul 11 '23 08:07 akoeplinger

I was testing on a cleanish macbook... Not sure if there is more logs to get to help? Or is this basically a case of me just needing to wipe it all and start over?

mattleibow avatar Jul 11 '23 15:07 mattleibow

@mattleibow does it reproduce all the time? you should be able to try manually installing the "fixed" package at /var/folders/x1/2s1cq4312cx35w541x8d45mm0000gn/T/simulator-installer/com.apple.pkg.iPhoneSimulatorSDK15_5-15.5.1.1653527639-fixed.pkg

akoeplinger avatar Jul 11 '23 16:07 akoeplinger