Monday, December 7, 2009

Start With What You Know Best

So, I decided to start a regular blog. I have always wanted to but could never decide what to write. The most common advice I've read on how to start is to write about what you know and do it regularly.

My plan is simple, I hope. My day job consists of supporting and administering a few hundred Macintosh clients and servers across multiple sights. As with most techs and sys admins, Google has become my "go to" source for information when I run into problems I can't solve. Though as our environment gets more complex, our problems become more unique and Google has fewer answers.

My goal here is to fill those gaps. Not only to document my fixes for myself to refer back to later but to also try and give back to the Mac community that has helped me so often.

Always check those permissions

After two days of trying to track down a persistent font error in Microsoft Office 2004(Yes we are still using MS Office 2004, don't ask) for our new 10.6 image we finally tracked down the error.

The problem was that Microsoft Equation Editor would complain.
Equation Editor’s “MT Extra” screen font is not available. Some characters will not display or print correctly without this font installed. Please re-install Equation Editor.
Also, when you would open a new document in Microsoft PowerPoint 2004 it would also complain that it was missing default fonts including MS PGothic and two other CJK (Chinese, Japanese, and Korean) fonts.

A little bit of background. Starting with Snow Leopard we started using instaDMG to build our images and as a result have had to completely rework our image building process. Creating 45+ packages and modularizing the image build process as much as possible. Time consuming to say the least, but fun and a great learning opportunity.

While trying to track down the root of the problem I used a clean 10.6 install from the retail disk and then installed our custom Microsoft Office 2004 11.5.6 package. To my surprise I found that all was working. No more complaining about missing fonts. So it wasn't our package. We then took our new image building process and built a clean image with none of our normal software installed. Then I installed our Office package again. This time the errors showed up again. So, is it the image or the process?

After hours of playing around with Font Book, font caches, and reading plenty of articles on font management in 10.6, nothing was working. I was starting to develop a dent in my desk from all the forehead banging.

Rife with frustration I pulled out my old friend OnyX and ran the full gambit of Automated tasks. Afterward, it works! Now I just need to figure out which task fixed it. Using the tried and true, but time consuming, process of elimination we discover that the Repair Permissions task fixed both problems.

Huh, how about that. The most recommended fix that rarely, if ever, fixes anything actually fixed something.

So I whip up a quickie postflight script
#!/bin/bash
# post flight script to repair a volumes permissions.
# Adopted from InstaDMGJDT.pdf Appendix B (Delocalizer)
# kaltekar@gmail.com 12/04/09

if /usr/sbin/diskutil repairpermissions "$3"; then
echo "Repair Permissions Complete"
else
echo "Error: Unable to complete Permissions Repair"
fi
Then put it into an empty package using Iceberg and add it to the tail end of the instaDMG build train. We rebuilt the image and tested. Would you look at that, it worked.

So the moral of the story is: Always make sure you repair the permission before closing out your image.

---
An interesting side note, one of our early testers was having formatting and font issues with his Pages documents and templates in Apple's iWork '09. After repairing permissions on his system it fixed all his formatting problems as well.