Sunset in Foz, Porto
logo
fgb photo 1
fgb photo 2
fgb photo 3
Your IP Address:
38.107.191.97
Since 4/10/2004:
119125 visitors

use your existing windows installation as a virtual machine on your debian host

October 2008
I have a machine with both Windows XP Professional and Debian configured for dual boot. My goal was to use my existing physical dual boot partition containing Windows XP Professional as a VM.
This would save me from having to reboot whenever I need to use Windows and avoids wasting extra disk space. This is by no means a straightforward process, so I am hoping to save you some time by showing what worked for me.

my setup

I am using a Dell Latitude D830 Laptop with a 160 GB hard disk and 2 GB RAM.
  • the first partition contains Windows XP Professional
  • the second partition contains Debian Stable/Testing/Unstable, kernel 2.6.22-3-amd64

vmware-server 1 vs 2

First I had a look at the vmware server page and was pleased to see that vmware-server 2 actually has 64-bit support. Hooray! However, there are some big, big, nasty pitfalls:
  • vmware-server 2 does not allow the use of an existing physical installation as a VM
  • the download size of VMware-server-2.0.0-110949.x86_64.tar.gz is a mere 502 MB
  • the beloved VMware Server Console no longer exists! It has been replaced by a nasty, bloated, unnecessary AJAX-nightmare web interface, yuk!!!
This meant that I had to resort to 32-bit-only vmware-server 1 - what a shame!
On the upside, the download was only 103 MB for VMware-server-1.0.7-108231.tar.gz.
For those with extra endurance: I read somewhere that it is possible to first configure a VM of a physical installation using vmware-server 1 and to then upgrade to vmware-server 2 and import the previous VM configuration - thereby getting around the big disappointing limitation of not being able to use a physical installation as a VM.
I am not sure if this would also allow the jump to 64-bit vmware-server 2, but that would be pretty cool.

getting started

I have summarised all relevant information from the various sources that I used to get my system running, so this page should be enough to get everything working.
I recommend viewing these sources especially if things don't work for you, or if you are using a different host OS.
Also please note that in this howto nearly everything (apart from downloading and unpacking) needs to be done either as root or using sudo.
First I came across this page with the same mission, albeit for an Ubuntu host, which was my starting point. For Debian x86_64 things are a little different...

prepare windows

First off I rebooted one last time into Windows and added a hardware profile for vmware. This is how I did it:
  1. right-click on "My Computer" → Properties
  2. select the Hardware tab → Hardware Profiles
  3. copy the current profile, name the copy vmware and move it to the top of the list, making it the default choice
  4. choose a timeout (I set it to 10 seconds)
  5. optionally disable driver signing
  6. now reboot back into linux

install some packages

I am probably missing some packages here, most definitely the correct gcc package, but it is necessary to find out which version of it will be needed, and this can easily be done by waiting for installation errors. So for now I just installed essentials:
$ apt-get install kernel-headers-`uname -r` build-essential ia32-libs xinetd
Other non-gcc packages may be missing, but they were already installed on my machine, so I am not sure which ones... please let me know in case you spot any, so I can add them here.

install vmware-server 1: the normal way

Download vmware-server 1 from the vmware website. I downloaded it into a temporary directory:
$ tar xzvf VMware-server-1.0.7-108231.tar.gz
$ cd vmware-server-distrib
$ ./vmware-install.pl
I picked the default options for everything in addition to this: I enabled NAT and host-only networking. However, my first install failed when the script tried to compile the vmware modules for my kernel.
It complained that the current version of gcc (gcc-4.3) is different from the one used to compile the kernel (gcc-4.1). Now that I found out which version of gcc was needed, I cancelled the installation of vmware and installed the correct gcc version:
$ apt-get install gcc-4.1
It is necessary to point gcc to gcc-4.1 temporarily (or change the environment variable), so that it actually gets used. Also, the installation needs to be run again:
$ pushd /usr/bin
$ ln -sf gcc-4.1 gcc
$ popd
$ ./vmware-install.pl
This time the installation worked fine. It is time to set the link for gcc correctly again:
$ pushd /usr/bin
$ ln -sf gcc-4.3 gcc
$ popd

vmware-package: alternative install

I am aware that there is a vmware-package for debian which allows the creation of vmware-server .deb packages for a more debianised installation. I did not use it, but really there is no reason why not. Instead of running the vmware-install.pl script, it is possible to do the following:
$ apt-get install vmware-package
$ make-vmpkg -ks VMware-server-1.0.7-108231.tar.gz
If compilation of the kernel modules fails it is probably because of the gcc version used, as in the previous section. Simply install the correct version of gcc for the compilation and point the gcc link to it. Then execute the above command again and installation should succeed.
Assuming it all went fine install:
$ cd vmware-server
$ dpkg -i *.deb

