I like this PDF from JAMF better. Worked well for me.
https://www.evernote.com/shard/s398/sh/bec8a262-e33d-4ad9-80fa-05b939db6d8d/f4ca396a63caa510
Dumb question: Where are these PDFs from? Can they be found in https://www.jamf.com/resources/?
Hello,
I am not debating the PDF. I figured that all out. I just need help with the script.
Thanks.
Try the command "reboot now". Or you can use use the restart options within the policy.
Where would I be placing that command? I know nothing of scripts unfortunately.
I keep getting this error. Does anyone know what could cause it?
Error:
Script result: Helper tool creashed...
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.
No matching processes were found
Error running script: return code was 1.
I would check your syntax. According to here https://macops.ca/new-adventures-in-automating-os-x-installs-with-startosinstall, the nointeraction flag should suppress the agreement.
No matching process found is probably related to your killall Self Service command, as anything being run via jamf is done in the context of root, while the self service process belongs to the user who launched it.
Finally, "reboot now" would just be another line in your script.
Devices do not even appear to be attempting to upgrade anymore..
I think the problem is here: Script result: Helper tool creashed...
Yes the misspelling is actually from the script.
Nonetheless Jamf gave me the script and we have tried many things to get it working with no success. Currently at a complete stop.
@TylerC might I suggest you go a different route for doing these upgrades? I would highly recommend the process that @rtrouton outlines on his blog:
Providing OS X Upgrades via Casper
I've used that method to go from 10.10 to 10.11 and am using it now to go to 10.12. It's painless, and it works.
I will have to look into it some more. Some looks a bit over my head and we are not using self-service.
Overall pretty upset by the lack of support from Jamf.
@TylerC you should be able to utilize Rich's methods without using Self Service. And he does a great job of explaining the details.
I'm assuming you've sent an email in to support@jamf.com, right?
@TylerC sorry, just re-read your earlier post that you had been given the script my Jamf.
I'm not certain what all you have tried, but to get the reboot to happen immediately, but looking at the verbs of the binary (startosinstall) the nointeraction
flag does not appear to be there anymore:
Steve-Wood:Resources steve$ ./startosinstall --?
startosinstall: unrecognized option `--?'
Usage: startosinstall --applicationpath <install macOS.app path> --volume <target volume path>
Arguments
--volume, a path to the target volume.
--applicationpath, a path to copy of the OS installer application to start the install with.
--license, prints the user license agreement only.
--agreetolicense, agree to license the license you printed with --license.
--rebootdelay, how long to delay the reboot at the end of preparing. This delay is in seconds and has a maximum of 300 (5 minutes.
--pidtosignal, Specify a PID to which to send SIGUSR1 upon completion of the prepare phase. To bypass "rebootdelay" send SIGUSR1 .
--usage, prints this message.
Example: startosinstall --volume /Volumes/Untitled --applicationpath "/Applications/Install macOS.app"
So, I would modify the script as follows:
#!/bin/bash
/Applications/Install macOS Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 1
Since you are not using Self Service the killall "Self Service"
can be removed. As the help on the binary states, the rebootdelay
is in seconds, so setting that to 1 should reboot within 1 second of completing preparations.
I have not tested this just yet, but when I get to the office I will try to replicate this in a VM.
@TylerC after countless reboots of my VM and countless restores back to a snapshot, I had success with the method you are trying. I utilzed the script you posted (I was wrong about the nointeraction
verb):
#!/bin/bash
/Applications/Install macOS Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 1 --nointeraction
I did not cache the OS because I did not want to put that into my JSS. I copied the Install macOS Sierra app into the Applications folder on the VM, added the above script, and then created a policy that was triggered to At Login with the script. That method worked perfectly.
The only time I had any issues was when I tried to trigger the policy during Recurring Check In. For whatever reason I had mixed results, more often than not resulting in failure.
Not sure how you are triggering this policy, but you might need to look at how you get the policy started.
I was provided this script for an upgrade without user interaction. I am still testing and only found that the messages are being sent to system event. this is causing an error when the policy is run.
https://github.com/kc9wwh/macOSUpgrade
@VladCabrera Could you provide me with some more details on the issues you are seeing with that workflow? I've tested it on a few systems now with no issue, so very curious as to what you are seeing.
@Rosko Thanks for joining. I have 2 policy one delivers a dmg created with Composer, that drops Install Sierra.app to Users/Shared/ with 755 permissions. Owner is root(0) RWX, Group wheel(0) RX, Everyone RX.
The script is set as a separate policy with priority set to after. I can see the machines, Yosemite and EL Capitan, download and attempt to execute but fails with error.
Executing Policy macOS Sierra Silent Install
Running script macOS10.12Upgrade...
Script exit code: 0
Script result: 36:258: execution error: An error of type -10810 has occurred. (-10810)
I'm thinking jamfhelper can't tell the logged on user to send the message and quits.
My hardware are all Mac mini.
If I run the script manually, ./macupgrade.sh it skips to startosinstall command.
@VladCabrera Attached is an updated script with some echoes to let us see in the policy logs what is happening. But one thing to note is that we are sending jamfHelper and startosinstall to background processes so the script should actually complete and the processes will still be running until the startosinstall process initiates the reboot.
But if you could run the below script and let me know the output, as well as if you are seeing the jamfHelper screen or not.
#!/bin/bash
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Copyright (c) 2017 Jamf. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Jamf nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY JAMF SOFTWARE, LLC "AS IS" AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL JAMF SOFTWARE, LLC BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# This script was designed to be used in a Self Service policy to ensure specific
# requirements have been met before proceeding with an inplace upgrade to macOS Sierra,
# as well as to address changes Apple has made to the ability to complete macOS upgrades
# silently.
#
# REQUIREMENTS:
# - Jamf Pro
# - macOS Sierra Installer must be staged in /Users/Shared/
#
#
# For more information, visit https://github.com/kc9wwh/macOSUpgrade
#
#
# Written by: Joshua Roskos | Professional Services Engineer | Jamf
#
# Created On: January 5th, 2017
# Updated On: February 13th, 2017
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# USER VARIABLES
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
##Enter 0 for Full Screen, 1 for Utility window (screenshots available on GitHub)
userDialog=0
##Title to be used for userDialog (only applies to Utility Window)
title="macOS Sierra Upgrade"
##Heading to be used for userDialog
heading="Please wait as we prepare your computer for macOS Sierra..."
##Title to be used for userDialog
description="
This process will take approximately 5-10 minutes.
Once completed your computer will reboot and begin the upgrade."
##Icon to be used for userDialog
##Default is macOS Sierra Installer logo which is included in the staged installer package
icon=/Users/Shared/Install macOS Sierra.app/Contents/Resources/InstallAssistant.icns
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# SYSTEM CHECKS
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
##Check if device is on battery or ac power
pwrAdapter=$( /usr/bin/pmset -g ac )
if [[ ${pwrAdapter} == "No adapter attached." ]]; then
pwrStatus="ERROR"
/bin/echo "Power Check: ERROR - No Power Adapter Detected"
else
pwrStatus="OK"
/bin/echo "Power Check: OK - Power Adapter Detected"
fi
##Check if free space > 15GB
freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' )
if [[ ${freeSpace%.*} -ge 15 ]]; then
spaceStatus="OK"
/bin/echo "Disk Check: OK - ${freeSpace%.*} Free Space Detected"
else
spaceStatus="ERROR"
/bin/echo "Disk Check: ERROR - ${freeSpace%.*} Free Space Detected"
fi
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# APPLICATION
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
if [[ ${pwrStatus} == "OK" ]] && [[ ${spaceStatus} == "OK" ]]; then
##Launch jamfHelper
if [[ ${userDialog} == 0 ]]; then
/bin/echo "Launching jamfHelper as FullScreen..."
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType fs -title "" -icon "$icon" -heading "$heading" -description "$description" &
jamfHelperPID=$(echo $!)
fi
if [[ ${userDialog} == 1 ]]; then
/bin/echo "Launching jamfHelper as FullScreen..."
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "$title" -icon "$icon" -heading "$heading" -description "$description" -iconSize 100 &
jamfHelperPID=$(echo $!)
fi
##Begin Upgrade
/bin/echo "Launching startosinstall..."
/Users/Shared/Install macOS Sierra.app/Contents/Resources/startosinstall --volume / --applicationpath /Users/Shared/Install macOS Sierra.app --nointeraction --pidtosignal $jamfHelperPID &
/bin/sleep 3
else
/bin/echo "Launching AppleScript Dialog..."
/usr/bin/osascript -e 'Tell application "System Events" to display dialog "Your computer does not meet the requirements necessary to continue.
Please contact the help desk for assistance. " with title "macOS Sierra Upgrade" with text buttons {"OK"} default button "OK" with icon 2'
fi
exit 0
Thanks!
Josh
Thanks @Rosko!
For those Macs which are on older versions of macOS 10.12.x and already have current version of /Applications/Install macOS Sierra.app, we added logic to determine the free space on a Sierra box:
## Determine free space ...
osMinorVersion=$( /usr/bin/sw_vers -productVersion | /usr/bin/cut -d. -f2 )
if [[ "$osMinorVersion" -lt 12 ]]; then
freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' )
else
freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $4}' )
fi
@dan.snelson You beat me to the punch! lol
The next version will have the updated support for running on macOS 10.12, just didn't think it would be needed till 10.13 ;)
I took a little different approach, but the end result is the same...
##Check if free space > 15GB
if [[ $osMinor -ge 12 ]]; then
freeSpace=$( /usr/sbin/diskutil info / | grep "Available Space" | awk '{print $4}' )
else
freeSpace=$( /usr/sbin/diskutil info / | grep "Free Space" | awk '{print $4}' )
fi
if [[ ${freeSpace%.*} -ge 15 ]]; then
spaceStatus="OK"
/bin/echo "Disk Check: OK - ${freeSpace%.*} Free Space Detected"
else
spaceStatus="ERROR"
/bin/echo "Disk Check: ERROR - ${freeSpace%.*} Free Space Detected"
fi
But, I'm curious...are you using the installer to upgrade minor versions versus a combo update or did I miss read that?
@Rosko Ran into one with the script and my Mac mini's. it doesn't like the power management query in which fails because it seems to look for only an adapter. These are my only test machine at the moment.
After removing the power check, I was able to run the script but stuck at the preparing banner for 50 minutes. I killed the PID for jamfhelper.
Results.
TUSMA03MDKVT007:Shared v781598$ vim MacOSSierra_Pwr.sh
TUSMA03MDKVT007:Shared v781598$ ./MacOSSierra_Pwr.sh
Disk Check: OK - 476 Free Space Detected
Launching jamfHelper as FullScreen...
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.
TUSMA03MDKVT007:Shared v781598$ Error: could not get authorization...
@VladCabrera Thanks for the Update! That was definitely not intended behavior.
I've updated the script on GitHub w/ the following:
- Replaced Final AppleScript Dialog w/ jamfHelper
- Added Output for Policy Logs
- Added Support for macOS 10.12 + for Free Space Check
- Fixed Issue with Power Check Only Applies to Laptops
I've tested this on a MacBook Pro, MacMini and a Mac VM, and all the way back to 10.8 so hopefully that should work for you :)
@Rosko Nice updates.
Since you're being your usual, helpful self, I added the following snippet to use Parameter 4 to validate which version of the installer is present client-side (i.e., "10.12.3").
(I am looking for the installer in /Applications/)
## Script Parameter
requiredInstallerVersion="$4" # Required Installer Version
## Check if the available installer is the appropriate version
installerVersion=$( /usr/bin/defaults read /Applications/Install macOS Sierra.app/Contents/SharedSupport/InstallInfo.plist "System Image Info" | /usr/bin/grep version | /usr/bin/awk '{print $3}' | /usr/bin/tr -d '";' )
# Validate a value has been specified for Parameter 4 ...
if [ ! -z "${requiredInstallerVersion}" ]; then
if [[ "${requiredInstallerVersion}" == "${installerVersion}" ]]; then
installerVersionCheck="OK"
else
installerVersionCheck="ERROR"
fi
else
installerVersionCheck="ERROR: Version not specified"
jssLog "ERROR: Parameter 4 not specified"
exit 1
fi
Still running into issues completing the task. Getting stuck on trying to run startosinstall command.
tma0029avkvtad:Shared Setup$ ./macOS10.12Upgrade.sh
Power Check: OK - AC Power Detected
Disk Check: OK - 44GB Free Space Detected
Launching jamfHelper as FullScreen...
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.
Error: could not get authorization...
tma0029avkvtad:Shared Setup$ ps
PID TTY TIME CMD
678 ttys000 0:00.01 -bash
934 ttys001 0:00.01 -bash
961 ttys001 0:00.18 /Library/Application Support/JAMF/bin/jamfHelper.app/C
tma0029avkvtad:Shared Setup$
I took the above by ssh to the computer. Manually I gave the script 755 rights, but we have limited the sudo command to particular files and commands. I have to work on getting this script added to the allowed list.
@VladCabrera For what it's worth, here's the install command I'm using (but the installer is in /Applications):
/Applications/Install macOS Sierra.app/Contents/Resources/startosinstall --applicationpath "/Applications/Install macOS Sierra.app" --volume $1 --rebootdelay 30 --nointeraction
@dan.snelson @Rosko When you did your testing was it via policy or manually? I am able to invoke the script manually with sudo ./macOS10.12Upgrade.sh.