How to setup Ubuntu under MacOS X on a Macbook with Swedish keyboard (svenskt tangentbord) using VirtualBox

by Peter Jaric

Today I will present a guest appearance by my friend and colleague Stefan Hellkvist, a fellow programmer and the guy behind the standingonabeach.com photo blog. He will describe how to fix some problems when running Ubuntu as a guest OS in VirtualBox on a Mac OS X host. Over to Stefan:

“The installation of VirtualBox is straight forward. You just download it from its website and install it as any other MacOS X application. Then you create your virtual machine, download the latest Ubuntu ISO from its website, boot Ubuntu and install that within VirtualBox.

What you are left with now is a Ubuntu running at 800×600 screen resolution and a not fully working keyboard. Keys such as pipe (|), back-slash (), at-sign (@) etc are impossible to type even if you set the “right” keyboard layout at installation. So it’s a system not very useful for hacking on unfortunately.

First off – screen resolution. It turns out that this was fairly easy to solve. You just need to install the Guest Addition tools.

guestadditiontools

When you choose this option in VirtualBox it will place an ISO into your CDROM. All you then need to do is to, on the Ubuntu machine, go into /media/cdrom and type “sudo sh VBoxLinuxAdditions-x86.run” if you are using a 32-bit linux (the 64-bit version is there as well). This will install the required kernel modules
so that, after reboot, you shall be able to run ubuntu full-screen on your Macbook.

Secondly – the Swedish keyboard layout. Partly this is a problem with VirtualBox choosing the apple-key as “host”-key – the key that you switch between the virtual machine and the host with (in this case OS X). This key is normally used for typing these special characters on a Macbook. There are many ways to work around this but one way to make this work is to do two things in Ubuntu.

1) You open up the keyboard setting dialog (System->Preferences->Keyboard)

keyboardpreferences

and for Keyboard Model you here select “Macbook/Macbook Pro” which is under “Apple”

2) Click “Other options”

layoutoptions

and in “Third level chooser” you select “Press right win-key to choose 3rd level”. Click ok to save these settings.

This will give you similar functionality as when working on a PC keyboard with Swedish characters – that you have an Alt-Gr key for these special keys. The only thing which I’ve noticed a bit strange is the placement of the characters for “<" and ">” which are in the upper left corner. Otherwise it works more or less as expected given that you cannot use the normal apple-key under Ubuntu.

The one thing that remains is to find some easy way to “right-click” under Ubuntu. I’ve seen a couple of options for this such as having a special button or screen area to switch the click function, or to use the eject key to right-click, but I would like to make the ctrl-click work as you normally use it under Mac.”

Thank you, Stefan. If someone knows the answer to Stefan’s remaining issue, please leave a comment here!