first vmware run

Now try running vmware:
$ vmware &
For me vmware did not start, instead I got a locking assertion failure error:
Apparently this is because of a bug in libx11-6 version 1.1.4-2, although even downgrading did not fix it for me. I found the solution here. This is what fixed it for me:
Get the old ia32-libs package and unpack it:
$ mkdir tmp && cd tmp
$ wget http://ftp.uk.debian.org/debian/pool/main/i/ia32-libs/ia32-libs_1.19_amd64.deb
$ ar -x ia32-libs_1.19_amd64.deb
$ tar xzvf data.tar.gz
Copy libX11-6 libs:
$ mkdir /usr/lib/vmware/lib/libX11.so.6
$ cp /tmp/emul/ia32-linux/usr/lib/libX11.so.6* /usr/lib/vmware/lib/libX11.so.6/
Edit the startup script:
$ cp /usr/lib/vmware/lib/wrapper-gtk24.sh /usr/lib/vmware/lib/wrapper-gtk24.sh-orig
$ vim /usr/lib/vmware/lib/wrapper-gtk24.sh
below the line:
vm_append_lib 'libXrender.so.1'
add:
vm_append_lib 'libX11.so.6'
That's it.
Fire up vmware, this time it worked for me:
$ vmware &

create the VM

  • Create a new virtual machine, → Next
  • Choose Custom, → Next
  • Choose Operating System, → Next
  • Choose Name and Location (defaults are ok), → Next
  • Choose Processors (I chose 1), → Next
  • Access Rights (I did not make it private), → Next
  • Memory (I gave it 768MB out of my 2 GB), → Next
  • Choose NAT, → Next
  • Select I/O Adapter Type: I chose BusLogic, → Next
  • Select a Disk: Use a physical disk, → Next
  • Device: /dev/sda and use individual partitions, → Next
  • Partitions: I choose 1 and 2 (one is a linux boot partition and the other is windows), → Next
  • Disk File: Default is ok, → Next and done!

before starting the VM

A big massive word of caution: Before running vmware, make sure that your grub timeout is generous, so you have time to select Windows in your grub menu. Trust me, you do not want to virtualise your running host OS ever, it may render it unbootable!
You can set the grub timeout by editing the file /boot/grub/menu.lst - I set the it to 35 seconds.

starting the VM

At this point I powered up the VM and then clicked on the VM window so that I could use the keyboard to choose windows in the grub menu. Windows started booting ...but soon a blue screen of death appeared and the error code was 0x0000007B:
*** STOP: 0x0000007B (0xF8958640,0xC0000034,0x00000000,0x00000000)
This is to do with a scsi problem (apparently recent kernels > 2.6.22 prefer to use the scsi driver), and can be fixed easily. I found the solution here.
Close vmware and go to the VM directory, in my case:
$ cd "/var/lib/vmware/Virtual Machines/Windows XP Professional"
edit Windows XP Professional.vmx and replace every occurrence of scsi with ide, eg

scsi0.present = "TRUE"

becomes

ide0.present = "TRUE"

and so on.
Edit Windows XP Professional.vmdk, find the line with ddb.adapterType and set it to:

ddb.adapterType = "ide"
Now run vmware and boot your VM, this time it should work, finally!
The final hurdle comes from Windows asking for activation again.

pitfall #1 - 32-bit chroot

When I first tried to install vmware-server I wanted it to run in a 32-bit chroot environment, since I use this for all other 32-bit programs.
The problem I encountered was the lack of the vmware modules and that I could not compile them without the appropriate kernel headers. I was not sure how this could work since in the chroot environment there is no folder for the kernel modules, in other words /lib/modules is empty. Resorting to the ia32-libs was easier.

pitfall #2 - any-any patch

From what I had read it seemed necessary to use the any-any patch for newer kernels in order to install vmware-server, in case module compilation fails.
I used the vmware-any-any-update115 patch and this actually broke the installation, but I only found out a lot later when I realised that vmware server was unable to initialise NAT networking.
In the end it worked without the patch! However, in case the installation fails for you, the patch can be downloaded here. Simply unpack it, go into the corresponding directory and execute: ./runme.pl Then run the vmware-config.pl script.
©superbrose, 2006, 2007 - xhtml - css