How to Install VMWare Guest Tools on Ubuntu

How To Install VMWare Tools v4 on Ubuntu

Tested With: Ubuntu 12.04 LTS Server, Ubuntu 11.10 Server

All the guides I found on the Internet, including VMWare’s website were outdated in some way, so I decided to write a guide of my own. I just went through these steps from start to finish on a fresh server and had no problems.

1. Use Install VMWare Tools option in VMWare Client to attach media

2. Update the server

apt-get update
apt-get upgrade

3. Create the mount point

sudo mkdir -p /media/cdrom

4. Mount the ISO

sudo mount /dev/cdrom /media/cdrom

You should see the message: mount: block device /dev/sr0 is write-protected, mounting read-only

5. Change Directory

cd /media/cdrom

6. Copy the tar file to your /tmp directory

sudo cp VM*.tar.gz /tmp

7. Install Build tools if necessary

sudo apt-get install linux-headers-server build-essential

8. Change Directory

cd /tmp

9. Unmount the ISO

sudo umount /media/cdrom

10. Expand the tar

sudo tar xzvf VM*.tar.gz

11. Change Directory

cd vmware-tools-distrib

12. (Only for Ubuntu 11.x) To prevent a potential error in the install script on Ubuntu 11.10, create a special directory.
Error: Unable to create symlink “/usr/lib64/” pointing to file ”/usr/lib/vmware-tools/lib64/”.

sudo mkdir /usr/lib64

13. Run the Install Script. The -d flag automatically answers the default to all questions. To customize it, just omit the -d.

sudo ./ -d

14. Reboot

sudo reboot

Import esxi 5 vmdk into KVM qcow2

One of my co-workers had the following error while trying to import a VMWare ESXi 5 VMDK file into KVM qcow2 format.

# qemu-img convert -O qcow2 vmtest-disk1.vmdk vmtest.qcow2
qemu-img: error while reading sector 131072: Invalid argument

This error seems to have been generated because the way ESXi 5 virtual machine disk files handle Thin Provisioning. KVM chokes on the any hardware version 8 thin provisioned vmdk disk file.

So one obvious fix is to pick “Thick Provision” for any virtual disk you know will be sent to a KVM host OS. If you need to transfer disk images between hosts, a thick provisioned disk could be a nightmare especially when the image is > 100Gig. However for those times when the machine is already created, or where a Thin Provisioned disk is a must VMware provides a disk utility to convert the disk image.

Here’s how we did it:

From a windows 7 PC, we grabbed a copy of VMware’s vSphere 5.0 Virtual Disk Development Kit from

Run and install the file. This expands several tools into “c:Program Files (x86)VMwareVMware Virtual Disk Development Kit”

Use the following command to convert the vmdk into a format qcow2 can use for imports:

c:Program Files (x86)VMwareVMware Virtual Disk Development Kitbin>vmware-vdiskmanager.exe -r original.vmdk -t 0 newdisk.vmdk

The options “-t 0” specifies the disk type to be “single growable virtual disk”.

Now just wait because this can take a really long time. Once completed, rerun the qemu-img convert command.

Further tinkering found that ESXi 5 Think provisioned disk we were testing was 430Mb in size. If we converted the disks to type 2 (thick provisioned) yielding a 20 gig vmdk and then imported into qcow2 format, the new disk was 1.3 gig, not 20 gig. The qcow2 import took the thick provisioned vmdk and converted it back to a thin provisioned format. This means you *could* also use “-t 2” on the disk conversion command and get a vmdk that was preallocated to full size. However, there seems to be no need for this since the type 0 disk works and keeps the total size down to a manageable level.

In addition, KVM can use native VMDK disk files as well. The type 0 disk worked when used in KVM as a VMDK with no conversion.

How to Install VMWare Tools v4 on an Ubuntu Host

This should work with Ubuntu 12.04 LTS and 11.10 server.

Unlike window VM within the vSphere window, adding VMTools requires just a little work.   This install requires the ‘build-tools’ packages be installed if not already present.

“apt-get install linux-headers-server build-essential”

1) On the host to be updated, select the “Install/Upgrade VMware Tools” menu selection from the menu.  This will make the VMWare tools ISO available to the host.

2) Make sure you update the server.

sudo apt-get update
sudo apt-get upgrade

3) Create a mount point

sudo mkdir -p /media/cdrom

4) Mount the VMWare Tools ISO

sudo mount /dev/cdrom /media/cdrom

5) CD into the new mount

cd /media/cdrom

6) Copy the VM*.tar file to a temporary directory.

sudo cp VM*.tar.gz /temp

7) CD to the temp folder

cd /temp

8) Unmount the ISO, we are done with it.

sudo umount /media/cdrom

9) Extract the TAR file

sudo tar xzvf VM*.tar.gz

10) CD into the new vmware tools folder

cd vmware-tools-distrib

11) If you are on Ubuntu 11.10, you should create a /usr/lib64 directory to get around an error in the install script.

sudo mkdir /usr/lib64

12) Run the install script.  Note that the -d flag will ‘auto-answer’ all questions with the default.   Omit the -d if you want to answer each manually.

sudo ./ -d

13) Reboot to complete.

sudo shutdown -r now