Understanding and Installing VMware Tools
A key area where VMware Server differs from many other virtualization solutions is the ability to install a special suite of tools (known as VMware Tools) onto the guest operating system. VMware Tools are available for Windows, Linux, FreeBSD and Netware guest operating systems and are designed to both improve the functionality of the guest within the virtual machine environment, and to enhance interaction between the guest and the host. VMware Tools, for example, allow the guest operating system to be cleanly powered off or reset from the host system, files to be copied between host and guest and guest programs to be remotely launched and killed from the host.
An Overview of VMware Tools
The VMware Tools package comprises four categories of utilities, each of which serves one or more specific purposes:
VMware Device Drivers
VMware Server presents the physical host hardware to the guest operating system as virtual devices. For example, whilst the host computer may have an Intel Gigabit Ethernet Adapter installed, the virtual network adapters presented to a 32-bit guest operating system appear as AMD PCnet‐PCI II devices. In order to ensure optimal performance of the guest in relation to these virtual devices, VMware Tools includes device drivers for each device category. These device drivers are so important, in fact, that without VMware Tools installed, the guest operating system may be unable to establish a network connection (currently the case with Windows Server 2008) because it lacks a built-in driver for the AMD network adapter, or drive the VMware Remote Console at anything above a rudimentary screen resolution. Installation of VMware Tools avoids these and other driver compatibility problems.
VMware Tools Service
The VMware Tools Service is a process which runs in the background of the guest operating system performing a multitude of different functions. This process is named VMwareService.exe on Windows and vmware-guestd on Linux and UNIX based operating systems.
One of the most important, yet least visible, functions of the VMware Tools Service is to send regular heartbeat messages to VMware Server so that it can detect (via the lack of heartbeats) when a particular virtual machine, or its respective guest operating system, has failed.
Another responsibility of VMware Tools Service involves the handling of communication between the guest and host operating systems. It is not too unrealistic to make the statement that none of today's popular operating systems have been written specifically to run within a VMware Server virtual machine. As such, none of these guest operating systems are designed to accept and respond to any form of communication from the VMware Server environment. Whilst this isn't generally problem, an issue arises when we consider that the VI Web Access management interface provides the ability to power off, restart and suspend guest operating systems at the press of a tool bar button or menu option, avoiding the need to open a VMware Remote Console session, log into the guest operating system and perform an orderly shutdown or reboot. Since there is no mechanism built into most operating systems that would allow VMware Server to request a clean shutdown or restart, this functionality is instead provided by the VMware Tools Service. When a user, for example, restarts a virtual machine from the VI Web Access management interface, VMware Server notifies the VMware Tools Service running on the guest operating system, which in turn executes the commands necessary to perform a clean and orderly shutdown or restart. In addition, VMware Tools Service also provides a mechanism for administrators to configure custom scripts to be executed within the guest operating system when the power state of the underlying virtual machine changes. This particular topic is covered in greater detail in the Working with VMware Tools Scripts and Power States chapter of this book.
In another example of communication between host and guest operating systems, VMware Tools Service is also responsible for ensuring that the system time of the host and guest operating systems are synchronized.
Some cosmetic and Windows specific features of VMware Tools Services include the automatic grabbing and releasing of the mouse pointer when it moves in and out of the VMware Remote Console window, and the matching of guest and host screen resolutions. On Linux and Solaris systems, these functions are performed by the VMware User Process.
VMware User Process
As with the VMware Tools Service, the VMware User Process (VMwareUser.exe on Windows and vmware-user on Linux, FreeBSD and Solaris) runs as a background process and is essentially invisible to the user of the guest operating system. On guest operating systems such as Linux which typically use the X11 session manager, the VMware User Process is started automatically when a user's X Window session is started. On X Window based systems which do not use a session manager, the VMware User Process may be manually invoked by running the following command:
or by adding the command to the user's .xinitrc X initialization file.
On Linux, FreeBSD, UNIX and Windows based guests, the VMware User Process provides the ability to cut and paste text between the VMware Remote Console and the host operating system desktop environment.
The VMware User Process also provides the mouse pointer and screen resolution functionality provided by the VMware Tools Service on Windows.
VMware Tools Control Panel
The VMware Tools Control panel, which will be covered in more detail later in the chapter entitled The VMware Tools Control Panel, provides a user friendly central location within the guest operating system for changing settings relating to VMware Tools, and performing tasks such as shrinking the size of virtual disks attached to the guest's virtual machine.
Installing VMware Tools on a Windows Guest
Amongst the files installed during the VMware Server installation process is a collection of CD-ROM ISO image files, one for each supported guest operating system type. When the VMware Tools installation process is initiated, VMware Server mounts the appropriate ISO image in place of the selected virtual machine's CD/DVD drive from which, depending the guest operating system, the installation will either autorun, or may be manually invoked. In order for this mechanism to work, the virtual machine must have at least one CD/DVD device configured. If a DVD or CD is currently in the physical drive of the host, eject it before proceeding with the VMware Tools installation.
VMware Tools are installed into a guest operating system by logging into the VI Web Access interface, selecting the virtual machine hosting the target guest operating system and clicking on the Install VMware Tools link located in the Status panel of the Summary workspace as illustrated in the following figure. VMware Tools can only be installed into a running virtual machine, so if the machine is currently powered off, the installation link will not be displayed.
If VMware Tools is already installed, a newer version is available, and the option to have the tools updated automatically was not selected during installation, the link displayed will read Upgrade VMware Tools, otherwise the status will be listed as VMware Tools Running.
Clicking on the link to Install VMware Tools within VI Web Access will display the following confirmation dialog. If the tools are to be updated automatically when new versions become available, leave the check box selected. To manually install updates, unset this option before clicking on the Install button:
If AutoPlay is configured in the Windows guest operating system the VMware installer will automatically run as soon as the VMware Tools ISO image is mounted as the virtual CD/DVD drive. If, on the other hand, AutoPlay has been disabled, navigate to My Computer or, in the case of Windows Server 2008, Computer, double click on the CD/DVD drive and launch the Setup.exe executable. After a short delay the VMware Tools installation wizard's welcome screen will appear. Clicking Next provides the options to perform a Custom, Typical or Complete installation. For full control over the tools to be installed click on the Custom button and select the individual tools and software development kits (SDKs) to install. For most requirements the Typical installation is appropriate, although if there are plans to migrate the virtual machine to a product other than VMware Server at some point in the future the Complete installation is recommended.
Having selected a setup type, click Next on the current screen, followed by Install on the subsequent screen. The installation will then begin, displaying a progress bar and status information as the various components are installed:
Upon completion of the VMware Tools installation process, click on the Finish button. As the installation included the addition of new drivers to the Windows opearting system it may be necessary to reboot the virtual machine before the installation will take effect. In the majority of cases, Windows will display a dialog to this effect if a reboot is necessary. A subsequent review of the virtual machine status in VI Web Access should indicate that VMware Tools are now installed and operational.
Installing VMware Tools on a Linux Guest
VMware Tools installation on Linux uses a similar mechanism to that described in the Windows section above. Once again, an ISO CD image containing the Linux VMware Tools installation files is mounted as the CD/DVD device of the virtual machine running the target guest operating system. The installation can be performed either using a graphical RPM package management tool or from the command line, both of which will be covered in this section. In both cases, the installation is initiated by logging into the VI Web Access management interface, selecting the target virtual machine from the Inventory panel and clicking on Install VMware Tools in the Status panel of the Summary workspace.
VMware Tools on Linux involves loading special modules (vmmemctl, vmhgfs, vmxnet, vmblock, vmsync, vmci and vsock) into the operating system kernel. For supported guest operating systems (see the Officially Supported VMware Server 2.0 Guest Operating Systems chapter for a list) pre-built modules are included with the VMware Tools installations software. If the guest operating system is not officially supported and a suitable pre-built module cannot be found, the VMware Tools configuration script will attempt to custom build a compatible module, for which it will need the GNU C compiler and the appropriate kernel sources. The steps necessary to install these packages differ between Linux distributions.
On most recent Linux distributions, the CD image will auto-mount as soon it is attached to the virtual machines CD/DVD device. If the image does not automount it will need to be mounted as superuser using a command similar to the following:
mount /dev/<device> <mountpoint>
where <device> is the device by which the CD/DVD drive is accessed (for example /dev/hdb1) and <mountpoint> is a suitable directory where the image may be mounted (for example /tmp/vmware).
On most Linux desktops (such as GNOME and KDE) an icon will appear on the desktop when the CD image has been mounted. In addition some Linux desktops will also display a window containing the contents of the CD image. The following figure, for example, illustrates the GNOME Nautilus file manager displaying the contents of the VMware Tools installation ISO image:
VMware Tools can be installed either using the Red Hat Package Manager (RPM) archive or via the compressed tar archive (tar.gz) file. To install using RPM double click on the .rpm file in the file manager and use the graphical RPM installation tool as shown in the following figure:
As an alternative to using the graphical RPM installer, run the following command in a terminal window as superuser:
rpm -Uhv <path to cd image>/<filename>.rpm
where filename is the name of the RPM archive (the naming of which differs between versions) and <path to cd image> is the path to where the CD image was either manually or automatically mounted. To identify this location, run the mount command in a terminal window. For example, the following output from mount indicates that VMware Tools is mounted at /media/VMware Tools:
$ mount /dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) fusectl on /sys/fs/fuse/connections type fusectl (rw) /dev/sr0 on /media/VMware Tools type iso9660 (ro,nosuid,nodev,uhelper=hal,uid=500)
To install VMware tools from the compressed tar archive, begin by unpacking the archive into a suitable location. For example:
tar xvfz VMware-Tools-2.x.x-xxxxx.tar.gz
Once the archive has been uncompressed and extracted, change directory into vmware-tools-distrib and execute the installation script, as outlined below to complete the installation process:
cd vmware-tools-distrib/ vmware-install.pl
Once VMware Tools has been installed on the Linux system, it must be configured prior to use. This is achieved using the vmware-config-tools.pl configuration script which is installed by default in /usr/bin. If the installation was performed using the vmware-install.pl script, vmware-config-tools.pl will start automatically after the installation is completed. For RPM based installations, the configuration script will need to be invoked manually:
As previously mentioned, if the guest operating system is a VMware supported Linux distribution (refer to the chapter entitled Officially Supported VMware Server 2.0 Guest Operating Systems for more details) the configuration script will locate and load a pre-built VMware Tools kernel module. In the event that a pre-built module cannot be located, the script will prompt for the location of the GNU C compiler and the sources for building kernel modules and attempt to build and load a compatible module. Once either the VMware Tools pre-built or custom build kernel modules are loaded into the running kernel, the configuration script will ask for the screen resolution at which the X server will start the guest operating system desktop environment. Select the correct candidate from the extensive list of options and enter the corresponding item number at the prompt. Once the configuration process is complete output similar to the following will be displayed:
Checking acpi hot plug [ OK ] Starting VMware Tools services in the virtual machine: Switching to guest configuration: [ OK ] Guest filesystem driver: [ OK ] Mounting HGFS shares: [ OK ] Guest memory manager: [ OK ] Guest vmxnet fast network device: [ OK ] VM communication interface: [ OK ] VM communication interface socket family: [ OK ] Blocking file system: [ OK ] Guest operating system daemon: [ OK ] The configuration of VMware Tools 2.0.0 build-110949 for Linux for this running kernel completed successfully. You must restart your X session before any mouse or graphics changes take effect. You can now run VMware Tools by invoking the following command: "/usr/bin/vmware-toolbox" during an X server session. You will need to either manually start /usr/bin/vmware-user or log out and log back in to this desktop session to obtain the following features: guest resolution fit, drag and drop, and file and text copy/paste. vmware-user is configured to automatically start at a graphical login, but that won't take effect until the next login. To use the vmxnet driver, restart networking using the following commands: /etc/init.d/network stop rmmod pcnet32 rmmod vmxnet modprobe vmxnet /etc/init.d/network start Enjoy, --the VMware team
As indicated above, on systems with a session manager, the vmware-user process will automatically start the next time a user logs into the guest operating system desktop. For systems with no session manager, this process will need to be manually invoked by executing the following command:
With VMware Tools successfully installed and configured, the next step is to learn about how to use and get the most out of these tools, a topic which is covered in the next chapter entitled VMware Tools - The Control Panel, Scripts and Command-line.
Uninstalling VMware Tools
If, for any reason, VMware Tools are no longer required on the guest operating system they may easily be removed. On Windows systems, remove the VMware Tools using the Windows Add/Remove Programs wizard located in the Control Panel.
If the tools were installed on Linux using the RPM package, the removal process may performed by executing the following command as super user:
rpm -e VMwareTools
Alternatively, if the initial installation was performed from the compressed tar archive, VMware Tools may be uninstalled using the following script: