kc9wwh / macOSUpgrade

Workflow for doing in-place upgrades.
Other
418 stars 103 forks source link

NOHUP Issues #92

Closed devlinford closed 5 years ago

devlinford commented 5 years ago

Hey all!

Is anyone else having intermittent issues after the starttoinstall command? I'm seeing an intermittent issue with the following output:

"nohup: can't detach from console: No such file or directory"

So, after the "Preparing for macOS Upgrade" full screen display it just returns back to the desktop and holds sits there...no restart. I have seen this work flawlessly (two weeks ago), but now 90% of my tests from 10.13.X to 10.14.2 result in this same error.

NOTE: We're not using the eraseinstall command (although, the stock script has this functionality available).

Can anyone elaborate on what the 'eval' and 'nohup' are doing? It seems to me this is called to keep running a command after a script has been terminated or something? I'm hoping to modify this portion of the script to resolve this issue if possible? The output appears to point to the 'nohup' as the culprit.

Everything else in this script appears to work really well, and I appreciate all the work you've all collectively put towards it.

Thanks,

Dev

wolflarson commented 5 years ago

We are seeing this as well. In our first wave of 30 devices about 15 had this issue. Can you share your results with removing the eval + nohup?

devlinford commented 5 years ago

@wolflarson,

After removing the nohup and eval I'm able to get it to run, however I'm finding it to be intermittent and haven't figured that out yet.

I've posted a few requests for help with that (including looping in @kc9wwh) and I haven't heard back.

At this point, I don't have a reliable way to upgrade macOS :(

wolflarson commented 5 years ago

So it sounds like it might not be the nohup or eval thats doing it. the OS upgrade is failing either way?

Are you by chance running an older version of the JSS? I am running 10.7.1 still and am starting to wonder if the jamfHelper gets updated in newer versions.

The obvious error is nohup: can't detach from console: No such file or directory

but I often get lots of output that is meaningless to me. Stuff like

0 : <CFString 0x7fff86a6d618 [0x7fff86b19af0]>{contents = "AppleSelectedInputSources"} = <CFArray 0x7f9077559170 [0x7fff86b19af0]>{type = immutable, count = 3, values = ( 0 : <CFBasicHash 0x7f9077558760 [0x7fff86b19af0]>{type = immutable dict, count = 3, entries => 0 : <CFString 0x7fff86a4b218 [0x7fff86b19af0]>{contents = "InputSourceKind"} = <CFString 0x7fff86a92098 [0x7fff86b19af0]>{contents = "Keyboard Layout"} 1 : <CFString 0x7fff86a45d78 [0x7fff86b19af0]>{contents = "KeyboardLayout Name"} = U.S. 2 : <CFString 0x7fff86a7db78 [0x7fff86b19af0]>{contents = "KeyboardLayout ID"} = <CFNumber 0x37 [0x7fff86b19af0]>{value = +0, type = kCFNumberSInt64Type} } 1 : <CFBasicHash 0x7f9077559260 [0x7fff86b19af0]>{type = immutable dict, count = 2, entries => 0 : <CFString 0x7fff86a4b218 [0x7fff86b19af0]>{contents = "InputSourceKind"} = <CFString 0x7f9077558450 [0x7fff86b19af0]>{contents = "Non Keyboard Input Method"} 1 : Bundle ID = <CFString 0x7f90775597b0 [0x7fff86b19af0]>{contents = "com.apple.PressAndHold"} } 2 : <CFBasicHash 0x7f907755a960 [0x7fff86b19af0]>{type = immutable dict, count = 2, entries => 0 : <CFString 0x7fff86a4b218 [0x7fff86b19af0]>{contents = "InputSourceKind"} = <CFString 0x7f9077559080 [0x7fff86b19af0]>{contents = "Non Keyboard Input Method"} 1 : Bundle ID = <CFString 0x7f907755a920 [0x7fff86b19af0]>{contents = "com.apple.inputmethod.EmojiFunctionRowItem"} } )} 1 : <CFString 0x7fff86a4dab8 [0x7fff86b19af0]>{contents = "AppleEnabledInputSources"} = <CFArray 0x7f907755b270 [0x7fff86b19af0]>{type = immutable, count = 3, values = ( 0 : <CFBasicHash 0x7f907755a9e0 [0x7fff86b19af0]>{type = immutable dict, count = 3, entries => 0 : <CFString 0x7fff86a4b218 [0x7fff86b19af0]>{contents = "InputSourceKind"} = <CFString 0x7fff86a92098 [0x7fff86b19af0]>{contents = "Keyboard Layout"} 1 : <CFString 0x7fff86a45d78 [0x7fff86b19af0]>{contents = "KeyboardLayout Name"} = U.S. 2 : <CFString 0x7fff86a7db78 [0x7fff86b19af0]>{contents = "KeyboardLayout ID"} = <CFNumber 0x37 [0x7fff86b19af0]>{value = +0, type = kCFNumberSInt64Type} } 1 : <CFBasicHash 0x7f907755b100 [0x7fff86b19af0]>{type = immutable dict, count = 2, entries => 0 : <CFString 0x7fff86a4b218 [0x7fff86b19af0]>{contents = "InputSourceKind"} = <CFString 0x7f907755b0a0 [0x7fff86b19af0]>{contents = "Non Keyboard Input Method"} 1 : Bundle ID = <CFString 0x7f907755b0d0 [0x7fff86b19af0]>{contents = "com.apple.PressAndHold"} } 2 : <CFBasicHash 0x7f907755b1f0 [0x7fff86b19af0]>{type = immutable dict, count = 2, entries => 0 : <CFString 0x7fff86a4b218 [0x7fff86b19af0]>{contents = "InputSourceKind"} = <CFString 0x7f907755b180 [0x7fff86b19af0]>{contents = "Non Keyboard Input Method"} 1 : Bundle ID = <CFString 0x7f907755b1b0 [0x7fff86b19af0]>{contents = "com.apple.inputmethod.EmojiFunctionRowItem"} } )}

