Policy Error: sh: -c: line 0: syntax error near unexpected token `('

kirkd
New Contributor II

I have a 10.6.8 machine that keeps throwing the above error when policies run. Here is a log from a simple dock item policy:

Sending Wake On LAN command...
Opening SSH Connection to 128.135.205.148...
Accepting authentication method...
Authenticating...
Successfully authenticated.
Verifying Computer's Identity...
The MAC Address has been verified.
Checking Operating System Version...
Running Mac OS X 10.6.8 (10K549)
Verifying /usr/sbin/jamf...
/usr/sbin/jamf is current (8.63)
Verifying /usr/sbin/jamfvnc...
/usr/sbin/jamfvnc does not exist.
Verifying /Library/Preferences/com.jamfsoftware.jamf.plist...
Preparing Policy...
Executing Policy 2013-02-28 at 8:00 AM | dkirk | 1 Computer...
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/usr/sbin/chown slevmore (Deleted) '//Users/slevmore (Deleted)/Library/Preferences/com.apple.dock.plist' >& /private/tmp/14336.tmp'
Relaunching dock(s)...
Submitting log to https://MYJSS:8443//...
Finished.

I received the same syntax error when running a Flash update on the same machine. Anyone have input on this?

9 REPLIES 9

mm2270
Legendary Contributor III

Is the policy running a script of any sort? Before, After, as part of a pkg install? The 'syntax error near unexpected token' line would seem to indicate its trying to run a script that has some syntax issues.

kirkd
New Contributor II

Hi MM,
I do not have a script running on this policy, all the policy is setup to do is add a dock item.

mm2270
Legendary Contributor III

Its possible that something in the management framework is corrupted or damaged, like the jamf binary. You mentioned the same error comes up with other policies, and the error doesn't seem to be related to a bad install pkg, script or even a mismatched service account password, for example.
Adding a dock icon calls a /usr/sbin/jamf modifyDock command inside the jamf binary. so if something is messed up, I can see how you'd get some errors. I'm just taking a guess here. Your JAMF rep may have a better idea, so you might want to send this one their way.

But, you could try unenrolling the Mac with a sudo jamf removeFramework command. If you have ssh access into the affected Mac, you can do it remotely. Then re-add the Mac in by either deploying a QuickAdd.pkg to it, or some other method, like Recon.app network scan targeted to the Mac's IP, e.g. I'm pretty sure if you keep the inventory record in place, everything will pair up again as the JSS will see its the same Mac.

Hope that helps.

kirkd
New Contributor II

I sent jamf removeFramework as root via ARD without issue. Then I sent the quick add package as root via ARD to the same machine. The quick add package will not finish installing. There is something unique to this computer that Casper just doesn't like. It certainly seems to be related to recon talking to the JSS since the applications and/or dock items I install via policy work without issue. This computer, and only this computer, is not able to finish running recon.

mm2270
Legendary Contributor III

Run a verbose recon on it to see if you can spot where its getting hung up:
sudo jamf recon -verbose

I've seen it get stuck no gathering package receipts, as an example.

kirkd
New Contributor II

Good idea MM,
I did not know about the -verbose flag, nice tip!
I am running verbose recon now, oddly enough Recon is hanging at locating Applications, it cannot get past Disk Utility. I will let it run to see if it finishes.

kirkd
New Contributor II

Update: Recon will not finish, it is stuck on locating applications.

mm2270
Legendary Contributor III

Strange. Probably the machine is foobar in some way. You can try doing some of the standard fix stuff, like verifying the disk, repairing permissions, etc. Some of that can be done remotely, but for some you may need to get your hands on the Mac.

kirkd
New Contributor II

Yeah,
The machine is over four years old and "dirty". I am lobbying to replace it. Thanks for all your help!