munki/createOSXinstallPkg

Error message on 10.12.4 bundle

aysiu opened this issue · 23 comments

aysiu commented

When running

sudo ./createOSXinstallPkg --source /Applications/Install\ macOS\ Sierra.app/

an error pops up of

Can't find brtool at /Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallESD.dmg

Could be something new in the way Apple is packaging up these upgrade bundles.

I will second this one!

When running

sudo /Users/auser/Desktop/createOSXinstallPkg-master/createOSXinstallPkg --source /Applications/Install\ macOS\ Sierra.app --output /Users/auser/Desktop/

I get

Can't find brtool at /Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallESD.dmg

aysiu commented

This is the code that's looking for it. I dug around in the bundle and even the InstallESD.dmg and its .pkgs and .mkpg, and I couldn't spot a new location.

brtool_path = os.path.join(source, 'Contents/Resources/brtool')
if not os.path.exists(brtool_path):
fail('Can\'t find brtool at %s' % installesd_dmg)

Please try https://github.com/erikng/createOSXinstallPkg/tree/10_12_4

If you can, please specifically test with additional packages.

aysiu commented

Thanks, @erikng. I'll give it a shot sans additional packages first.

aysiu commented

The creation of both (with and without additional packages) worked. Now I just have to double-check that the resulting .pkg does a successful upgrade.

aysiu commented

@erikng, so far I've just tested pkgs created both with and without additional packages, but both are failing to upgrade my test clients.

Mar 27 15:52:43 MACHINENAME installd[309]: PackageKit: ----- Begin install -----
Mar 27 15:53:46 MACHINENAME installd[309]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “InstallOSX_10.12.4_16E195.pkg”." UserInfo={NSFilePath=./postflight, NSURL=file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/, PKInstallPackageIdentifier=com.googlecode.munki.installosx.pkg, NSLocalizedDescription=An error occurred while running scripts from the package “InstallOSX_10.12.4_16E195.pkg”.} {
	    NSFilePath = "./postflight";
	    NSLocalizedDescription = "An error occurred while running scripts from the package \U201cInstallOSX_10.12.4_16E195.pkg\U201d.";
	    NSURL = "file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/";
	    PKInstallPackageIdentifier = "com.googlecode.munki.installosx.pkg";
	}
Mar 27 15:53:47 MACHINENAME Installer[404]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
Mar 27 15:53:47 MACHINENAME Installer[404]: Displaying 'Install Failed' UI.
Mar 27 15:53:47 MACHINENAME Installer[404]: 'Install Failed' UI displayed message:'The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.

Getting reports from others that custom packages don't work, but normal packages do.

That log only shows a custom package. Can you try again without one and post logs if it does indeed fail?

Also, I updated my fork and it will no longer allow you to use the -p option with 10.12.4

Just gonna leave this here for context later...

System Integrity Protection

Available for: macOS Sierra 10.12.3
Impact: A malicious application may be able to modify protected disk locations
Description: A validation issue existed in the handling of system installation. This issue was addressed through improved handling and validation during the installation process.
CVE-2017-6974: Patrick Wardle of Synack

-- https://support.apple.com/en-us/HT207615 & https://objective-see.com/blog/blog_0x14.html

I'm not 100% sure but that CVE looks like it's related from all the chatter I have seen.

I just tried the new 10.12.4 download and it created the pkg just fine, but I tried on two computers and the install failed upgrading from 10.11.6... I was still able to update the clients fine using a 10.12.3 pkg I created...
This is just plain, without any additional packages either. (Sorry I forgot to add that when I first posted this)

aysiu commented

Yeah, @erikng. I'm also getting a failure even on the one created without additional packages. Let me see if I can get some verbose output to see exactly where it's failing.

aysiu commented

All right, here's the log (this is the one without additional packages):

