Month: November 2009

OS X

Custom Parallels VM icons

I run a lot of VMs in Parallels. (Currently I am running 7, although not all at once, of course.) I end up with a bunch of red generic Parallels VM alias icons on my desktop. Which means that the usual visual quick clues (color, logos, etc) aren’t there and I have to look at the text underneath. Sometimes I am in a rush and start Windows Server 2008 instead of Windows 7 Pro, or Ubuntu Linux instead of Debian Linux (one is set up as a desktop and one as a server with no X).

I really wanted some custom icons for those VMs. My solution, (as usual) when it doesn’t exist make it. So, I opened pvs.icns (contained in the Parallels Desktop.app bundle /Applications/Parallels Desktop.app/Contents/Resources/pvs.icns) in Icon Composer.app, selected the 512 x 512 version and copied it to the clipboard. I then pasted that into a new Photoshop document and began editing. I saved each new version as a 512 x 512 pixel png and then dropped them in img2icns.app which converted them to the icns files I needed to customize my VM launchers.

icon_anim.gifBehold the glory:

They aren’t perfect, especially the Windows Server 2008, but they are different enough that it is easy to select the right VM in a heartbeat.

You can download the icns files from http://www.evardsson.com/files/parallels_icons.zip

Parallels

Try out Chrome OS in a VM – even Parallels!

If you have been curious about trying out Google’s Chrome OS (or Chromium OS – they seem to call it both) there is a VMWare image available for download at gdgt.com. You will need to set up an account there if you don’t already have one, but it is painless. The VM image is zipped to around 300MB so downloading is not painful at all.

If you are using VMWare Player or VirtualBox or VMWare Fusion (on Mac) there is nothing you need to do but open it up and go. If you are using Parallels, however, there are a couple steps to take.

First you need to convert the vmdk to a raw disk image. To do this you will need to get Qemu (actually, qemu-img, a utility that comes with Qemu.) If you are on a Mac (as most Parallels users are) you can download and install Q, which is a very nice OS X port of Qemu with a GUI (which we won’t be using for this exercise).

The command to convert the disk image is slightly different if you are using the default Qemu package or the one provided with Q. If you are using the default the following should work (assuming your install of Qemu is in /usr/bin/):

/usr/bin/qemu-img convert chrome-os-0.4.22.8-gdgt.vmdk -O raw chrome.hdd

If you are using Q, the version of qemu-img that is included does not quite handle the command line switches correctly. Luckily, it defaults to raw image output. The command if you have Q installed should look like:

/Applications/Q.app/Contents/MacOS/qemu-img convert chrome-os-0.4.22.8-gdgt.vmdk chrome.hdd

Now, start up Parallels, and add a new VM. For type, set it to Other Linux and when it asks whether to create a new disk image or use an existing one tell it to use the disk image you just created.

Start the VM and enjoy(?) the browser as OS experience. Oh, and the login credentials? Your Google account.

Best Practices

Daylight Saving Time Headaches

I have never been particularly fond of the concept of Daylight Saving Time (cutting one off of a blanket and sewing to the other end does not make a longer blanket.) This time around, though, I ran into an issue involving the perfect combination of a monthly cron job, a server set to local time and the switch from Daylight Saving to Standard Time on the first of the month.

At precisely 1:14 am on the first day of the month the cron job ran, as it does the first day of every month, and picked a raffle winner for one of our client’s monthly contests. At 2:00 am the time on the server rolled back to 1:00 am in accordance with the switch to Standard Time for the US. Fourteen minutes later the job ran again, and picked another winner.

Whoops. Now our system has awarded two people a single prize. Telling the second one to get the prize that they didn’t really win would not get us any points with the client, as their customer would be upset. Likewise, charging the client for the second prize is a non-starter, as it is, in fact, our fault. When I inherited these systems I looked through all the cron jobs to get a feel for what the system is doing and when. What didn’t occur to me, however, was that jobs scheduled at the wrong time of day could fall victim to Daylight Saving/Standard Time change-overs.

Any daily job that runs between 1:00 am and 2:00 am will fail to run once a year (Standard -> Daylight Saving when clocks jump ahead an hour) and will run twice once a year (Daylight Saving -> Standard Time when clocks fall back from 2:00 am to 1:00 am). Weekly jobs that run between 1:00 am and 2:00 am on Sundays will likewise misbehave, while monthly jobs, regardless of day of the month, have a small chance of experiencing one of these issues. In this case, the job runs on the 1st, which happened to be the first Sunday in November, and bang: error.

Needless to say, we modified all the cron jobs to ensure than none of them start between 1:00 am and 2:00 am.