grahampugh / erase-install

A script that automates downloading macOS installers, and optionally erasing or upgrading macOS in a single process. Watch the video!
https://grahamrpugh.com/2023/05/14/macaduk-presentation-eraseinstall.html
Apache License 2.0
836 stars 131 forks source link

[BUG] error 42 #415

Closed mrmte closed 1 year ago

mrmte commented 1 year ago

Describe the bug some systems error out preparing the update stage "[erase-install] Reached end of script. Exit with error 42."

To Reproduce using the jamf launcher script with --current-user --reinstall --version=13.4.1 --check-power --no-fs --rebootdelay 300 --cleanup-after-use

unsure how to reproduce it

Expected behavior not error

Code/log output Please supply the full command used, and if applicable, add full output from Terminal or from /var/log/erase-install.log. Don't post a partial log - I need the whole thing. Either upload the log as a file, or paste the output in a code block like this:

2023-07-07 10:34:09  [erase-install] v29.2 script execution started: Fri Jul  7 10:34:09 IST 2023
2023-07-07 10:34:10  [erase-install] System version: 13.4 (Build: 22F66)
2023-07-07 10:34:10  [check_for_dialog_app] dialog is installed (/Library/Application Support/Dialog/Dialog.app)
2023-07-07 10:34:10  [check_for_dialog_app] Creating dialog log (/var/tmp/dialog.ZWJ)...
2023-07-07 10:34:10  [log_rotate] Start rotating logs in /Library/Management/erase-install/log
2023-07-07 10:34:10  [log_rotate] moving /Library/Management/erase-install/log/erase-install.log to /Library/Management/erase-install/log/erase-install.log.1
2023-07-07 10:34:10  [log_rotate] Finished rotating logs in /Library/Management/erase-install/log
2023-07-07 10:34:10  [erase-install] Caffeinating this script (pid=86686)
2023-07-07 10:34:10  [check_free_space] OK - 349 GB free/purgeable disk space detected
2023-07-07 10:34:10  [erase-install] Looking for existing installer app or pkg
2023-07-07 10:34:10  [find_existing_installer] Installer found at /Applications/Install macOS Ventura.app.
2023-07-07 10:34:10  [check_installer_is_valid] Checking validity of /Applications/Install macOS Ventura.app.
2023-07-07 10:34:10  [check_installer_is_valid] Mounting /Applications/Install macOS Ventura.app/Contents/SharedSupport/SharedSupport.dmg
2023-07-07 10:34:12  [check_installer_is_valid] Using Build value from com_apple_MobileAsset_MacSoftwareUpdate.xml
Volume Shared Support on disk2s2 force-unmounted
2023-07-07 10:34:13  [compare_build_versions] Comparing (1) 22F66 with (2) 22F82
2023-07-07 10:34:13  [check_installer_is_valid] Installer: 22F82 >= System: 22F66 : valid build.
2023-07-07 10:34:13  [erase-install] Running on architecture i386
2023-07-07 10:34:13  [check_power_status] WARNING - No AC power detected
2023-07-07 10:34:13  [get_default_dialog_args] Invoking utility dialog
2023-07-07 10:34:27  [check_power_status] OK - AC power detected
2023-07-07 10:34:27  [check_power_status] Sending quit message to dialog log (/var/tmp/dialog.ZWJ)
2023-07-07 10:34:27  [erase-install] Installer is at: /Applications/Install macOS Ventura.app
2023-07-07 10:34:28  [check_free_space] OK - 349 GB free/purgeable disk space detected

2023-07-07 10:34:28  [erase-install] WARNING! Running /Applications/Install macOS Ventura.app with reinstall option

2023-07-07 10:34:28  [erase-install] Sending quit message to dialog log (/var/tmp/dialog.ZWJ)
2023-07-07 10:34:28  [get_default_dialog_args] Invoking utility dialog
2023-07-07 10:34:28  [erase-install] Writing LaunchDaemon which will remove /Library/Management/erase-install at next boot
2023-07-07 10:34:29  [launch_startosinstall] Launching startosinstall
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
Preparing to run macOS Installer...

