How to stop the OS X VM system log being flooded with WindowServer errors

Last week I started the process of converting my 2012 MacMini into a VMware ESXi host.  I have quite a few tips I hope to find time to post but for now, here is one issue I resolved today that others might find very helpful.
 

After installing OS X into a VM on ESXi, you have probably seen the system log file flooded multiple times per second with this error message.

WindowServer: _CGXGLDisplayContextForDisplayDevice: No matching context for device (0xdeadbeef) – disabling OpenGL

Despite what I found on other blogs, like the great Infrageeks blog (which was a great help in my journey), it IS possible to stop these error messages.  You simply need to create a syslog filter rule to ignore them.

 

As root, edit the /etc/asl.conf file.  About 20 lines down, before the rule that saves every message, we want to add our exclusion rule so that it won’t be saved.  So just before this line…

# save everything from emergency to notice

copy and insert the following 2 lines.

# ignore WindowServer messages due to ESXi display device
? [= Sender WindowServer] [= Level 4] [= Facility user] [CA= Message _CGXGLDisplayContextForDisplayDevice] ignore

Save the file and exit your editor.

 

Now you will need to restart the syslog daemon so it will use the updated rule.  You could reboot the OS X system but it is a lot faster to just manually restart the process.

sudo launchctl unload /System/Library/LauchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LauchDaemons/com.apple.syslogd.plist

If you monitor the /var/log/system.log file now, you will see a bunch of Configuration Notice: ASL Module messages as the daemon reloads but more importantly, no more WindowServer messages!

 

Hope this helps.

Posted in Tips, Tricks and Hacks, VMware | Comments Off

Manage Books and PDFs in iTunes 12

Last year Apple introduced the iBooks application for Mavericks.  iBooks for OSX was to bring the management and syncing of your books and PDFs to your iDevices out of iTunes.  However, even though it was labeled as version 1.0, it felt more like a 0.1 release as some basic management features were (and still are) missing.   One of the largest oversights of iBooks was the lack of ability to manage the metadata of your books.  If you purchased all of your books from the iTunes iBook store, this shouldn’t be a problem as those books come fully populated with metadata.  But most of my books were purchased from third party book stores and didn’t have the correct, if any, metadata within the file.

When iBooks and iTunes 11 were released, people hated iBooks and looked for ways to remove it and to restore the book management functionality into iTunes.  There were many blog posts on how to do it, Robert Setiadi’s blog for example. However, if you have installed Yosemite and iTunes 12, iBooks has been reinstalled so you will need to go thru the procedure again to ‘fix’ it.  The procedure is similar but earlier instructions don’t work because of Yosemite’s changes.

Here are the steps to restore books and PDF management to iTunes 12 on Yosemite.

1. Reboot your Mac.  If you have launched iTunes, it will have launched a background process to talk to iBooks.  Quitting iTunes does not stop this process.  It is best to just reboot.

Note:  If for some reason you have added iTunes to your Login Items so that it starts up automatically after you log into your Mac, please remove it.

If you can’t (don’t want to) reboot, quit iTunes then open the Activity Monitor utility and kill the com.apple.BKAgentService process.

2. Open the Terminal application and copy/paste the following command.

Note: This is a single line command.

sudo mv /System/Library/PrivateFrameworks/BookKit.framework/Versions/A/XPCServices/com.apple.BKAgentService.xpc/Contents/MacOS/com.apple.BKAgentService{,-disabled}

After pasting the command, press return and you will be prompted for your password, which is required because it is a system file.  This will rename the background process application so that when iTunes runs, it will fail to start the process and not be able to communicate with iBooks.

3. Remove the iBooks application.  Since it will have installed various preference files, it is easier to remove iBooks by using the free AppCleaner utility.  Simply run AppCleaner then drag the iBooks application icon into the AppCleaner window.  It will show you a list of about 6 files/folders that it will remove.  Confirm the removal and it will move the files into the Trash.  Quit AppCleaner and empty the Trash.

4. Now launch iTunes and you should see the Audiobooks option has changed back to Book (which includes Audiobooks, epub books, and PDFs)

iTunes12Sources

If you still see Audiobooks listed instead of Books, it means iTunes thinks iBooks is still managing your books/PDFs.  Try again by repeating the steps above.

Hope this helps.

Posted in Uncategorized | Comments Off

Clean the Open With… menu

There have been a few blog posts recently discussing how to clean out the duplicate/old entries in the Open With contextual menu.  However, they all give (poor) instructions on how to add an Terminal command-line alias into a .bashrc file.  The problem here is that most users are not familiar with the command shell and trying to edit a hidden or non-existent .bashrc file is very confusing.  Until Apple fixes this issue, why make it harder on yourself.  Here is a method that is more user-friendly using Automator.