Mar 28 08:04:54 COMPUTERNAME Installer[493]: macOS  Installation Log
Mar 28 08:04:54 COMPUTERNAME Installer[493]: Opened from: /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg
Mar 28 08:04:55 COMPUTERNAME Installer[493]: Product archive /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg trustLevel=100
Mar 28 08:04:55 COMPUTERNAME Installer[493]: External component packages (1) trustLevel=100 (trust evaluation failed: Error Domain=PKInstallErrorDomain Code=106 "The package “%@” is missing or invalid." UserInfo={NSLocalizedDescription=The package “%@” is missing or invalid., identifier=com.googlecode.munki.installosx.pkg})
Mar 28 08:04:57 COMPUTERNAME Installer[493]: InstallerStatusNotifications plugin loaded
Mar 28 08:05:02 COMPUTERNAME Installer[493]: Administrator authorization granted.
Mar 28 08:05:03 COMPUTERNAME Installer[493]: ================================================================================
Mar 28 08:05:03 COMPUTERNAME Installer[493]: User picked Standard Install
Mar 28 08:05:03 COMPUTERNAME Installer[493]: Choices selected for installation:
Mar 28 08:05:03 COMPUTERNAME Installer[493]: 	Install: "macOS"
Mar 28 08:05:03 COMPUTERNAME Installer[493]: 	Install: "(null)"
Mar 28 08:05:03 COMPUTERNAME Installer[493]: 		InstallOSX_10.12.4_16E195.pkg : manual : 1.0
Mar 28 08:05:03 COMPUTERNAME Installer[493]: ================================================================================
Mar 28 08:05:03 COMPUTERNAME Installer[493]: It took 0.00 seconds to summarize the package selections.
Mar 28 08:05:03 COMPUTERNAME Installer[493]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: location = file://localhost
Mar 28 08:05:03 COMPUTERNAME Installer[493]: -[IFDInstallController(Private) _buildInstallPlanReturningError:]: file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/
Mar 28 08:05:03 COMPUTERNAME Installer[493]: Set authorization level to root for session
Mar 28 08:05:04 COMPUTERNAME Installer[493]: Will use PK session
Mar 28 08:05:04 COMPUTERNAME Installer[493]: Using authorization level of root for IFPKInstallElement
Mar 28 08:05:04 COMPUTERNAME Installer[493]: Starting installation:
Mar 28 08:05:04 COMPUTERNAME Installer[493]: Configuring volume "Macintosh HD"
Mar 28 08:05:04 COMPUTERNAME Installer[493]: Preparing disk for local booted install.
Mar 28 08:05:04 COMPUTERNAME Installer[493]: Free space on "Macintosh HD": 207.94 GB (207936172032 bytes).
Mar 28 08:05:04 COMPUTERNAME Installer[493]: Create temporary directory "/var/folders/56/kvl2_db55_n1cxhlbjj582sw0000gl/T//Install.493iP8yl6"
Mar 28 08:05:04 COMPUTERNAME Installer[493]: IFPKInstallElement (1 packages)
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: Adding client PKInstallDaemonClient pid=493, uid=499 (/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer)
Mar 28 08:05:04 COMPUTERNAME Installer[493]: PackageKit: Enqueuing install with framework-specified quality of service (utility)
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: ----- Begin install -----
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: request=PKInstallRequest <1 packages, destination=/>
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: packages=(
	    "PKJaguarPackage <file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/>"
	)
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: Extracting file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/ (destination=/var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/BD2B364B-68C2-44C0-813A-4B0A0B1B86D7.activeSandbox/Root/tmp, uid=0)
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: prevent user idle system sleep
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: suspending Spotlight indexing
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: suspending backupd
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: Using trashcan path /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/T/PKInstallSandboxTrash/BD2B364B-68C2-44C0-813A-4B0A0B1B86D7.sandboxTrash for sandbox /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/BD2B364B-68C2-44C0-813A-4B0A0B1B86D7.activeSandbox
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: Shoving /var/folders/zz/zyxvpxvq6csfxvn_n0000000000000/C/PKInstallSandboxManager/BD2B364B-68C2-44C0-813A-4B0A0B1B86D7.activeSandbox/Root (1 items) to /
Mar 28 08:05:04 COMPUTERNAME install_monitor[497]: Temporarily excluding: /Applications, /Library, /System, /bin, /private, /sbin, /usr
Mar 28 08:05:04 COMPUTERNAME installd[368]: PackageKit: Executing script "./postflight" in /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources
Mar 28 08:05:04 COMPUTERNAME Installer[493]: LSExceptions [0x7fba615097d0] unloaded
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Could not find brtool
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Updating boot helper partitions failed.
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: / appears to be a CoreStorage volume.
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: macOS Install Data already exists on /. Reusing it.
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Mounting /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Copying kernelcache and boot.efi to /macOS Install Data...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Customized OS install found: False
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Unmounting /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Attempting to link /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg to /macOS Install Data/InstallESD.dmg...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Couldn't create link because: [Errno 30] Read-only file system
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Link not possible. Copying /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg to /macOS Install Data/InstallESD.dmg...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Creating minstallconfig.xml at /macOS Install Data...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Creating index.sproduct at /macOS Install Data...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Creating OSInstallAttr.plist at /macOS Install Data...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Setting OS X installer NVRAM install-product-url variable...
Mar 28 08:06:09 COMPUTERNAME installd[368]: ./postflight: Blessing OS X installer boot environment in /macOS Install Data...
Mar 28 08:06:09 COMPUTERNAME installd[368]: PackageKit: releasing Spotlight indexing
Mar 28 08:06:09 COMPUTERNAME install_monitor[497]: Re-included: /Applications, /Library, /System, /bin, /private, /sbin, /usr
Mar 28 08:06:09 COMPUTERNAME installd[368]: PackageKit: releasing backupd
Mar 28 08:06:09 COMPUTERNAME installd[368]: PackageKit: allow user idle system sleep
Mar 28 08:06:09 COMPUTERNAME installd[368]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “InstallOSX_10.12.4_16E195.pkg”." UserInfo={NSFilePath=./postflight, NSURL=file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/, PKInstallPackageIdentifier=com.googlecode.munki.installosx.pkg, NSLocalizedDescription=An error occurred while running scripts from the package “InstallOSX_10.12.4_16E195.pkg”.} {
	    NSFilePath = "./postflight";
	    NSLocalizedDescription = "An error occurred while running scripts from the package \U201cInstallOSX_10.12.4_16E195.pkg\U201d.";
	    NSURL = "file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/";
	    PKInstallPackageIdentifier = "com.googlecode.munki.installosx.pkg";
	}
