munki / macadmin-scripts

Scripts of possible interest to macOS admins
Other
2.33k stars 523 forks source link

Can't create spare image #8

Closed d1nkd0nk closed 6 years ago

d1nkd0nk commented 6 years ago

Hi, Executing the script do download latest High Sierra ( 2 091-95774 10.13.6 17G2208 2018-07-30 macOS High Sierra) under Mojave failed with the following error message:

Making empty sparseimage... installer: Error - ERROR_2062F74259 Command '['/usr/sbin/installer', '-pkg', '/Users/Shared/Scripts/content/downloads/07/20/091-95774/awldiototubemmsbocipx0ic9lj2kcu0pt/091-95774.English.dist', '-target', '/private/tmp/dmg.LeF6Ya']' returned non-zero exit status 1

Working Directory looks good.

Manual Execution showing the same issue: /usr/sbin/installer -pkg /Users/Shared/Scripts/content/downloads/07/20/091-95774/awldiototubemmsbocipx0ic9lj2kcu0pt/091-95774.English.dist -target /private/tmp/dmg.LeF6Ya installer: Error - ERROR_2062F74259

Perhaps you have an idea?

Thanks and BR, Daniel

gregneagle commented 6 years ago

https://github.com/munki/macadmin-scripts#installinstallmacospy

Are you using a 2018 MacBook Pro or a VM to build that 17G2208 installer?

gregneagle commented 6 years ago

Also, since it is /usr/sbin/installer returning the error, it's useful to examine /var/log/install.log for additional clues.

agerstein commented 6 years ago

I'm getting the same error for the same installer. Looking in my install.log provides this: 2018-10-10 09:06:25-04 oitajg070822 system_installd[1976]: PackageKit: Install sandbox purging reclaimed Zero KB

Also on Mojave (18A391), MBP 13" 2016 Four Thunderbolt 3 Ports (Touch Bar).

When I try 17G65, I it works fine.

On another machine (iMac Retina 5k, 27-inch, late 2014) using 10.13.4 (17E199), I get a similar error when running the script, and an ERROR_B14B14D9B7 when run manually. The install.log only has content from over an hour ago, nothing as of when I attempted the build.

gregneagle commented 6 years ago

Again: the tool is just running Apple's installer to install the pkgs from softwareupdate to a mounted disk image. If Apple's tool decides it doesn't want to install, and there is no troubleshooting info in /var/log/install.log, I'm not sure where to point you.

"I'm getting the same error for the same installer" sounds like you mean 10.13.6 17G2208 -which is for 2018 MBPs only.

I'm going to close this since there isn't enough info here to be sure this isn't an expected failure. (Failure to install 17G2208 on anything other than a 2018 MBP is an expected failure.)

ctsrc commented 5 years ago

I had a similar issue and here's what I did to get past it the issue.

For context, I am using the version of the script in the https://github.com/grahampugh/macadmin-scripts fork, and I am running it in order to download the macOS High Sierra installer so that I can create an USB stick to run the installer on a different computer.

In my case the hardware of the laptop I am executing this on (MacBookAir8,1) is different from the computer that I intend to install High Sierra on.

Having spent a bit of time earlier today reading through the script prior to running it, and investigating the data files that are hosted on swscan.apple.com and so on, I remembered that in a lot of the files from that server there were hardware checks written in JavaScript.

(BTW, /var/log/install.log does not have any recent entries. @gregneagle are you sure it is written to except for by the system itself?)

So anyway to get to the point, I was downloading the 17G66 build of macOS 10.13.6 and then when it came to the point where it was supposed to create the image it failed. I ran it manually and got the same kind of error that you saw and which in turn brought me to this issue via Google.

So what I did was, I had a look at the dist file. In my case, ./content/downloads/06/50/041-91758-A_M8T44LH2AW/b5r4og05fhbgatve4agwy4kgkzv07mdid9/041-91758.English.dist.

I proceeded to out-comment the hardware checks.