UPDATE: Scroll to the bottom of the post to download the Service file and instructions on how to install it.

Open the Automator application.

When it starts, it will ask you what kind of workflow to create.  Choose the Service option.

At the top, change the “Service receives” pop-up menu from “text” to “no input” and in “any application” to “Finder”.

In the Actions Library, select Utilities then drag the “Run Shell Script” to the right hand side.  (If you don’t see the Library on the left side, click the Show Library button at the top.)

In the “Run Shell Script” step, delete the “cat” sample command and copy/paste the following code.  Make sure it is a single line as I’m sure the blog page will break this into multiple lines.  Even in the image below it looks like 3 lines but is actually a single line of code.

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

Now choose File>Save and name it “Clean Open With menu”.  You can now close/quit Automator.

So now whenever you need to clean up the Open With menu, simply go to the Finder menu then choose Services > Clean Open With menu.  This will launch the script which will run the lsregister utility.

 

A few caveats to be aware of when using this utility.

  1. As some of the other blogs have mentioned, it isn’t necessary to kill the Finder.  The lsregister utility can take a few minutes to rebuild the database.  Just be patient and within a few minutes, the Open With menu will be cleaned of all the duplicates.
  2. Resetting the database also means that it no longer knows which applications you have approved to be opened automatically when opening a document.  You will be prompted with an “Are you sure?” security prompt the first time you launch an application by opening a related document.

 

UPDATE: Per a few requests, I’ve zipped up the Clean Open With Menu Service which you can download here.  Simply unzip the archive and double click on Clean Open With Menu workflow file.  The Finder will ask if you wish to just install the workflow or open it in Automator.  Click the Install button and you are all set.

Posted in Failures, Geek, Tips, Tricks and Hacks | Comments Off

Apple Genius steals precious drive space

The other day I reported on my issues with a faulty SD card reader.  A couple of support forum users had success in having the logic board replaced so I made an appointment with an Apple Genius.  My assigned Genius, Taylor, was great to work with.  He was very friendly and although he had never seen this particular issue before, he completed the troubleshooting without fail.  Even though it was the morning of Christmas Eve, and I’m sure they had a long day ahead of them, he was patient with me while we discussed the problem and came up with a repair schedule that worked for me.  This post isn’t about how great they are so let me get into the problem.

During the troubleshooting, Taylor plugged my laptop into their network and booted an OS X image from their NetBoot server.  He tested the SD card reader with his SD card so that he was able to reproduce the problem with a known, good environment.  This only took a few minutes and when he was finished, he shutdown the laptop.

This morning I noticed that my CrashPlan backup was running which is rare as it normally finishes everything during the night.  I looked at what CrashPlan was uploading and was surprised to see it was pushing up a 16GB sleepimage file.  Normally the backup of the hibernation/sleep image file is skipped by CrashPlan per their global exclusion rules.  I discovered that it was uploading the file located on my secondary hard drive at /Volumes/HDD/.com.apple.NetBootX/sleepimage.  This is odd for a few reasons.

My laptop’s power manager settings, which are saved in NVRAM, is configured to save the sleepimage file on the SSD at /private/var/vm/

It is also configured to only create the sleep image when actually sleeping.  During the troubleshooting, the laptop was never put to sleep but only a normal boot up and down.  I guess it is possible that their boot image would override the laptop’s PM settings but they are back to my settings now.  Perhaps this is a required mode when using a network booted system.

My primary drive (OS, Applications, User folder), in the main drive bay, is an SSD.  It has plenty of space left.  I don’t know why their boot image decided to use the secondary HDD for the sleepimage file instead.

 

There are a couple of items to note here that might make it difficult for some users.

Since the .com.apple.NetBootX directory starts with a period, it is hidden in the Finder, so you can’t just drag it to the trash.

The directory, and all files inside, are owned and only readable/writable by the root user.

Due to these items, most users will never notice the directory.  Depending on how full your drive is, you might not even notice that you have lost the space.  In my case, I don’t have much free space left so an additional 16GBs would be noticed soon enough.  The size of the sleepimage file will be the same as how much RAM you have installed in your machine.  If you only have 4GB of RAM, but a 1TB hard drive, you probably won’t even notice or care about the lost space.

 