Mar 28 08:06:09 COMPUTERNAME installd[368]: PackageKit: Running idle tasks
Mar 28 08:06:09 COMPUTERNAME Installer[493]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “InstallOSX_10.12.4_16E195.pkg”." UserInfo={NSFilePath=./postflight, NSURL=file://localhost/Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/, PKInstallPackageIdentifier=com.googlecode.munki.installosx.pkg, NSLocalizedDescription=An error occurred while running scripts from the package “InstallOSX_10.12.4_16E195.pkg”.}
Mar 28 08:06:09 COMPUTERNAME installd[368]: PackageKit: Removing client PKInstallDaemonClient pid=493, uid=499 (/System/Library/CoreServices/Installer.app/Contents/MacOS/Installer)
Mar 28 08:06:09 COMPUTERNAME installd[368]: PackageKit: Done with sandbox removals
Mar 28 08:06:10 COMPUTERNAME Installer[493]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
Mar 28 08:06:10 COMPUTERNAME Installer[493]: IFDInstallController 61415430 state = 8
Mar 28 08:06:10 COMPUTERNAME Installer[493]: Displaying 'Install Failed' UI.
Mar 28 08:06:10 COMPUTERNAME Installer[493]: 'Install Failed' UI displayed message:'The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.

I had no issues with the PR'd code as of this AM(no extra packages and pushing via munki/simian, upgrade is running as we speak)

aysiu commented

The weird thing is, as I'm going through each line of main() and comparing it to the output in install.log, I don't see where it's failing. There seems to be a try and corresponding except all along the way, but I'm not seeing any of the except errors. It goes all the way through Blessing OS X installer... and then it fails.

@arubdesu, can you think of anything I might be doing wrong? I even pulled the latest commits and re-created the package... same errors on upgrade from El Capitan.

'It goes all the way through printing "Blessing OS X installer..." and then it fails.'

an important (I think) clarification

aysiu commented

Running postinstall manually:

