setup-your-mac / Setup-Your-Mac

Setup Your Mac aims to simplify initial device configuration by leveraging swiftDialog and Jamf Pro Policy Custom Events to allow end-users to self-complete Mac setup post-enrollment.
https://snelson.us/sym
MIT License
231 stars 52 forks source link

Not Restarting #126

Closed mrmte closed 7 months ago

mrmte commented 7 months ago

Before submitting a Setup Your Mac bug report, please review the open swiftDialog issues to help determine the source of the issue. Tried Restart in $7 variable and machine is not restarting

Describe the bug A clear, concise description of the bug. Machine does not restart

To Reproduce

Expected behavior A clear, concise description of what you expected to happen. expect the machine to restart

Code/log output Please supply the full command used, and if applicable, add full output from Terminal. Either upload the log, or paste the output in a code block (triple backticks at the start and end of the code block, please!).

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

Environment (please complete the following information):

Additional context Add any other context about the problem here.

dan-snelson commented 7 months ago

Greetings, @mrmte!

  1. Which flavor of completionActionOption are you using?
  2. What are you seeing in the client-side logs?

Please see: 5. Troubleshooting > 6. Various Restart Completion Actions not Working as Expected

Also, if you disable debugMode and use the following snippet from 1. Welcome dialog doesn’t display, does the Mac restart?

timestamp=$( date '+%Y-%m-%d-%H%M%S' ) ; curl -o ~/Downloads/Setup-Your-Mac-via-Dialog-$timestamp.bash https://raw.githubusercontent.com/dan-snelson/Setup-Your-Mac/main/Setup-Your-Mac-via-Dialog.bash ; sudo bash ~/Downloads/Setup-Your-Mac-via-Dialog-$timestamp.bash

(You're invited to join us on Slack.)

mrmte commented 7 months ago
  1. Restart Attended in $7
  2. \\ 2023-12-07 14:40:40 - SETUP YOUR MAC DIALOG: title: Tim‘s MacBook Pro is ready! 2023-12-07 14:40:40 - SETUP YOUR MAC DIALOG: icon: SF=checkmark.circle.fill,weight=bold,colour1=#00ff44,colour2=#075c1e 2023-12-07 14:40:40 - SETUP YOUR MAC DIALOG: progresstext: Complete! Please restart and enjoy your new MacBook Pro, Tim! 2023-12-07 14:40:40 - SETUP YOUR MAC DIALOG: progress: complete 2023-12-07 14:40:40 - SETUP YOUR MAC DIALOG: button1text: Restart 2023-12-07 14:40:40 - SETUP YOUR MAC DIALOG: button1: enable 2023-12-07 14:40:40 - QUIT SCRIPT: Exiting … 2023-12-07 14:40:40 - QUIT SCRIPT: De-caffeinate … 2023-12-07 14:40:40 - Attempting to terminate the 'caffeinate' process … 2023-12-07 14:40:40 - (Termination message indicates success.) 2023-12-07 14:40:40 - QUIT SCRIPT: Removing /var/tmp/dialogCommandFileWelcome.XCc … 2023-12-07 14:40:40 - QUIT SCRIPT: Removing /var/tmp/dialogCommandFileSetupYourMac.Hkc … 2023-12-07 14:40:40 - QUIT SCRIPT: Removing default dialog file … 2023-12-07 14:40:40 - QUIT SCRIPT: Executing Completion Action Option: 'Restart Attended' … 2023-12-07 14:40:40 - COMPLETION ACTION: Restart, requiring user-interaction 2023-12-07 14:40:40 - The 'Self Service' process isn't running. 2023-12-07 14:40:50 - COMPLETION ACTION: Removing /var/tmp/ … 2023-12-07 14:40:50 - COMPLETION ACTION: Removing /var/tmp/overlayicon.icns … \\

  3. debug mode is already set to false
  4. yes looked at the restart, will look again
dan-snelson commented 7 months ago

@mrmte:

In a single test, on an unenrolled VM, running macOS 14.2 (23C63), via Terminal, the above snippet restarted the VM as expected.

debugMode="${5:-"false"}"
completionActionOption="${7:-"Restart"}"

(You'll also need to comment-out Line 395 if you're testing on un-enrolled Macs.)

I'm going to remove the "bug" label and you're again invited to join us on Slack.

dan-snelson commented 7 months ago

Just noticed the following …

2023-12-07 14:40:40 - QUIT SCRIPT: Executing Completion Action Option: 'Restart Attended' …

… you may wish to verify your Jamf Pro settings for the script and its policy.

mrmte commented 7 months ago

Yes I tried Restart Attended as well.. same thing. I don’t like slack, so I prefer not to use it.

dan-snelson commented 7 months ago

OK; I'll most likely close this issue as I can't reproduce it.

Have you had a chance to test the following?

Also, if you disable debugMode and use the following snippet from 1. Welcome dialog doesn’t display, does the Mac restart?

timestamp=$( date '+%Y-%m-%d-%H%M%S' ) ; curl -o ~/Downloads/Setup-Your-Mac-via-Dialog-$timestamp.bash https://raw.githubusercontent.com/dan-snelson/Setup-Your-Mac/main/Setup-Your-Mac-via-Dialog.bash ; sudo bash ~/Downloads/Setup-Your-Mac-via-Dialog-$timestamp.bash
dan-snelson commented 7 months ago

(Ultimately, SYM is just "window dressing" for your Jamf Pro policies; is there something preventing the Mac from restarting.)

mrmte commented 7 months ago

Thanks Dan, I’ll take a look a bit later.

mrmte commented 7 months ago

Thanks very much Dan for your help on this, much appreciated. Not sure why but in the script i change shutdown to /sbin/shutdown and now it works without any issue :)

Also just like to say this is the best onboarding and thank you for this :)

mrmte commented 7 months ago

i think i actually found the likely cause. My cleanup script had an exit 0. I take it the script also is looking for that and then just stopped. After i removed the exit 0 it seems now reliable to reboot.