Running Ubuntu under Parallels Desktop for Mac

Installing Ubuntu 6.06 Dapper Drake under Parallels Desktop is really easy to do so here's a few pointers how to do it and to customise it to be easier to use via the mac keyboard:

The installation

  1. Download the Desktop CD .iso image from the Ubuntu Downloads site
  2. Create a new VM (I chose "Linux" and then "Other Linux kernel 2.6")
  3. Once you have done this edit the VM's settings so that the boot sequence will use the CD first.
  4. Next open the CD settings and change the CD to run from an image file and point it at the iso image you have downloaded
  5. For memory settings I used 376mb and it runs just fine. You can use more but I have heard of people running into issues using 1GB
  6. Boot the new Virtual Machine and you should end up running the desktop linux.
  7. To install linux permanently simply run the install shortcut from the desktop.
  8. Once complete shutdown Ubuntu, stop the VM and revert the CD to a normal CD device instead of the image file.

Changing the resolution

Now the one thing that I found a little annoying with the newly installed ubuntu is that it defaults to a maximum resolution of 1024x768 which hardly makes best use of the full resolution of the MacBook Pro or indeed the larger resolution of your MacBook etc. So to remedy this I though I should be able to simply edit the xorg.conf file found at /etc/X11/xorg.conf, however doing this did not work at all. The available resolutions do not change from what had existed before.

Then when I was double checking my edits to the xorg.conf file I noticed this note:

# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg

So I ran sudo dpkg-reconfigure -phigh xserver-xorg from the ubuntu terminal. This runs the command line configuration tool for xorg. When going through the options I selected the default "vesa" driver (I wouldn't recommend deviating from this).

In the next step I was able to choose the resolutions that I wanted. I added both 1440x900 and 1280x800 but once I had restarted the X server, Ctrl+Alt+backspace the Ubuntu VM jumped straight to the 1440x900 resolution. This is perfect for full-screen use. In trying to change the resolution down to 1280x800 which is more ideal for use of the VM in a window I found that every time the OS reverted to the 1440x900 resolution. Thus it would appear that for now that you will only be able to achieve the maximum resolution that you make available from the configuration tool. If you like the full screen mode then feel free to set the resolution to match your mac and the you can set the VM to always use full-screen mode when you launch. Great for convincing linux buffs that you just splashed out on a mac only to rip out OSX and run Ubuntu!

Improving the keyboard mappings with xmodmap

Once again like using windows under Parallels if you live in the UK you will need to set the keyboard to an American layout to better match that of the mac. Even when you have done that you will find that some keys don't work as expected for example the backticks and tilde key are mapped to < and > . To fix this and the to re-map the apple key it's possible to use a tool called xmodmap which allows you to create new key mappings.

After a while experimenting with this I came up with the following keymap file:

!this sorts out the apple key+backspace to do delete
keycode  22 = BackSpace Terminate_Server Delete
!map tilde and grave
keycode 94 = grave asciitilde
!maps apple key to ctrl
remove Control = Control_L
keycode 115 = Control_L
keycode 37 = Control_L
add Control = Control_L

If you want to use this you will need to add it to a file called ~/.xmodmaprc then you can test it by running xmodmap ~/.xmodmaprc. When you logout and log back in you will be asked if you wish to load the modmap file. When this happens you will need to move the file across to be loaded everytime X starts up.

Dialogue showing adding the xmodmaprc file to be loaded when x starts up

There's more work that can be done with the keyboard but this is certainly a step in the right direction. Ideally I would properly map a key for the right mouse button though I normally use an external mouse so this is less of a problem. Also alt+(1-0) need to be mapped to the correct keys. Alt+3 should be # whereas at the moment you need to use shift+3 for #.

Hopefully it won't be long before there is a "Parallels Tools" package for linux so that you don't have to press Ctrl+Alt to switch from the VM to mac as well as having better support for the clipboard between host and VM. This is planned, so hopefully we won't have too long to wait.

comments powered by Disqus