munki / munki

Managed software installation for macOS —

Home Page:https://www.munki.org/munki/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MSC 6.2.1.4599 crashes on macOS 10.13

workflowsguy opened this issue · comments

MSC 6.2.1.4599 crashes on macOS 10.13.

Cause according to the Crash report:

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    DYLD, [0x3] Wrong version

Application Specific Information:
dyld: launch, loading dependent libraries

Dyld Error Message:
  Library not loaded: @rpath/libswiftAppKit.dylib
  Referenced from: /Applications/Managed Software Center.app/Contents/MacOS/Managed Software Center
  Reason: Incompatible library version: Managed Software Center requires version 45.0.0 or later, but libswiftAppKit.dylib provides version 1.0.0

The previous MSC version 6.2.0.4576 worked correctly under 10.13.
As I understand from the section "Munki Versions" on https://github.com/munki/munki/wiki, 10.13 should still be supported?

I'll be completely honest and say that I'm not actually testing on anything before macOS 11 any longer (and realistically, the testing on macOS 11 is pretty thin).

The actual code changes between MSC 6.2.0 and 6.2.1 are very unlikely in themselves to have caused an incompatibility with macOS 10.13. I think it's more likely that the fact that the release package was built under Xcode 15.0.1 on macOS Sonoma is the cause.

Since I'll be building on Sonoma for the near future, if there isn't a way to convince Xcode 15.0.1 to build MSC.app in a way that's compatible with macOS 10.13, we may have to just say 10.13 is no longer supported.

If you can build Munki with Xcode 14 on Ventura, you might be able to test my guesses here (and have a fix for yourself). I might have time later today to do a build with Xcode 14 on Ventura as well.

I'm told the MacAdmins signed build of Munki 6.3.4 here: https://github.com/macadmins/munki-builds/releases/tag/v6.3.4.4599 was built with Ventura and Xcode 14. Is this the package you are using? If no, can you try this one and see if MSC.app behaves the same?

Oddly I'm seeing no difference in the required libswiftAppKit.dylib between Munki 6.3.4 (which includes MSC 6.2.1.4599) and Munki 6.3.3 (which includes MSC 6.2.0.4576):

$ sudo installer -pkg ~/Downloads/munkitools-6.3.4.4599.pkg -target /
installer: Package name is Munki - Software Management for macOS
installer: Upgrading at base path /
installer: The upgrade was successful.
$ otool -L /Applications/Managed\ Software\ Center.app/Contents/MacOS/Managed\ Software\ Center | grep libswiftAppKit
	@rpath/libswiftAppKit.dylib (compatibility version 45.0.0, current version 2483.0.0)
	/usr/lib/swift/libswiftAppKit.dylib (compatibility version 45.0.0, current version 2483.0.0)
$ sudo installer -pkg ~/Downloads/munkitools-6.3.3.4593.pkg -target /
installer: Package name is Munki - Software Management for macOS
installer: Upgrading at base path /
installer: The upgrade was successful.
$ otool -L /Applications/Managed\ Software\ Center.app/Contents/MacOS/Managed\ Software\ Center | grep libswiftAppKit
	@rpath/libswiftAppKit.dylib (compatibility version 45.0.0, current version 2483.0.0)
	/usr/lib/swift/libswiftAppKit.dylib (compatibility version 45.0.0, current version 2483.0.0)

@workflowsguy See #1191 (comment) Any more info to provide? For example: which package are you using? The one from this GitHub site, or the one from MacAdmins Open Source? Have you tried building it yourself with an older Xcode?

@gregneagle,
thank you for looking into this.

We use the com.github.autopkg.munki.munkitools6 recipe, which as I understand, downloads the unsigned package published on github.

I will test how the signed package from MacAdmins (of which I was not aware until you mentioned it) behaves.

Compiling the sources with Xcode myself is not an option as I am not a programmer and do not know or have the capacity to learn Xcode or build a development infrastructure (I am doing the sysadmin work pro bono in addition to my regular job).

I just ran the MacAdmins version of the recipe.

The package downloaded is munkitools-6.3.4.4599.pkg, with minimum_os_version = 10.13
It contains MSC version 6.2.1.4599, which shows minimum_os_version = 10.14

You don't need to "be a programmer" to build a Munki package. You do need Xcode installed (or maybe just the Xcode Command Line Tools):

$ cd /Users/Shared/
$ git clone https://github.com/munki/munki.git
Cloning into 'munki'..
<snip>
$ cd munki
$ ./code/tools/make_munki_mpkg.sh

https://github.com/munki/munki/wiki/Building-Munki-packages#procedure

I had forgotten that when using Apple's installer to install an older version of a package, it often decides to skip the install of Application bundles if that would result in a downgrade. I got around that by first removing the MSC.app application bundle. Once I did that, I could see a clear difference in the libswiftAppKit.dylib linkage:

$ sudo rm -r /Applications/Managed\ Software\ Center.app
$ sudo installer -pkg munkitools-6.3.3.4593.pkg -target /
installer: Package name is Munki - Software Management for macOS
installer: Upgrading at base path /
installer: The upgrade was successful.
$ otool -L /Applications/Managed\ Software\ Center.app/Contents/MacOS/Managed\ Software\ Center | grep libswiftAppKit
	@rpath/libswiftAppKit.dylib (compatibility version 1.0.0, current version 113.0.0)
	/usr/lib/swift/libswiftAppKit.dylib (compatibility version 1.0.0, current version 113.0.0)

