Shell Person Help me keep the shell people alive.

8Feb/091

Create a Debian Sid Virtual Machine with VMWare Tools

2450903450_e32a98f887_b2

This post tries to describe how to create a Debian Sid (Unstable) virtual machine (including VMWare Tools) inside a Windows XP SP2 host.  I used EasyVMX.com, Debian Linux, and VMWare Server (all free).

This tutorial assumes that VMWare Server (free) is already installed.  VMWare player (free) can also be used, and it's a little easier in my opinion, but Server is what I was using.

First you need to have a blank virtual machine to install to.  EasyVMX (easyvmx.com) is one of many ways to do this.  I chose EasyVMX 2.0.  Most of the settings will just depend on your preferences, but here are some of the options I chose.

  • I gave the VM 512 MB RAM. Debian will work fine with less, if you don't have it to spare.
  • I used a bridged network device (which gives the VM its own IP address).
  • I created two CD drives, one for actual CDs, the other for mounting .ISO images.
  • I gave the VM 6 GB hard drive space.  This seems to be plenty for me.  You could probably do 4.7 GB and get it to fit on a DVD.  Once I tried 3 GB and it didn't allow enough space to upgrade to Sid.

Download the zipped VM file from the download link.  Extract it into whatever directory you want.  I chose "c:virtual machines".

Log into VMWare Server using Firefox (or whatever browser).  There's a link in the Start Menu, or you can just go to https://[yourcomputername]:8333/ui/# (replace [yourcomputername] with your computer name).  The first time I tried logging in with Firefox, it wouldn't accept the self-signed certificate, so you have to create an exception.  Just follow the link at the bottom of the access restriction page to add the exception.  Once at the login screen, enter your Windows login name and password.

If you haven't already downloaded the Debian installation .ISO, you can get it from http://www.debian.org/CD/  -- I used the 'Stable' image.  Move the .ISO into the same directory as the virtual machine files you unzipped.

In the VMWare Server admin page, under the "Summary" tab, there's an "Add Datastore" link on the right-hand side.  Use this to specify the directory where you put the VM files (use the "Local Datastore" section).  Then select the "Virtual Machine" tab and click the "Add Virtual Machine to Inventory" link.  Select your virtual machine (the .VMX file) from the Datastore that you added earlier.  Once it's added, select the VM from the "Inventory" list on the left-hand side of the screen.

In the "Hardware" section, select the dropdown for CD/DVD Drive 2 and choose "Edit".  Use the following settings:

This is optional, but to install an easy link to your VM from the desktop, select "Generate Virtual Machine Shortcut" from the "Commands" section on the right-hand side, then click the link just above the "Enter" button on the dialogue that follows.  Click OK to allow Firefox to add the shortcut to your Desktop.

Power-on the VM (you can just press the play button at the top of the management console).  The VM will try to boot from the virtual hard drive, but since it's blank it won't find any boot instructions.  It will then check the virtual CD/DVD drive for bootable media, where it will find the Debian installation .ISO and boot from it.  Press "Enter" to start the installation.

Most of the installation options will vary according to your preference, but here were my choices:

I think the installation took me about 1 hour.  Now you have a functioning Debian Stable (Etch) virtual machine.  I'm not a huge fan of Debian Stable (well, I am a fan, but I prefer using Unstable for more up-to-date software).

To upgrade to Unstable (Sid), you'll need to change the APT repositories to use Sid instead of Etch.  From a terminal, login as root and open the sources.list file:

su

gedit /etc/apt/sources.list

Here is the sources.list file I used.  Save the file and close gedit.  Now to update the system from Stable to Unstable, you'll need to update the package lists and then do a dist-upgrade.  I'd do a regular upgrade afterwards, but I don't know if it's necessary.  I think you'll then have to do another dist-upgrade to catch a few packages that didn't get upgraded on the first pass.  Here are the commands (from that same root terminal):

apt-get update

apt-get dist-upgrade

apt-get upgrade

