startosinstall hangs indefinitely when invoked non-interactively
| Originator: | eric | ||
| Number: | rdar://33572255 | Date Originated: | 27-Jul-2017 01:30 PM |
| Status: | Open | Resolved: | |
| Product: | macOS + SDK | Product Version: | 10.11.6 (15G31) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
This is a duplicate of radar #27761568
The `startosinstall` tool included in OS X Upgrade apps (as of 10.11) hangs indefinitely when invoked non-interactively (e.g. from launchd)
The `startosinstall` utility is a welcome addition to macOS! Unfortunately it only works when invoked from an interactive, GUI based shell (e.g. from Terminal.app). When invoked non-interactively (e.g. from a launchd plist), the expected reboot/install never occurs. Instead, a cryptic error is displayed. This is deeply problematic, since the most popular use-case for `startosinstall` is to use it for automating macOS upgrades across large fleets of Mac computers. Automating fleet-wide upgrades requires non-interactive/scripted use of `startosinstall.`
Steps to Reproduce:
1. Download the "Upgrade to macOS Sierra Developer Beta" app (macOS 10.12 beta 4 - Build 16A239m) into /Applications
2. As a non-GUI user, Invoke /Applications/"Upgrade to macOS Sierra Developer Beta"/Contents/Resources/startosinstall with the following arguments:
/Applications/Install macOS Sierra Developer Beta.app/Contents/Resources/startosinstall --applicationpath=/Applications/Install macOS Sierra Developer Beta.app/ --volume=/ --agreetolicense
For an example as a non-GUI user, invoke the above as a LaunchDaemon with the attached plist (com.osx.sierra-upgrade.plist), like so:
sudo launchctl load /Library/LaunchDaemons/com.osx.sierra-upgrade.plist
Expected Results:
1. `startosinstall` waits the default amount of time after displaying the message corresponding with "--agreetolicense"
2. `startosinstall` prepares the upgrade and reboots the machine.
3. The machine installs macOS Sierra Developer Beta.
Actual Results:
`startosinstall` hangs indefinitely and logs the following error messages:
/var/log/system.log
8/8/16 11:55:31.174 PM com.apple.xpc.launchd[1]: (com.apple.xpc.launchd.domain.system) Could not import service from caller: caller = startosinstall.96365, service = com.apple.install.osinstallersetupd, error = 134: Service cannot load in requested session
/var/log/install.log
Aug 8 23:55:31 MacBook-Pro startosinstall[96365]: Could not schedule setup agent. Error: Error Domain=CFErrorDomainLaunchd Code=2 "(null)"
Attachments:
1. com.osx.sierra-upgrade.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.osx.sierra-upgrade</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Install macOS Sierra Developer Beta.app/Contents/Resources/startosinstall</string>
<string>--applicationpath=/Applications/Install macOS Sierra Developer Beta.app/</string>
<string>--volume=/</string>
<string>--agreetolicense</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Version:
10.11.6 (15G31)
Notes:
This error is also triggered when the startosinstall is kicked off by a JAMF recurring check-in.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!