Compare to Munki 6.3.4, built on a Sonoma machine:

$ sudo installer -pkg munkitools-6.3.4.4599.pkg -target /
installer: Package name is Munki - Software Management for macOS
installer: Upgrading at base path /
installer: The upgrade was successful.
$ otool -L /Applications/Managed\ Software\ Center.app/Contents/MacOS/Managed\ Software\ Center | grep libswiftAppKit
	@rpath/libswiftAppKit.dylib (compatibility version 45.0.0, current version 2483.0.0)
	/usr/lib/swift/libswiftAppKit.dylib (compatibility version 45.0.0, current version 2483.0.0)

Next, I will build a munkitools-6.3.4 package on a Ventura machine (running Xcode 14) to compare.

$ sudo rm -r /Applications/Managed\ Software\ Center.app
$ sudo installer -pkg munkitools-6.3.4.4599-ventura.pkg -target /
installer: Package name is Munki - Software Management for macOS
installer: Upgrading at base path /
installer: The upgrade was successful.
bagel:Downloads gneagle$  otool -L /Applications/Managed\ Software\ Center.app/Contents/MacOS/Managed\ Software\ Center | grep libswiftAppKit
	@rpath/libswiftAppKit.dylib (compatibility version 1.0.0, current version 113.0.0)
	/usr/lib/swift/libswiftAppKit.dylib (compatibility version 1.0.0, current version 113.0.0)

So we see the MSC.app in the pkg built under Ventura and Xcode 14.3.1 is linked to the same libswiftAppKit.dylib as was the MSC.app included with munkitools-6.3.3. Can you test this package under macOS 10.13?

https://www.dropbox.com/scl/fi/laxj0is6btdjfd51bcak7/munkitools-6.3.4.4599-ventura.pkg?rlkey=op54l0j3g0lht8mhy9odtke4i&dl=0

The Mac Admins Open Source package here: https://github.com/macadmins/munki-builds/releases/download/v6.3.4.4599/munkitools-6.3.4.4599.pkg was also built on Ventura and with Xcode 14 (see https://github.com/macadmins/munki-builds/blob/main/.github/workflows/build_munki.yml). When I install this package I can verify it links to the correct version of libswitftAppKit.dylib:

$ sudo rm -r /Applications/Managed\ Software\ Center.app
$ sudo installer -pkg munkitools-6.3.4.4599-maos.pkg -target /
installer: Package name is Munki - Software Management for macOS
installer: Upgrading at base path /
installer: The upgrade was successful.
bagel:Downloads gneagle$ otool -L /Applications/Managed\ Software\ Center.app/Contents/MacOS/Managed\ Software\ Center | grep libswiftAppKit
	@rpath/libswiftAppKit.dylib (compatibility version 1.0.0, current version 113.0.0)
	/usr/lib/swift/libswiftAppKit.dylib (compatibility version 1.0.0, current version 113.0.0)

It also looks to me that the munkitools6-signed.munki recipe sets the minimum_os_version to 10.13: https://github.com/autopkg/recipes/blob/18804eadaa43c9b38a96975f0f69d8a2518a4aad/munkitools/munkitools6-signed.munki.recipe#L370-L371 so I'm not understanding what you are saying here: #1191 (comment)

My belief is that the Mac Admins Open Source package here: https://github.com/macadmins/munki-builds/releases/download/v6.3.4.4599/munkitools-6.3.4.4599.pkg will work on macOS 10.13, as will the (unsigned) package I built here: https://www.dropbox.com/scl/fi/laxj0is6btdjfd51bcak7/munkitools-6.3.4.4599-ventura.pkg?rlkey=op54l0j3g0lht8mhy9odtke4i&dl=0

If that's the case, the temporary fix is to build the Munki packages on Ventura+Xcode 14.3.1 until Apple fixes the bug with Xcode 15. Some comments online seem to indicate this is fixed in the current Xcode 15.1 beta. I'm hoping for an official Xcode 15.1 release soon.

@workflowsguy Can you test and provide an update? #1191 (comment)

@workflowsguy I could really use your help here, as you are the only person I know that's running Munki on macOS 10.13.

@gregneagle sorry for the delayed reply (I had to take care of urgent personal matters in the last days).

The MSC.app from the package in the link runs as expected on macOS 10.13.6.

Thanks for your help (and I hope everything is now OK with you). I'm going to close this as we now understand the cause and we have a fix.

Recommended pkg for Munki 6.3.4: https://github.com/macadmins/munki-builds/releases/download/v6.3.4.4599/munkitools-6.3.4.4599.pkg

I'm going to close this as we now understand the cause and we have a fix.

Great! Thank you for adressing this issue.

I just built MSC.app with Xcode 15.1 on macOS 14.2, and it's appears to be linked to the "right" version of libswiftAppKit.dylib:
/usr/lib/swift/libswiftAppKit.dylib (compatibility version 1.0.0, current version 1.0.0)