If you have ever been to the Apple Genius Bar, and they network booted your computer, you might want to check for the existence of the NetBootX directory.

  1. Open up the Terminal application (located in /Applications/Utilities folder)
  2. Get a full directory listing of the top level of your hard drive, with the command
    ls -al /

    If you have a secondary drive, check it too with

    ls -al /Volumes/[2nd drive name]/

    The listing output will look similar to this.

    $ ls -al /
    drwxr-xr-x   33 root  wheel     1190 Dec 26 13:20 ./
    drwxr-xr-x   33 root  wheel     1190 Dec 26 13:20 ../
    d--x--x--x    8 root  wheel      272 Aug 25 13:04 .DocumentRevisions-V100/
    drwx------    5 user  staff      170 Aug 23 16:05 .Spotlight-V100/
    d-wx-wx-wt    3 user  staff      102 Dec 26 16:25 .Trashes/
    drwx------    5 root  wheel      170 Dec 24 11:24 .com.apple.NetBootX/
    drwx------   69 user  staff     2346 Dec 26 12:37 .fseventsd/
    drwxr-xr-x@   2 root  wheel       68 Jun 20  2012 .vol/
    drwxrwxr-x+ 139 root  admin     4726 Dec 25 12:57 Applications/
    drwxr-xr-x+  68 root  wheel     2312 Nov  7 22:36 Library/
    drwxr-xr-x+   4 root  wheel      136 Jul 26 01:48 System/
    drwxr-xr-x    7 root  admin      238 Aug 20 14:54 Users/
    drwxrwxrwt@   6 root  admin      204 Dec 26 15:24 Volumes/
    drwxr-xr-x@  39 root  wheel     1326 Sep 19 15:41 bin/
    dr-xr-xr-x    3 root  wheel     4709 Dec 25 10:52 dev/
    lrwxr-xr-x@   1 root  wheel       11 Aug 23 19:39 etc@ -> private/etc
    -rw-r--r--@   1 root  wheel  8192160 Aug 25 01:49 mach_kernel
    drwxr-xr-x@   6 root  wheel      204 Jul 26 01:57 private/
    drwxr-xr-x@  62 root  wheel     2108 Sep 19 15:41 sbin/
    lrwxr-xr-x@   1 root  wheel       11 Aug 23 19:39 tmp@ -> private/tmp
    drwxr-xr-x@  13 root  wheel      442 Oct  2 22:01 usr/
    lrwxr-xr-x@   1 root  wheel       11 Aug 23 19:39 var@ -> private/var

    If you are curious to see the size of the files, list the directory with

    $ ls -al /.com.apple.NetBootX 
    drwxr-xr-x@  5 root  wheel          170 Dec 24 11:24 ./
    drwxr-x--x  30 user  staff         1088 Dec 26 13:10 ../
    -rw-r--r--@  1 root  staff    216169984 Dec 24 11:31 shadowfile
    -rw-r--r--@  1 root  staff  17179869184 Dec 24 11:24 sleepimage
    -rw-r--r--@  1 root  wheel     67108864 Dec 24 11:24 swapfile0

    The size of the other files are only a few hundred megabytes, which is minor compared to the sleep image.

  3. If you do have the .com.apple.NetBootX directory, you can remove it with the following command.  WARNING: Running “sudo rm” with the wrong arguments could delete all your files.  Be very careful with this command.  Make sure there is NOT a space between the / and .com….
    sudo /bin/rm -ri /.com.apple.NetBootX

    If it is on your secondary drive, the command will be

    sudo /bin/rm -ri /Volumes/[2nd drive name]/.com.apple.NetBootX

 

You should now be clean of the Genius’ files and the drive space will be available again.  If you ever take your system in again, don’t forget to check for the NetBootX directory when you get it back.

Posted in Tips, Tricks and Hacks | Comments Off

Faulty SD card reader on Late 2011 15″ MacBook Pro

This past weekend I received my Raspberry Pi.  For the first test of the little guy, I’ve decided to install OpenELEC to see how well it would work as our home theater control station (I’ll try to post more on this later).  The wonderful OpenELEC guys have made it very easy to install.  You just download the image file and write it to a SD card so that is what brought me to this situation.

For the first time in the last 1.5 years, I had to use the SD card reader in my [Late 2011 15″] MacBook Pro.  When attempting to mount the card, I encountered problems like no response, saw the card but didn’t mount it, mounted it but in read-only mode, and even a repetitive mount/unmount sequence complete with the OS X warning that I removed a disk improperly.

Thinking it was the card, I tried another one and had the same problems.  A quick web search returned multiple posts of other users having the same problem.  There were multiple suggestions on how to get around this problem but none of them worked for me.  There is even a YouTube video that showed a trick with pulling the card out a slight amount.  It has worked for most people, and it worked for me to allow the card to mount.  However it would only mount as read-only.  No matter what I did, it would not mount read-write.

