jamf / DEPNotify-Starter

Bash script to start DEPNotify and run policies during enrollment with Jamf Pro
https://gitlab.com/Mactroll/DEPNotify
MIT License
364 stars 86 forks source link

GUI not starting… #3

Closed remusache closed 5 years ago

remusache commented 5 years ago

Hey @kbareis! I've noticed that the DEPNotify.app has a bad habit of not starting. It happens in 95% of the cases. The script is performing the installation (no argues there) but there is no GUI, which defeats the purpose of the entire thing 🙂 If a double click the DEPNotify.app in the Utilities folder, than the app starts and I can see the progress and such. But by itself, I mean automatically, DEPNotify.app, doesn't start most of the times. 😕

kbareis commented 5 years ago

Hey @remusache,

What version of the script are you using? Are you using the latest version? Are you using the script during DEP Enrollment or for another purpose?

The reason I ask is because Arek and I changed the logic to look for the Setup Assistant Process rather than users or BOM files in v1.1.0 of the script that was released last week. If you have the older version looking for users and BOM files, there is a likelihood that the script would kick off prior to Setup Assistant completion if the user to a rather long time finishing the Apple related setup.

remusache commented 5 years ago

Hey @kbareis !

Thank you so much for getting back to me!

I am using the one that I attached bellow. Don't know if it's the latest one. I think is the one before the last one you posted. I am using the script in a policy that is triggered at Enrollment Complete.

DEPNotify.sh.zip

kbareis commented 5 years ago

@remusache

Hmm, that should have the updated code. Do you know if Setup Assistant changes it's name based on native language?

When your Mac first boots into the Setup Assistant, could you hold down Control + Option + Command + T. That should open the Terminal. Once Terminal is open, could you then run the following command: pgrep -l "Setup Assistant" If that command comes back with no process IDs then the Setup Assistant must have a different name.

If it comes back with something, then I would continue going thru the Setup Assistant and run the above command after every screen is completed.

If that doesn't show any issues, then I would wait at the last screen prior to seeing the "Getting Started" screen that ends in going to the desktop. While there, you can still access the Terminal and can run the following command on a file that will give us more information. tail -f /var/tmp/depNotifyDebug.log That log file is created once DEP Notify is installed and the script is running. You should see many alerts saying that the Setup Assistant is still running.

Here's a screenshot of what you should see:

screen shot 2018-10-01 at 3 35 20 pm
remusache commented 5 years ago

Hey @kbareis

pgrep -l "Setup Assistant" shows PID 348. So the Setup Assistant doesn't change its name while on Swedish.

This what I get from tail -f /tmp/depNotifyDebug.log

Tue Oct 02 09:31:43: Setup Assistant Still Running. PID 348 Setup Assistant. Tue Oct 02 09:31:53: Setup Assistant Still Running. PID 348 Setup Assistant. Tue Oct 02 09:32:03: Setup Assistant Still Running. PID 348 Setup Assistant. Tue Oct 02 09:32:13: Setup Assistant Still Running. PID 348 Setup Assistant. Tue Oct 02 09:32:23: Current user set to remus1.

Unfortunately the GUI still doesn't want to cooperate. Very stubborn GUI… 😁

kbareis commented 5 years ago

@remusache

I'm glad you were able to get to the log. However, that last bit Tue Oct 02 09:32:23: Current user set to remus1. shouldn't show up at all while you are sitting in the Setup Assistant.

remusache commented 5 years ago

@kbareis I'm running 10.13.6 on the test machine. DEPNotify 1.1.0, build 29. I am using this for first time enrollment via DEP.

That Tue Oct 02 09:32:23: Current user set to remus1 is from when I ran again tail -f from when I was already logged in. So that is OK I think. I think that last line comes from: CURRENT_USER=$(stat -f "%Su" "/dev/console") echo "$(date "+%a %h %d %H:%M:%S"): Current user set to $CURRENT_USER." >> "$TMP_DEBUG_LOG"

It did not appeared when I ran tail -f from the Setup Assistant windows.

Am I the only one experiencing this, are you unable to reproduce this?

kbareis commented 5 years ago

@remusache Where are you installing DEPNotify? The script assumes that it is installed into /Applications/Utilities. That is the default location if you download the .pkg installer from the GitLab repo.

Are you installing DEPNotify in a different location or renaming it by chance?

If you are then you ether need to change where you are installing DEPNotify or change this line of code: DEP_NOTIFY_APP="/Applications/Utilities/DEPNotify.app"

As far as only one experiencing this, I am not sure. I cannot reproduce the issue so I have to imagine that is some sort of configuration or pathing issue.

kbareis commented 5 years ago

@remusache

I found something! You have a few lines that are different then the published script. Look for sudo -u "$CURRENT_USER" "$DEP_NOTIFY_APP" -path "$DEP_NOTIFY_CONFIG" -fullScreen& sudo -u "$CURRENT_USER" "$DEP_NOTIFY_APP" -path "$DEP_NOTIFY_CONFIG"&

Notice the missing /Contents/MacOS/DEPNotify after the $DEP_NOTIFY_APP variable. It should look like this: sudo -u "$CURRENT_USER" "$DEP_NOTIFY_APP"/Contents/MacOS/DEPNotify -path "$DEP_NOTIFY_CONFIG" -fullScreen& sudo -u "$CURRENT_USER" "$DEP_NOTIFY_APP"/Contents/MacOS/DEPNotify -path "$DEP_NOTIFY_CONFIG"&