/ appears to be a CoreStorage volume.
macOS Install Data already exists on /. Reusing it.
Mounting /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg...
Copying kernelcache and boot.efi to /macOS Install Data...
Customized OS install found: False
Unmounting /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg...
Attempting to link /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg to /macOS Install Data/InstallESD.dmg...
Couldn't create link because: [Errno 30] Read-only file system
Link not possible. Copying /Volumes/InstallOSX_10.12.4_16E195/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg to /macOS Install Data/InstallESD.dmg...
Creating minstallconfig.xml at /macOS Install Data...
Creating index.sproduct at /macOS Install Data...
Creating OSInstallAttr.plist at /macOS Install Data...
Setting OS X installer NVRAM install-product-url variable...
Blessing OS X installer boot environment in /macOS Install Data...
Could not find brtool
Updating boot helper partitions failed.

Running postinstall manually after copying brtool to Contents/Resources

/ appears to be a CoreStorage volume.
macOS Install Data already exists on /. Reusing it.
Mounting /Users/admin/Desktop/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg...
Copying kernelcache and boot.efi to /macOS Install Data...
Customized OS install found: False
Unmounting /Users/admin/Desktop/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg...
Attempting to link /Users/admin/Desktop/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/InstallESD.dmg to /macOS Install Data/InstallESD.dmg...
Creating minstallconfig.xml at /macOS Install Data...
Creating index.sproduct at /macOS Install Data...
Creating OSInstallAttr.plist at /macOS Install Data...
Setting OS X installer NVRAM install-product-url variable...
Blessing OS X installer boot environment in /macOS Install Data...
Mounting /macOS Install Data/InstallESD.dmg...
Mounting /private/tmp/tmpRUi_HY/dmg.Tgyuvz/BaseSystem.dmg...
/.IABlessInfo/BlessInfo.plist open failed
Updating boot helper partitions failed.

Can't install from package also:

$ sudo /usr/sbin/installer -pkg InstallOSX_10.12.4_16E195.pkg -target /
installer: Package name is macOS
installer: Installing at base path /
installer: The install failed (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.)

Just to add more amusement I'm seeing

bash-3.2# sudo /usr/local/createOSXinstallPkg-10_12_4/createOSXinstallPkg --source /Applications/Install\ macOS\ Sierra.app --output ~/Downloads/
File "/usr/local/createOSXinstallPkg-10_12_4/createOSXinstallPkg", line 133
except OSError, err:
^
SyntaxError: invalid syntax

That's not line 133 in the current code, so I don't know what you are working with.

Closing this issue as it has been addressed here: ec13f64

And here's the output for me:

bash-3.2$ sudo ./createOSXinstallPkg --source /Applications/Install\ macOS\ Sierra.app --output ~/Downloads
Examining and verifying source...
----------------------------------------------------------------
InstallESD.dmg: /Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallESD.dmg
OS Version: 10.12.4
OS Build: 16E195
----------------------------------------------------------------
Output path: /Users/gneagle/Downloads/InstallOSX_10.12.4_16E195.pkg
Creating package wrapper...
Creating MacOSXInstaller.choiceChanges...
----------------------------------------------------------------
Downloading and adding IncompatibleAppList pkg...
Downloading http://swcdn.apple.com/content/downloads/17/04/031-83163/n8thccuwnoqetn1kyn53bheb4nb7pw3wbv/OSX_10_12_IncompatibleAppList.pkg to /Users/gneagle/Downloads/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/OS X Install Data/OSX_10_12_IncompatibleAppList.pkg...
Writing index.sproduct to /Users/gneagle/Downloads/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/OS X Install Data/index.sproduct...
----------------------------------------------------------------
Copying InstallESD into package...
----------------------------------------------------------------
Done! Completed package at: /Users/gneagle/Downloads/InstallOSX_10.12.4_16E195.pkg
***********************************************************
WARNING: the (nearly) completed package is missing Contents/Resources/brtool.
The brtool included with 10.12.4 and later has changed functionality.
You'll need to copy an older brtool from a 10.12-10.12.3 Install macOS Sierra.app or from a createOSXinstallPkg-created 10.12-10.12.3 package into:
/Users/gneagle/Downloads/InstallOSX_10.12.4_16E195.pkg/Contents/Resources/
***********************************************************

...which is the expected output, and therefore leads me to guess that you are running createOSXinstallPkg under something other than OS X's system Python -- maybe you've installed Python 3?