October 1, 2013

How To Get VMware Tools Working On An Ubuntu Linux Server

ubuntu-linuxIf you’re like me, and are familiar with setting up virtual machines (VMs) on VMware 4 & 5 ESXi servers using Microsoft Windows, then you have probably gotten used to the simplicity and user-friendliness of installing the VMware tools in the operating system. You just open the VM’s console window, log on to the desktop and click on VM -> Guest -> Install/Upgrade VMware tools, and in a few seconds an installation begins, which requires you to do little more than click a Next button a bunch of times and reboot.

Sadly, you may not have been surprised to learn that it isn’t that easy when you try to do the same thing on an Ubuntu Linux server.

Perhaps your first impulse was to click on the same menu item mentioned above, which worked so well in Windows, only to find that nothing happened. After some initial web searches, you may have discovered that actually something DID happen – it mounted a virtual CD in the VM’s CDROM drive, which contains the tools & drivers you’re looking for. However, you also may have found the instructions for how to go about installing those tools to fall short of success. So then you say to yourself “this is open source, so let’s use the open source community’s implementation of this – surely that will be easier!”

So maybe you tried to download & install open-vm-tools. This installation was relatively easy, but if you’re like me, you may have found that on a clean install of Ubuntu Server 12 LTS (x64) it didn’t quite work. The two big problems I had with it were that on start up and shut down, if I watched the text that quickly scrolled by I could make out a few lines complaining of some “FATAL” problem involving modules that were not found. (A problem which has happened to me on multiple clean installs, and for which I could never find a workable fix after a bit of web-searching.) In addition, in the vSphere Client you’re unable to get VMware to shut down or reboot the guest OS, even though it says that the tools are running in that VM but they are “3rd party.”

So rather than messing around with the “community” version anymore, I set about figuring out how to actually get the official tools to work that came with VMware. What follows is how to install the official VMware tools on your Ubuntu Server 12 LTS (x64) guest OS. This has worked for me on 3 different installs now. I am not an expert in either Linux or VMware though, so I’m not saying there isn’t possibly a better way. What I am saying is that I cobbled together these instructions from 3 or 4 different pages on the web, after a lot of trial & error and testing. It drives me nuts when you can’t just go to one page on the ‘net and get instructions from beginning to end on how to make something work on a fresh install. These instructions work for me, and hopefully this post will help make your life just a little bit easier by revealing the secret of how to do something that really should NOT be that complicated or a big secret…

Optional: I’ve always started with a freshly updated copy of Ubuntu, by first running “sudo apt-get update” and “sudo apt-get dist-upgrade”. After a reboot (it can’t hurt), do this:

Click on VM -> Guest -> Install/Upgrade Vmware tools, to load the virtual CD in the virual drive. Now type the following commands (without the “$”):

$sudo apt-get install build-essential
$sudo apt-get install linux-headers-`uname -r`
$cd /lib/modules/$(uname -r)/build/include/linux
$sudo ln -s ../generated/utsrelease.h
$sudo ln -s ../generated/autoconf.h
$sudo ln -s ../generated/uapi/linux/version.h
$cd /mnt
$sudo mkdir cdrom
$sudo mount /dev/cdrom /mnt/cdrom
$cd /mnt/cdrom
$ls -la
$sudo cp VM*.gz /tmp/
$cd /tmp
$sudo tar xvzf VM*.gz
$cd vmware-tools-distrib/
$sudo ./vmware-install.pl

(Accept all defaults, by hitting Enter key.)

FYI, if it asks you for a path to the kernel headers (it shouldn’t), type this:

/usr/src/linux-headers-$(uname -r)/include

Reboot. vSphere should now show “Running (Current)” for this VM in “VMware Tools” section of the vSphere client if it’s all working, and you shouldn’t get any more errors relating to VMware upon boot or shut down. The vSpehere client can now shut down/reboot the guest OS.

Enjoy!

Please share your thoughts