I also see references to com.apple.HIToolbox.plist and GetInputSourceEnabledPrefs effective user id path = 0

Also users who have this error are normally able to reboot (deleting the cached installer) and run again from Self Service without issues. That points towards an open application or some process canceling reboot to my mind but I do go out of my way to kill out known problematic apps (Terminal, Office ect).

Agreed we have had to pull the 10.14.3 update until we are able to get the automation working more reliably.

devlinford commented 5 years ago

So, I was getting the: "nohup: can't detach from console: No such file or directory" error all the time and it would never work.

Since I modified this portion of the script, it has actually worked again, albeit it appears to be intermittent now:

`if [ "$versionMajor" -ge 14 ]; then
        #eval /usr/bin/nohup "\"$OSInstaller/Contents/Resources/startosinstall\"" "$eraseopt" --agreetolicense --nointeraction --pidtosignal "$jamfHelperPID" >> "$osinstallLogfile" &
        "$OSInstaller/Contents/Resources/startosinstall" --agreetolicense --nointeraction --pidtosignal "$jamfHelperPID" >> "$osinstallLogfile" &
    else
        #eval /usr/bin/nohup "\"$OSInstaller/Contents/Resources/startosinstall\"" "$eraseopt" --applicationpath "\"$OSInstaller\"" --agreetolicense --nointeraction --pidtosignal "$jamfHelperPID" >> "$osinstallLogfile" &
        "$OSInstaller/Contents/Resources/startosinstall" --applicationpath "\"$OSInstaller\"" --agreetolicense --nointeraction --pidtosignal "$jamfHelperPID" >> "$osinstallLogfile" &
    fi

    /bin/sleep 3` 

It is possible, as you say that it was intermittent (just didn't work during my testing) when I had the nohup and eval in place, but I feel that it is more reliable without it.

My JSS is up-to-date. We're on Cloud and Jamf ensures that we're on the latest as we are updated regularly (v10.9.0-t1544463445).

So if it fails in your environment, and you restart and try again you HAVE to delete the 'install macOS Mojave" from the Applications folder prior to trying again? Do you have any data on if you don't remove the cached installer? If it is the current installer it should be verified and just start the upgrade process, if it is found at runtime. If you find that you do indeed have to delete and try again, perhaps there is something with the actual installer that is the issue, permissions or something weird like that?

At any rate, this is really frustrating because something this important should be much easier to pull off in my opinion.

wolflarson commented 5 years ago

As part of this script it drops a LaunchDaemon that removes the installer on next boot. https://github.com/kc9wwh/macOSUpgrade/blob/master/macOSUpgrade.sh#L286

As for the permissions on the cached installer I don't think so because the package that puts the installer in place is the same in both cases.

I will give your changes a try and see if I get more parseable errors on my end.

kc9wwh commented 5 years ago

NoHUP was added in PR #73. @taniguti would you be able to speak to this?

I can say I have not run into any issues during my testing. Have you tried on a plain vanilla system to rule out outside factors?

devlinford commented 5 years ago

Hey @kc9wwh,

I've tried on multiple fresh Macs (Recovery wipe, re-enroll in Jamf) scoped in. They all seem to experience this same nuhup error.

I've since removed that portion on my who script and it runs, but it is intermittent .When it is unsuccessful to allow it to work but its intermittent . Where are the best places t look at logs if it fails right after 'statosinstall'?

Thanks guys

kenchan0130 commented 5 years ago

The benefit of nohup is that the risk of canceling execution from self service by end users is reduced. Also, because installer execution and the process executed by jamf can be done separately, their dependencies disappear.

If we make arguments dynamically in shell script, use of eval is required.

However, we can choose without using nohup if it has issues with nohup.

adammartin253 commented 5 years ago

I am seeing the same issues intermittently.

Script result: Power Check: OK - AC Power Detected Disk Check: OK - 324576477184 Bytes Free Space Detected /Applications/Install macOS Mojave.app found /Applications/Install macOS Mojave.app found /Applications/Install macOS Mojave.app found Launching jamfHelper as HUD Window... /Library/LaunchAgents/com.apple.install.osinstallersetupd.plist: service already loaded Launching startosinstall... nohup: can't detach from console: No such file or directory 2019-03-27 17:18:28.111 jamfHelper[6091:440603] GetInputSourceEnabledPrefs user file path = /Users/hbouser/Library/Preferences/com.apple.HIToolbox.plist 2019-03-27 17:18:28.111 jamfHelper[6091:440603] GetInputSourceEnabledPrefs effective user id path = 0

kenchan0130 commented 5 years ago

@adammartin253 Thank you for your feedback. I am fixing this.