Although some users reported having the same issue with the Early 2011 MacBook Pro, I was able to use my older laptop with success.  I wrote the OpenELEC image to the SD card and was able to start working on my Raspberry Pi.

I have plans to have the laptop’s logic board replaced later this week.  I will post back with the results.

Posted in Failures, Geek | Comments Off

BookBook Vol. 2 Upgrade

This last spring, I bought the new iPad 3.  I have a few other products by Twelve South including the PlugBug and the Leather SurfacePad so when I needed an iPad case, it was an easy decision to get the BookBook.  This is an amazing iPad case.  I’ve received so many comments on it.  People had no idea I had an iPad with me; “I though you were carrying a journal or something”.

However, being that version is the same model they came out with when the original iPad was released, it had a few dated flaws.  One of the biggest annoyances is that it didn’t have a magnet in the cover to automatically turn the iPad on/off.  After a few minutes of research, trial and error, I had installed a small magnet onto the inside cover.  Now the iPad would turn on/off automatically.  It wasn’t pretty, just taped to the cover, but it worked.

Next up was a way to hold the stylus.  Many people (RIP, Mr. Jobs) say that a stylus isn’t necessary.  Perhaps but sometimes it is very useful.  Personally I use my iPad often for credit card transactions and random people who are not familiar with an iPad have a hard time signing their name using a finger.  Hand them the stylus and they don’t have any problems at all.  I use the Adonit Jot Flip stylus which is an amazing stylus as well as a ball-point pen.  I highly recommend them.  Since the BookBook wasn’t designed to hold a stylus, I just rolled up a business card and taped it to the inside hinge space.

So recently, Twelve South came out with Vol. 2 of the BookBook.   This is a redesign to address 2 major issues.

  1. The iPad was not held securely in place at the top (just a simple elastic band) and it could slip out if the case if held wrong.  I had this happen to me a few times but luckily I would catch it before it fell to the ground.
  2. To adjust the viewing angle, you would use the attached string wrapped around the back.  I guess some people didn’t like this as the string would often be in the way.  I didn’t have this issue as I learned to wrap it up the side and around the top.  It was a minor issue once in a while but I liked it as it allowed me to set the viewing angle to whatever I needed for the situation.  As someone that travels a lot, this was quite useful.

So, with this new design, issue 1 was fixed by creating an enclosure all around the iPad.  Since this meant you couldn’t easily remove the iPad, you would have to angle/lift up so that you could use the back camera.  Since the enclosure could angle up, it was used to replace the string for issue 2 and now you are to rest it against the edge of the top cover.  Some reviewers on Amazon have already complained about it, and I have to agree with them.  When sitting next to me on the desk, the up angle was too steep and the lower angle (used for typing) was too low.  So although the new case holds the iPad more securely, the other issues were disappointing.  Instead of returning the new case and using the old one, I decided to just hack it again to suit my needs.  This time, taking a bit more time to do it better.

Testing magnet placement, Upper tag sewn, showing paper clip for lower tag

First off was to address the cover magnet.  Yes, they didn’t include a magnet on the redesign!  That is just an amazing oversight but easy enough to fix.  I positioned the magnet in the same location but this time covered it with black electrical tape.  Since the inside cover is black, it is not as noticeable as on the brown of the first case.

Next was to come up with a way to give me better viewing angles.  On the inside of the front cover, at the top and bottom are small fabric label tabs with open sides creating loops.  I realized that this was the exact position that I want the enclosure to sit.  I first tried running a black cord between the labels but when it was pulled tight, the labels crumpled and it looked bad. I tried different ways to keep the labels looking right and finally came up with the idea of metal braces.

Label tag sewn with metal brace

This ended up being paperclips bent in a U-shape, 1.5″ wide with .5″ legs.  I slid these into the labels and ran a simple stitching along the front and upper sides to keep them in place.

Completed with straps and magnet covered

For the cross straps, I used an old elastic bra strap pulled tight and sewn shut.  To position the iPad at these levels, I would simply flip out the back (keyboard) riser and slide it behind one of the straps.  This also has the benefit of a light/privacy shield created by the top cover.  Perfection!

 

Lower strap position

This new case is a bit smaller all around so the space along the inside spine for the stylus wasn’t an option this time.  The only place I could make it fit was along the top backside of the internal enclosure.  I’ve only had time to use the same holder as before but held on with the black electrical tape.  Soon I hope to find a better way to hold it in place but for now, it is working.

Upper strap position

Perhaps these ideas will help someone else that has encountered the same issues.  Hopefully Twelve South will come across this post and incorporate these modifications into Vol. 3.  If so, just give me thanks in the credits.

 

Posted in Geek, Tips, Tricks and Hacks | Comments Off