Preparing: 0.0%            
Preparing: 0.1%            
Preparing: 0.2%            
Preparing: 0.3%            
Preparing: 0.4%            
Preparing: 0.5%            
Preparing: 0.6%            
Preparing: 0.7%            
Preparing: 0.8%            
Preparing: 0.9%            
Preparing: 1.0%            
Preparing: 1.1%            
Preparing: 1.2%            
Preparing: 1.3%            
Preparing: 1.4%            
Preparing: 1.5%            
Preparing: 1.6%            
Preparing: 1.7%            
Preparing: 1.8%            
Preparing: 1.9%            
Preparing: 2.0%            
Preparing: 2.1%            
Preparing: 2.2%            
Preparing: 2.3%            
Preparing: 2.4%            
Preparing: 2.5%            
Preparing: 2.6%            
Preparing: 2.7%            
Preparing: 2.8%            
Preparing: 2.9%            
Preparing: 3.0%            
Preparing: 3.1%            
Preparing: 3.2%            
Preparing: 3.3%            
Preparing: 3.4%            
Preparing: 3.5%            
Preparing: 3.6%            
Preparing: 3.7%            
Preparing: 3.8%            
Preparing: 3.9%            
Preparing: 4.0%            
Preparing: 4.1%            
Preparing: 6.2%            
Preparing: 6.3%            
Preparing: 6.4%            
Preparing: 6.5%            
Preparing: 6.6%            
Preparing: 6.7%            
Preparing: 6.8%            
Preparing: 6.9%            
Preparing: 7.0%            
Preparing: 7.1%            
Preparing: 7.2%            
Preparing: 7.3%            
Preparing: 7.4%            
Preparing: 7.5%            
Preparing: 7.6%            
Preparing: 7.7%            
Preparing: 7.8%            
Preparing: 7.9%            
Preparing: 8.0%            
Preparing: 8.1%            
Preparing: 8.2%            
Preparing: 8.3%            
Preparing: 8.4%            
Preparing: 8.5%            
Preparing: 8.6%            
Preparing: 8.7%            
Preparing: 8.8%            
Preparing: 8.9%            
Preparing: 9.0%            
Preparing: 9.1%            
Preparing: 9.2%            
Preparing: 9.3%            
Preparing: 9.4%            
Preparing: 9.5%            
Preparing: 9.6%            
Preparing: 9.7%            
Preparing: 9.8%            
Preparing: 9.9%            
Preparing: 10.0%            
Preparing: 10.1%            
Preparing: 10.2%            
Preparing: 10.3%            
Preparing: 10.4%            
Preparing: 10.5%            
Preparing: 10.6%            
Preparing: 10.7%            
Preparing: 10.8%            
Preparing: 10.9%            
Preparing: 11.0%            
Preparing: 11.1%            
Preparing: 11.2%            
Preparing: 11.3%            
Preparing: 11.4%            
Preparing: 11.5%            
Preparing: 11.6%            
Preparing: 11.7%            
Preparing: 11.8%            
Preparing: 11.9%            
Preparing: 12.0%            
Preparing: 12.1%            
Preparing: 12.2%            
Preparing: 37.1%            
Preparing: 37.7%            
Preparing: 42.2%            
Preparing: 42.3%            
Preparing: 46.8%            
Preparing: 51.4%            
Preparing: 55.9%            An error occurred preparing the update.
   [erase-install] Timeout reached for PID 86897!
2023-07-07 11:34:29  [erase-install] Reached end of script. Exit with error 42.

2023-07-07 11:34:29  [erase-install] attempting to terminate the 'caffeinate' process - Termination message indicates success

2023-07-07 11:34:29  [finish] sending quit message to dialog (/var/tmp/dialog.ZWJ)
2023-07-07 11:34:30  [finish] Script exit code: 42
[erase-install-launcher] Exit (42)

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

grahampugh commented 1 year ago

Please check your network settings and security software to see if there is something blocking access to Apple servers during the preparation phase.

escobarj commented 1 year ago

Please check your network settings and security software to see if there is something blocking access to Apple servers during the preparation phase.

Do you know which Apple URLs might it be failing to access? We occasionally see the same issue and I've long suspected our network filters, but I can't find which URL fails so I have nothing to take to the networking team.

grahampugh commented 1 year ago

Just send them this link and tell them that everything in the list needs to be whitelisted: https://support.apple.com/en-us/HT210060

Failing that you'll have to use Wireshark or Charles Proxy to figure out what URLs are being used. I'm not going to be publishing a particular guide for erase-install.