apt-get dist-upgrade

During the upgrade process it will ask you a few questions.  The default responses should work fine.  Once it's done upgrading, reboot the computer (this is important).  Now you have a functioning Debian Unstable virtual machine.  The only thing missing is VMWare Tools (just to make everything run more smoothly).  You'll need to install two packages before you can install VMWare Tools: "build-essential" and the kernel headers.  The "build-essential" package contains tools for compiling programs (like gcc - the GNU C# Compiler).  Without "build-essential", you will get the following error:

Setup is unable to find the "gcc" program on your machine.  Please make sure it is installed.  Do you want to specify the location of this program by hand?

The kernel headers are used for compiling the VMWare Tools modules.  Without the headers, you will get the following message:

What is the location of the directory of C header files that match your running kernel? [/usr/src/linux/include]

The path "/usr/src/linux/include" is not an existing directory.

Here are the commands:

apt-get install build-essential

apt-get install linux-headers-`uname -r`

Note that those are back-ticks surrounding the phrase "uname -r" -- they are not single quotes.  `uname -r` specifies your current kernel version.  When I installed VMWare Tools, my system wanted to use gcc-4.3 as the C# Compiler -- unfortunately, the VMWare Tools installation script wanted to use gcc-4.1  This is the error it gave me:

Your kernel was built with "gcc" version "4.1.3", while you are trying to use "/usr/bin/gcc" version "4.3.3". This configuration is not recommended and VMware Tools may crash if you'll continue. Please try to use exactly same compiler as one used for building your kernel. Do you want to go with compiler "/usr/bin/gcc" version "4.3.3" anyway?

To fix this, in a root terminal, you'll need to tell Debian to use the older version.  It should already be installed, but if not you can "apt-get install gcc-4.1".

cd /usr/bin

cp gcc gcc.backup

rm gcc

ln -s gcc-4.1 gcc

If you want to reverse this in the future, you can:

cd /usr/bin

rm gcc

cp gcc.backup gcc

Once those packages are installed and the correct C# compiler is being used, you'll need to go back to the VMWare Server management console in Firefox on the host OS.  On the right-hand side, in the "Status" section, click on the link "Install VMWare Tools...".  This will mount a virtual CD in the Debian guest VM.  In my case it mounted it at /media/cdrom1.  Back in the Debian VM, in a root terminal, type the following commands:

cd /tmp

tar zxpf /media/cdrom1/VMWareTools-2.0.0-1222956.tar.gz

cd vmware-tools-distrib/

./vmware-install.pl

Note that the specific version number may be different on your system.  This will start the VMWare Tools installation script.  The installation script will finish and then launch the configuration script.  The configuration script will compile the necessary modules.  I used the default settings throughout, except I set my display size to [12] (1024x768).  The script will tell you that it "failed" when "Mounting HGFS Shares".  This is normal behavior and it will also happen at startup.  As far as I know, the HGFS Shares (a method of sharing files between host and guest systems) only work with VMWare Workstation (not free) and perhaps other enterprise (not free) releases.  Reboot the system.  You now should have a working Debian Sid virtual machine with VMWare Tools installed.

Note - If you want to share files between the host and guest, the easiest way I know is to share a folder in Windows XP and then open it in the Debian guest from "Network" in the "Places" menu.  While doing this I did encounter an odd Windows behavior (read: bug) that prevented sharing.  When I tried to access the share from the Windows machine, I got the following error:

serversharename is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions.

Not enough server storage is available to process this command.

I found the solution at http://www.pchell.com/support/notenoughserverstorage.shtml -- in short, I had to add a DWORD registry key named "IRPStackSize" to "HKEY_LOCAL_MACHINE -> SYSTEM -> CurrentControlSet -> Services -> Lanmanserver -> Parameters " and set it to "25".

UPDATE: I tried out VirtualBox (free) from Sun and vastly prefer it.  In my experience it's considerably faster and easier to use.

Tagged as: , , 1 Comment