--- ./content/downloads/06/50/041-91758-A_M8T44LH2AW/b5r4og05fhbgatve4agwy4kgkzv07mdid9/041-91758.English.dist.orig 2019-11-05 16:49:15.000000000 +0100
+++ ./content/downloads/06/50/041-91758-A_M8T44LH2AW/b5r4og05fhbgatve4agwy4kgkzv07mdid9/041-91758.English.dist.new  2019-11-05 16:50:26.000000000 +0100
@@ -67,12 +67,15 @@
    }
    var nonSupportedModels = ['MacBookPro4,1','MacPro2,1','MacBookPro5,1','MacBookPro1,1','MacBookPro5,3','MacBookPro5,2','iMac8,1','MacBookPro5,4','iMac5,1','iMac5,2','iMac6,1','MacBookPro3,1','MacBookPro1,2','iMac9,1','Macmini3,1','Macmini1,1','iMac4,2','MacBookPro2,2','MacBookPro2,1','MacBook3,1','MacBook5,1','MacBook5,2','MacBook2,1','iMac4,1','MacBook1,1','MacBookPro5,5','Xserve2,1','MacBookAir1,1','Xserve3,1','MacBookAir2,1','Xserve1,1','Macmini2,1','MacPro3,1','iMac7,1','MacBook4,1','MacPro1,1','MacPro4,1',];
    var currentModel = system.sysctl('hw.model');
+/*
    if (nonSupportedModels.indexOf(currentModel) >= 0) {
        my.result.message = system.localizedString('ERROR_2062F74259');
        my.result.type = 'Fatal';
        return false;
    }
+*/
    var boardId = system.ioregistry.fromPath('IOService:/')['board-id'];
+/*
    if (boardIds.indexOf(boardId) == -1) {
        if (system.compareVersions(system.version.ProductVersion, '10.13') >= 0 && system.compareVersions(system.version.ProductVersion, '10.14') < 0) {
            my.result.message = system.localizedString('ERROR_B14B14D9B7');
@@ -82,6 +85,7 @@
        my.result.type = 'Fatal';
        return false;
    }
+*/
    if (system.compareVersions(system.version.ProductVersion, '10.8') < 0) {
        my.result.message = system.localizedStringWithFormat('ERROR_B85E600482', '10.8');
        my.result.type = 'Fatal';
@@ -126,4 +130,4 @@
     <pkg-ref id="InstallESDDmg.chunklist" version="10.13.6.0.0.1544783150"/>
     <pkg-ref id="BaseSystem.dmg" version="10.13.6.0.0.1544783150"/>
     <pkg-ref id="AppleDiagnostics.chunklist" version="10.13.6.0.0.1544783150"/>
-</installer-gui-script>
\ No newline at end of file
+</installer-gui-script>

I then reran sudo python installinstallmacos.py and made the same selection as before.

Now it successfully created Install_macOS_10.13.6-17G66.dmg.

gregneagle commented 5 years ago

The other workaround is to use a VM to generate these. That's the only documented and supported workaround (other than using compatible hardware), as I can't offer help on how to properly edit .dist files to change the script logic. I appreciate you posting that here and the thought behind it, but it's likely people who need this information won't find it here :-(

hkatsura commented 5 years ago

fyi, i have this hack in my fork to allow the installer to install the OS installer app on any hardware.

def allow_any_board_dist(dist_path):
    '''replace "if (boardIds.indexOf(boardId) == -1)" with "if (false)"'''
    import fileinput
    for line in fileinput.FileInput(dist_path, inplace=1):
        print(line.replace('if (boardIds.indexOf(boardId) == -1)', 'if (false)').rstrip('\n'))

def install_product(dist_path, target_vol):
    '''Install a product to a target volume.
    Returns a boolean to indicate success or failure.'''
    allow_any_board_dist(dist_path)
    cmd = ['/usr/sbin/installer', '-pkg', dist_path, '-target', target_vol]
    try:
...
gregneagle commented 5 years ago

That's great, but of course assumes Apple will never change the format of the code it uses to determine if an OS is applicable. I'm glad it works for you, but I wouldn't want to make that assumption in my code. If Apple changes the script format, it could break all installs with installinstallmacos.py, not just those on incompatible hardware.