Wednesday, September 12, 2007

Hacking my way to Parallels Tools for Linux

So it turns out both the Windows and Linux machines formerly used in the Artificial Vision project are dead, yet I am supposed to hack toghether a demonstration version of our software for a fair the company is to attend. Since there is no hope in waiting for replacements, I decided to take my own MacBook and continue development on a pair of virtualized environments created over Parallels Desktop – which would be the equivalent to VMware in the Mac world.

For the Linux environment, I picked Kurumin Light, a lightweight version of the Knoppix-based Kurumin Linux distro. Installation went almost without incidents, save for one: in order for the virtual environment's graphical resolution match the dimensions of the enclosing window (and thus make the best possible use of the display), a set of extensions bundled with Parallels Desktop, called Parallels Tools, needs to be installed. Problem is, when I tried to install it, the procedure ended abruptly with a Unable to get layout name error message. A quick Google search led to two forum threads discussing the error, but none getting to a solution; so I decided to try and solve it myself.

Peeking into the installation file, I found it to be a self-extracting GZip archive, which I later found gets extracted to a temporary directory called /tmp/selfgzXXXXXXXXX -- where XXXXXXXXX is an arbitrary number -- in the beggining of the procedure. Among the extracted files, there is a script called, which rewrites the X Server confguration file: it is this script that fails to find the X Server layout name, causing the installation to fail.

With this in mind, I devised the following walk-around to the Unable to get layout name error. All these steps must be executed from a root account:
  1. Run sh, but don't confirm the installation just yet;

  2. Open the /tmp/selfgzXXXXXXXXX/ script file on a plain-text editor. Change line 273 from

    layoutId = None


    layoutId = "Default Layout"

    or any other name to your liking. Don't forget to save;

  3. Confirm installation. Hopefully the script will now execute without errors;

  4. Open /etc/X11/xorg.conf (or the equivalent X Server configuration file on your distro) and locate the "ServerLayout" Section. You'll notice there are two Identifier entries, consequence of the configuration script not telling apart its elbow from its ass... I mean, telling apart the Identifier entry on the original config file. This situation is bound to crash your X Server upon restart, so comment the original entry off. Also, if you'd like to make sure your pointer device will work properly, locate all "InputDevice" Sections with an Identifier value of "Parallels Mouse" and comment them off, save for one -- which one will depend on your system settings, but the entry with an Option value of "Device" "/dev/input/mice" is probably your best guess, if you aren't X Server savvy;

  5. Restart your X Server, for example by hitting Ctrl + Alt + Backspace.

After executing these steps, I found pointer integration as well as dynamic resolution resizing were working – that is, until I restarted the virtual machine, and learned I would still have to add the "prluserd" service to the list of automatically started services. (Alternatively, I could start it by hand each time, by calling "prluserd" from a root terminal window, and then restart X. But I am not that crazy.)

I hope these steps work for others that are facing problems with Parallels Tools installation on Linux, though as usual I make no guarantees. Parallels Desktop is a wonderfully useful software, and with interface integration on, it enables a very pleasant virtualization experience.


  1. I believe the problem with the script is the regular expression it uses to determine the Identifier. It doesn't allow common things like periods, which you'll get if you use Xorg -configure.

  2. Yes, I think you're right. I generally consider myself pretty knowledgeable in regular expressions, and I did first try to solve the problem by changing the search pattern used to look for the layout name; but to no avail. So I solved it the other way around, by hard-coding a search result into the script.

  3. Hey, you really make my day! This works like hell on my gentoo install on a MBA. Thank you very much for pointing this out!