Erase-install: How's the setup so Jamf logs it as completed?

bet4test3r
New Contributor

Hey guys, I really struggle on probably something easy.

We are partially using the erase tool from github to update some Macs in our fleet.

So the easy way is a policy with the package and the command line like

/Library/Management/erase-install/erase-install.sh --version=15.4.1 --reinstall --check-power --no-timeout --min-drive-space 20 --no-fs --rebootdelay 300 --power-wait-limit 300 --cleanup-after-use

 

My problem is that this policy, once completed, is showing failed. So it will start again popping up on the users macs.

I read about the launcher script, but it failes too.

I tried with the package and without, I tried the example script given by Github and the normal version.

Hows the process? I would just like to have jamf confirmed that the installation is completed.

Thanks!

 

1 ACCEPTED SOLUTION

sdagley
Esteemed Contributor III

@bet4test3r Add it as a Script payload to a policy with the erase-install package. The script payload parameters to do an erase will look something like this:

Screenshot 2025-04-30 at 9.10.58 AM.png

View solution in original post

17 REPLIES 17

sdagley
Esteemed Contributor III

@bet4test3r Did you https://github.com/grahampugh/erase-install/blob/main/erase-install-launcher.sh to call the erase-install script? I haven't used erase-install in a while but that launcher script was working to allow the policy running erase-install to log whether or not it was successful.

Hey @sdagley thanks for the answer!

Yes I used this script. But iam not sure how exactly should a policy look like. Just add this script to the policy without the erase-install package or with? Any other things to be aware?

sdagley
Esteemed Contributor III

@bet4test3r Add it as a Script payload to a policy with the erase-install package. The script payload parameters to do an erase will look something like this:

Screenshot 2025-04-30 at 9.10.58 AM.png

I got it, thanks!

Now there is the "problem", that jamf says "completed" even when the user cancels the credential window or postpone the installation. I really hope it will go ahead for sure after the postponed time?!

sdagley
Esteemed Contributor III

Unfortunately no, if the user cancels that isn't considered an error. Use the "--max-password-attempts=infinite" option to prevent the user from canceling at the password prompt.

Thanks, seems to work. Sadly now the process quits when the user is not connecting AC. 

How can I change it so the process will not end?

2025-05-12 14:12:55 | v37.0 | [check_power_status] WARNING - No AC power detected
2025-05-12 14:12:55 | v37.0 | [get_default_dialog_args] Invoking utility dialog
2025-05-12 14:18:27 | v37.0 | [check_power_status] Sending quit message to dialog log (/var/tmp/dialog.jiq)
2025-05-12 14:18:27 | v37.0 | [get_default_dialog_args] Invoking utility dialog
{

}
2025-05-12 14:18:32 | v37.0 | [check_power_status] ERROR - No AC power detected after waiting for 0s, cannot continue.

2025-05-12 14:18:32 | v37.0 | [erase-install] terminating the process 'caffeinate' process

2025-05-12 14:18:32 | v37.0 | [finish] sending quit message to dialog (/var/tmp/dialog.jiq)
2025-05-12 14:18:32 | v37.0 | [finish] Script exit code: 1

[erase-install-launcher] Exit (1)
/Library/Application Support/JAMF/tmp/erase-install-launcher:94: invalid base (must be 2 to 36 inclusive): 1

 

Currently its like this:

[1] --version
[2] 15.4.1
[3] --reinstall
[4] --no-timeout --no-fs --cleanup-after-use
[5] --rebootdelay
[6] 300
[7] --min-drive-space
[8] 20
[9] --check-power
[10] --power-wait-limit
[11] 300
[12] --max-password-attempts
[13] infinite

sdagley
Esteemed Contributor III

@bet4test3r Remove the 

--check-power

option.

You can see what each of those options do by consulting the erase-install Wiki: https://github.com/grahampugh/erase-install/wiki/4.-Upgrading-or-reinstalling-macOS-without-wiping-t...

 

Thanks, but then it will start the update also with 3% battery and if the battery will be empty while the update, it can cause some serious damage, no?

sdagley
Esteemed Contributor III

That could be an issue, yes. I can't provide exact steps right now, but you could write are-flight script that would check the battery level using the following and decide if you want to update at that time:

system_profiler SPPowerDataType | /usr/bin/awk '/State of Charge/ { print $NF }'

(If it returns nothing then it's a desktop system)

Well, thats already getting too complication for an stupid System update :D 

I will write the affecting users directly to continue the process. But thanks a lot man!

sdagley
Esteemed Contributor III

I don't know if it's baked into the full installers that erase-install will use, but I believe that Software Update currently requires a minimum of 25% charge to install macOS updates on Apple Silicon Macs, and 50% charge on Intel based Macs.

howie_isaacks
Valued Contributor III

My only use for erase-install will be for erasing and installing macOS using Self Service. This will be a tool for my support staff. I used the arguments provided above by @sdagley . They worked great. I have run several tests logged in as an admin user and a standard user. I specified macOS 15.5 but I want to have this download what ever the current macOS is instead of having to specify what version to use. It looks like using the "--update" argument does that so would I need to add the "--version=" argument? I have not yet tested doing this without it.

sdagley
Esteemed Contributor III

@howie_isaacks Use the "--os=MAJOR_VERSION" option and it'll get you the latest release of whatever macOS MAJOR_VERSION is (e.g. "--os=15" will currently get you 15.5)

howie_isaacks
Valued Contributor III

Nice! Thank you! I have read through the wiki a lot but my weird autistic brain doesn't always comprehend the meaning of everything right away. This will help a lot.

sdagley
Esteemed Contributor III

I had to look it up myself :-) as I generally went with using the specific version, or the specific build when Apple had a dozen+ builds of macOS 10.13.6. These days I just have the user do an Erase All Contents and Settings, and if the macOS version doesn't meet the minimum standard for enrollment our PreStage Enrollment is configured to force an update.

howie_isaacks
Valued Contributor III

I have our PreStage setup to enforce updates too. Unfortunately a Mac must be running macOS 14.4 or later for it to enforce updates. I have been seeing Macs running macOS 11, 12, and 13 getting enrolled lately. These are Macs that were likely on a shelf somewhere and then someone pulled one out and set it up. I created a policy to alert that the Mac needs an update. All of these Macs running an older macOS get added to a smart group which is scoped to several software restrictions. I won't allow using web browsers or Self Service until the Mac is updated. I also stop the Jamf agent from installing anything at check-in. After they update, the ZTP process will automatically start. I used Swift Dialog to display the alerts. For Macs running an OS less than 12 I use Jamf helper instead. I appreciate your help on this! I was about to create an erase and reinstall process of my own and then I remembered Graham Pugh's erase-install.

sdagley
Esteemed Contributor III

Booting into Recovery on ASi Macs and re-installing macOS will often get you versions that 14.4 because it seems macOS updates don't necessarily update the Recovery partition (if at all)