Running Ubuntu 9.10 on Virtual PC

Ubuntu 9.10 on Virtual PC 2007

If for some reason you are stuck trying to run the latest Ubuntu (9.10 right now) on top of Microsoft Virtual PC 2007 SP1, you'll probably notice that while Virtual PC is a great virtualization solution for Windows and DOS, Linux isn't quite supported.

While earlier Ubuntu version had some issues just getting installed, you can just mount the 9.10 ISO file to the virtual disk drive and install the OS through the default installation process. As soon as the process completes, Ubuntu should be able to boot up (sometimes the reboot appears to hang — in that case just hard reset the virtual machine and Ubuntu will boot up).

Some features require some fiddling in order to work and — if like me your linux sysadmin skillz are pretty weak — the following instructions could turn useful.  ;)

Display resolution

Ubuntu is unable to determine the display of the virtual machine and will default to an 800 by 600 resolution. If you attempt to change the resolution through the standard dialogs, you'll notice you can't and Ubuntu complains about an "unknown display".

The latest Ubuntu releases do not use an X server configuration file but attempt to autoconfigure everything. This is a great feature, but in our case it means we'll have to write the whole X11 configuration file: run sudo gedit /etc/X11/xorg.conf in a terminal and paste in the following text.

# xorg.conf (xorg X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# 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

Section "Files"
EndSection

Section "InputDevice"
    Identifier "Generic Keyboard"
    Driver "kbd"
    Option "CoreKeyboard"
    Option "XkbRules" "xorg"
    Option "XkbModel" "pc105"
    Option "XkbLayout" "us"
EndSection

Section "InputDevice"
    Identifier "Configured Mouse"
    Driver "mouse"
    Option "CorePointer"
    Option "Device" "/dev/input/mice"
    Option "Protocol" "ImPS/2"
    Option "ZAxisMapping" "4 5"
    Option "Emulate3Buttons" "true"
EndSection

Section "Device"
    Identifier "Generic Video Card"
    Driver "vesa"
    BusID "PCI:0:8:0"
EndSection

Section "Monitor"
    Identifier "Generic Monitor"
    Option "DPMS"
    HorizSync 30-70
    VertRefresh 50-160
EndSection

Section "Screen"
    Identifier "Default Screen"
    Device "Generic Video Card"
    Monitor "Generic Monitor"
    DefaultDepth 16
    SubSection "Display"
    Depth 16
    Modes "1024x768" "800x600"
    EndSubSection
EndSection

Section "ServerLayout"
    Identifier "Default Layout"
    Screen "Default Screen"
    InputDevice "Generic Keyboard"
    InputDevice "Configured Mouse"
EndSection

Of course you can edit the bold part and add as many resolutions you want: mind that Ubuntu will use the highest one by default and switching from one to another usually doesn't work.

You must then reset the X11 server in order to apply the changes: the usual [Ctrl+Alt+Backspace] combination doesn't get through the virtual machine, so you'll need to manually kill and restart X using a terminal or reboot the machine.

Mouse wheel

In my case, the mouse wheel refused to work. In order to enable it, you can try to change the mouse driver by editing the same xorg.conf file you created before:

Section "InputDevice"
    Identifier "Configured Mouse"
    Driver "vmmouse"
    Option "CorePointer"
    Option "Device" "/dev/input/mice"
    Option "Protocol" "ImPS/2"
    Option "ZAxisMapping" "4 5"
    Option "Emulate3Buttons" "true"
EndSection

Restart X and the wheel should work.

Sound output

Virtual PC emulates a Sound Blaster 16 compatible device: these sound cards work fine on Windows and on DOS, but for some reason they are somewhat harder to get playing audio on Ubuntu. You'll need to add a module to the loaded kernel modules at start up. In order to do this, open up the /etc/modules/ file and add the following line:

snd-sb16

You'll need to reboot the system or add the module at runtime by launching sudo modprobe snd-sb16. This should enable the sound card and let you play audio. The output isn't completely satisfactory sometimes (using the ALSA output in GStreamer stutters very badly), but it works.

Networking

This should work out of the box: if not, ensure that you selected the NAT mode in your virtual machine settings and switch the network manager in Ubuntu to "auto eth0".