After cleaning this up, I am not seeing issues!

remusache commented 5 years ago

sudo -u "$CURRENT_USER" "$DEP_NOTIFY_APP"/Contents/MacOS/DEPNotify -path "$DEP_NOTIFY_CONFIG" -fullScreen& ......

It was llike that before and it still didn't work. I changed back today and tried again… no dice. The packages install without the GUI.

And when the GUI starts, it happens once in awhile (that is the strange part), I immediately get the installation complete. Press Quit to continue.

aaaaa… 😫 I give up! I don't wanna stress you anymore.

kbareis commented 5 years ago

Hey @remusache,

You are not a stress and I want to get to the bottom of this like you!

I cleaned up a few lines and ran it against my 10.13.6 test machine with DEPNotify 1.1.0 and Jamf Pro 10.7.1. Attached is the exact copy I ran along with a screenshot of some other info.

screen shot 2018-10-03 at 7 56 26 pm

Linnéuniversitetet_DEPNotify.sh.zip

remusache commented 5 years ago

Hey @kbareis

Using now the script that you attached…

After manually starting DEPNotify, because it did not start by itself, again… :) I noticed that "Waiting for the Dock" message plus those other 2 bellow the Dock one in the logs. Does that mean anything to you?

Last login: Thu Oct  4 08:42:40 on console
mb-00319:~ lnuadmin$ /Applications/Utilities/DEPNotify.app/Contents/MacOS/DEPNotify ; exit;
Waiting for the Dock
2018-10-04 08:44:36.043 DEPNotify[7479:27556] Failed to set (keyPath) user defined inspected property on (DEPNotify.WindowController): [<DEPNotify.WindowController 0x7fed95419240> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath.
2018-10-04 08:44:36.043 DEPNotify[7479:27556] Failed to set (backgroundColor) user defined inspected property on (DEPNotify.ViewController): [<DEPNotify.ViewController 0x7fed9541ea30> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key backgroundColor.
Reticulating splines...
Change observed
Reticulating splines...
tail: : No such file or directory
Command observed
MainTitle: Välkommen till Linnéuniversitetet
Command observed
MainText: Den här processen installerar några program som är nödvändiga för datorn. Processen tar mellan 20-30 minuter att utföra.
Command observed
Help: https://serviceportalen.lnu.se/
Installationen startar...
Change observed
Installationen startar...
Command observed
Determinate: 29
Installerar Adobe Acrobat Reader DC...
Change observed
Installerar Adobe Acrobat Reader DC...
Installerar Adobe FlashPlayer...
Change observed
remusache commented 5 years ago

I think I know why is not working, I think… I have the PreStage like this:

screen shot 2018-10-04 at 10 17 34

I want to Skip Account Creation.

This way, when the initial setup is done, the OS waits for us to log in - in this case with lnuadmin. So after we log in, the script starts installing the packages with no GUI, or maybe it starts even before we log in…

If I sudo jamf deleteSetupDone and then go thru DEP again (without formating the HD), this time Setup Assistant asks for a username and a password and logs in automatically - then, the GUI starts and works as it should.

Is there a chance that we and I mean you 😊 can tell DEPNotify and Company to wait until the user logs in?

kbareis commented 5 years ago

Hey @remusache!

That is it! That is the missing piece. Let me rephrase your workflow so that I understand it.

What I need to add to the script is an additional check after the Setup Assistant is done. This check would put back in code that looked at /dev/console and who the user is.

This change should take me just a few days to write and verify via testing.

remusache commented 5 years ago

Hey @kbareis 🙂

Yes, that is exactly how my workflow flows! 😋 Yeeeey… we are moving forward. Thank you so much for taking the time to get to the bottom of this.

remusache commented 5 years ago

Quick suggestion @kbareis - like you don't already have enough on your plate! 😜

When installing the packages, the Mac wants to go to sleep - the nerve of that guy… Doest it take a lot of script work, to pump some caffeine into its system while installing the packages?

kbareis commented 5 years ago

@remusache I added a check for the Finder process which should help with what you are seeing. Please verify that the new version of the script works better for you. If it works, please close out this issue.

As far as sleep goes, I had been thinking about that too. I will add it to the idea list.

kbareis commented 5 years ago

Pushed the update yesterday. Looking at the finder process as that was the most consistent. Please verify and close if it works!

remusache commented 5 years ago

Apologies for the delay @kbareis It was crazy at work today.

I tested the script on two machines already and I must say… if you are ever in Sweden I'll buy a lunch :) It works!

Thank you so much for your time and help.

jp411 commented 5 years ago

Hi DEPNotify is not launching for me either. It looks like there is a fix, would you be able to provide that script in english? Thank you in advance.

fbyoung9 commented 5 years ago

I'm having this same exact issue... Any update since this thread?

GabeShack commented 5 years ago

I am also seeing the UI not launching until I directly open the DEPNotify app. Im going to try a wipe and reimage of my test machine so I can confirm. My settings are set to create a management user and a local admin user. Then I just click through to login and no window pops up until I open DEPNotify.