Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.2 Dockutil hangs when run as sudo #126

Open
K1jaff opened this issue Mar 9, 2022 · 9 comments
Open

3.0.2 Dockutil hangs when run as sudo #126

K1jaff opened this issue Mar 9, 2022 · 9 comments

Comments

@K1jaff
Copy link

K1jaff commented Mar 9, 2022

sudo /usr/local/bin/dockutil --add "/Applications/Microsoft Outlook.app" --allhomes --no-restart -v

verbose mode 1
[file:///Users/Deleted%20Users/, file:///Users/_mbsetupuser/, file:///Users/.localized, file:///Users/Shared/, file:///Users/root/, file:///Users/anuser/, file:///Users/anuser2/]
/Users/Deleted Users/Library/Preferences
/Users/_mbsetupuser/Library/Preferences
/Users/.localized/Library/Preferences
/Users/Shared/Library/Preferences
/Users/root/Library/Preferences
/Users/anuser/Library/Preferences
/Users/anuser2/Library/Preferences
Plist paths: ["/Users/_mbsetupuser/Library/Preferences/com.apple.dock.plist", "/Users/root/Library/Preferences/com.apple.dock.plist", "/Users/anuser/Library/Preferences/com.apple.dock.plist", "/Users/anuser2/Library/Preferences/com.apple.dock.plist"]
processing /Users/_mbsetupuser/Library/Preferences/com.apple.dock.plist
Skipping: /Users/_mbsetupuser/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist
processing /Users/root/Library/Preferences/com.apple.dock.plist
Skipping: /Users/root/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist
processing /Users/anuser/Library/Preferences/com.apple.dock.plist
Skipping: /Users/anuser/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist
processing /Users/anuser2/Library/Preferences/com.apple.dock.plist
/Users/anuser2/Library/Preferences/com.apple.dock.plist
Comparing /Users/anuser2/Library/Preferences/com.apple.dock.plist to /Users/anuser2/Library/Preferences/com.apple.dock.plist
^C - Hangs here

Running in user context or sudo -u $username works without issue.

@Theile
Copy link

Theile commented Apr 11, 2022

I have the same problem:

# /usr/local/bin/dockutil --add "/Applications/Microsoft Word.app" --after 'Microsoft Edge' -v 
verbose mode 1
Plist paths: ["/Users/st/Library/Preferences/com.apple.dock.plist"]
processing /Users/st/Library/Preferences/com.apple.dock.plist
/Users/st/Library/Preferences/com.apple.dock.plist
Comparing /Users/st/Library/Preferences/com.apple.dock.plist to /Users/st/Library/Preferences/com.apple.dock.plist

^C

It just stalls on my MBP M1 on the comparing step. Alså if --allhomes is used.

@dng2000
Copy link

dng2000 commented Apr 11, 2022 via email

@Theile
Copy link

Theile commented Apr 12, 2022

Thank you @dng2000, I will try again. I'm using Addigy, Mosyle and other MDMs (also Jamf), so I will verify if the others works the same way.

@Theile
Copy link

Theile commented Apr 12, 2022

I had to specify the plist file directly for it to work. dockutil did finish, but without the direct link to the plist-file on the correct user, it would only find the root user, when using Addigy.

@mallej
Copy link

mallej commented Apr 20, 2022

I have the same problem.
Even if I run the script through Munki as a Post-Install-Script it hangs.
But strangely, this does not happen on all my test VMs. I have 2 macOS 12.3.1 VMs and only on one dockutil hangs.

root@TEST-VM22-AutoPkg-Monterey ~ # /usr/local/bin/dockutil --add /Applications/Adobe\ Acrobat\ 2020/Adobe\ Acrobat.app --label 'Adobe Acrobat' --replacing 'Adobe Acrobat' --allhomes -v verbose mode 1 [file:///Users/.localized, file:///Users/Shared/, file:///Users/tadmin/] /Users/.localized/Library/Preferences /Users/Shared/Library/Preferences /Users/tadmin/Library/Preferences Plist paths: ["/Users/tadmin/Library/Preferences/com.apple.dock.plist"] processing /Users/tadmin/Library/Preferences/com.apple.dock.plist /Users/tadmin/Library/Preferences/com.apple.dock.plist Comparing /Users/tadmin/Library/Preferences/com.apple.dock.plist to /Users/tadmin/Library/Preferences/com.apple.dock.plist

@TB-clientops
Copy link

it looks like the defaults call on line 64 of Dock.swift is hanging without exit causing the whole thing to hang on the waitUntilExit() call. I'm not sure why defaults is hanging but that seems to be the holdup.

@kcrawford
Copy link
Owner

I think there is/was an Apple bug with defaults/cfpreferences that would cause it to hang. Has anyone reproduced this on Sonoma 14.2.1 or newer?

@jonesiscoding
Copy link

jonesiscoding commented Jan 11, 2024

I have duplicated this using v3.0.2 on macOS 14.2.1, running as root. Using sudo -u <user> dockutil --list /Users/<user> works without issue.

It does not seem 100% consistent. In roughly 50 systems, I am seeing this on ~3.

Two things I should probably check when I have a free moment:

  • Does this happens with all users on the affected systems
  • Is there a common element in those user's com.apple.dock.plist that isn't found on the other ~47 systems.

@jonesiscoding
Copy link

Just double-checked that it does not affect all users on the affected systems, just specific users. I don't see anything out of the ordinary in the plist, but I haven't done a careful inspection yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants