James Little

Archive for the ‘vmware’ tag

How to Mount VMDK files in Linux

View Comments

There’s various tools for Windows that allow you to mount VMware images, which offers a convenient way to transfer files to/from the Virtual Machine. The solution in linux seems to be a little less well-known, but it is effectve nonetheless, and I find it preferable to using SSH/FTP/NFS etc. to transfer files.

First you’ll need to download a copy of VMware server, which is free. You may be using VMware player to run your virtual machines, but unfortunately it doesn’t include the tool needed to mount VMware images. It’s not a major problem though; just unpack the VMware server archive you just downloaded and copy the files “vmware-mount.pl” and “vmware-loop” from its “bin” directory to your /usr/bin directory (or whatever directory you have VMware Player installed). There’s no need to install VMware Server if you already have Player. If you have neither installed then obviously you will need to install one of them. Now navigate to that installation directory and follow my lead:

jim@jim-desktop:/usr/bin$ ./vmware-mount.pl

This script requires 3 (not 0) mandatory argument(s).

Usage: ./vmware-mount.pl
-p : Print the partition table
disk : Name of the Virtual Hard Disk file
or
disk : Name of the Virtual Hard Disk file
partition : Number of the partition
[-t type] : Partition type
[-o options]: Partition mount options(s)
mount-point : Directory where to mount the partition

Here we see the usage instructions for the vmware-mount script. I’ll run with the ‘-p’ option so I can see the partition structure of my image:

root@jim-desktop:/usr/bin# ./vmware-mount.pl -p /home/jim/'My Virtual Machines'/windows.vmdk'

--------------------------------------------
VMware for Linux - Virtual Hard Disk Mounter
Version: 1.0 build-44356
Copyright 1998 VMware, Inc. All rights reserved. -- VMware Confidential
--------------------------------------------

Nr Start Size Type Id Sytem
-- ---------- ---------- ---- -- ------------------------
1 63 2097088 BIOS 6 FAT16

That tells me that the partition number I’ll need is 1, and it’s the only partition available. So to mount the image I run the following:

root@jim-desktop:/usr/bin# mkdir /media/vmware-image
root@jim-desktop:/usr/bin# ./vmware-mount.pl /home/jim/'My Virtual Machines'/windows.vmdk 1 /media/vmware-image

The script warns you about untested support for kernels > 2.4 and has a whinge about network block devices, but type ‘Y’ on both counts to continue and the image will mount to your specified location (in this case, /media/vmware-image). You can now open another terminal window and explore the image. In Ubuntu w/ Gnome I’m able navigate via Nautilus, and it even creates a nice image on the desktop for me. You may find additional switches such as “-o ro” to make the image read-only will come in handy.

Written by James

August 29th, 2007 at 9:31 pm

Posted in Linux

Tagged with ,

Installing VMWare on Ubuntu Gutsy

View Comments

Unfortunaltely the latest kernel included in Gutsy (2.6.22-10) isn’t supported by VMware yet, so you’ll run into a few problems when attempting to install VMware Server. If you’re running 64bit Gutsy and you haven’t already installed the ia32 libraries then you’ll probably see this message to start with:
The correct version of one or more libraries needed to run VMware Server may be missing. This is the output of ldd /usr/bin/vmware:
linux-gate.so.1 => (0xffffe000)
libm.so.6 => /lib32/libm.so.6 (0xf7f93000)
libdl.so.2 => /lib32/libdl.so.2 (0xf7f8f000)
libpthread.so.0 => /lib32/libpthread.so.0 (0xf7f76000)
libX11.so.6 => not found
libXtst.so.6 => not found
libXext.so.6 => not found
libXt.so.6 => not found
libICE.so.6 => not found
libSM.so.6 => not found
libXrender.so.1 => not found
libz.so.1 => /usr/lib32/libz.so.1 (0xf7f60000)
libc.so.6 => /lib32/libc.so.6 (0xf7e16000)
/lib/ld-linux.so.2 (0xf7fc6000)

This program cannot tell for sure, but you may need to upgrade libc5 to glibc
before you can run VMware Server.

which is easily remedied by running:
sudo apt-get install ia32-libs

The next error message occurs when the vmware-config script attempts to build the vmmon modules:

None of the pre-built vmmon modules for VMware Server is suitable for your
running kernel. Do you want this program to try to build the vmmon module for
your system (you need to have a C compiler installed on your system)? [yes]

Using compiler "/usr/bin/gcc". Use environment variable CC to override.

What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.22-10-generic/build/include]

Extracting the sources of the vmmon module.

Building the vmmon module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config1/vmmon-only'
make -C /lib/modules/2.6.22-10-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.22-10-generic'
CC [M] /tmp/vmware-config1/vmmon-only/linux/driver.o
In file included from /tmp/vmware-config1/vmmon-only/linux/driver.c:80:
/tmp/vmware-config1/vmmon-only/./include/compat_kernel.h:21: error: expected declaration specifiers or ‘...’ before ‘compat_exit’
/tmp/vmware-config1/vmmon-only/./include/compat_kernel.h:21: error: expected declaration specifiers or ‘...’ before ‘exit_code’
/tmp/vmware-config1/vmmon-only/./include/compat_kernel.h:21: warning: type defaults to ‘int’ in declaration of ‘_syscall1’
make[2]: *** [/tmp/vmware-config1/vmmon-only/linux/driver.o] Error 1
make[1]: *** [_module_/tmp/vmware-config1/vmmon-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-10-generic'
make: *** [vmmon.ko] Error 2
make: Leaving directory `/tmp/vmware-config1/vmmon-only'
Unable to build the vmmon module.

For more information on how to troubleshoot module-related problems, please
visit our Web site at "http://www.vmware.com/download/modules/modules.html" and
"http://www.vmware.com/support/reference/linux/prebuilt_modules_linux.html".

Execution aborted.

To get around this we need to apply a patch called vmware-any-any (see here for more info). I used version 113 as it seems to be the latest; it can be downloaded here. Extract the contents of the archive, navigate to their location and simply run:
./runme.pl
to install the patch. You’ll see the following:
Updating /usr/bin/vmware-config.pl ... now patched
Updating /usr/bin/vmware ... No patch needed/available
Updating /usr/bin/vmnet-bridge ... No patch needed/available
Updating /usr/lib/vmware/bin/vmware-vmx ... No patch needed/available
Updating /usr/lib/vmware/bin-debug/vmware-vmx ... No patch needed/available
VMware modules in "/usr/lib/vmware/modules/source" has been updated.

Before running VMware for the first time after update, you need to configure it
for your running kernel by invoking the following command:
"/usr/bin/vmware-config.pl". Do you want this script to invoke the command for
you now? [yes]

Hit enter to invoke vmware-config.pl and the rest of the installation should now run smoothly. Note that you will need a C++ compiler to build the vmmon modules. Enter the following to install such development tools:
sudo apt-get install build-essential
sudo apt-get install linux-headers-'uname -r'

The final message you should see is:
The configuration of VMware Server 1.0.3 build-44356 for Linux for this running kernel completed successfully.

and you should now have a fully-functional version of VMWare Server; launch it by typing ‘vmware’ at the command line, or from the menu entry.

Written by James

August 25th, 2007 at 7:56 pm

Posted in Linux

Tagged with , ,