Category Archives: VMware ESX

VMware ESX/ESXi Hints

How to install vmware tools in FreeBSD 9

To install vmware tools in FreeBSD 9, follow these instructions…

First, ensure that you have perl and compat6x ports/packages installed.

You can use pkg_add -r perl5 compat6x (or pkg_add -r perl compat6x-amd64 if the previous command does not work – substitute amd64 for i386 if installing i386 edition!) for pre-compiled, or use the ports tree.

Next, in vSphere client go to guest -> install vmware tools.  This will mount the tools CDROM in the virtual machine.

Next, we need to mount the cd drive, extract the data, unmount the cd drive and install the tools – do the following as root:

mkdir -p /cdrom
mount -t cd9660 /dev/cd0 /cdrom
cd /tmp
gunzip -c /cdrom/vmware-freebsd-tools.tar.gz | tar xf –
umount /cdrom
cd vmware-tools-distrib/
./vmware-install.pl

At this point, accept all the defaults (press enter to all questions) until you are returned to a shell prompt.  Ignore the ‘failed’ service start, and the fact that it says the process has been aborted.

Next, you need to use your favourite editor to edit the file /usr/local/etc/rc.d/vmware-tools.sh and locate the following 3 lines of code (they are separated by a few lines of code but are all in the same general area):

if [ “$vmdb_answer_VMHGFS_CONFED” = ‘yes’ ]; then
if [ “$vmdb_answer_VMMEMCTL_CONFED” = ‘yes’ ]; then
if [ “$?” -eq 0 -a “$vmdb_answer_VMXNET_CONFED” = ‘yes’ ]; then

There will also be (not grouped together like the above line) the following line in the file:

if [ “$vmdb_answer_VMBLOCK_CONFED” = ‘yes’ ]; then

Change each of the above lines where it says yes to be xyes (add the letter X before the word yes) – then save&exit the file.

Now we need to tell vmtools that it is configured by typing the following:

rm /etc/vmware-tools/not_configured

Now you can restart vmtools without rebooting like so:

/usr/local/etc/rc.d/vmware-tools.sh restart

Now, you will need to Edit Settings in vSphere client and set your cdrom drive back to the client device.

Each time your virtual machine boots up, it will boot the vmtools and work as expected.

FreeBSD vmware tools in FreeBSD 8.x

You can install vmware tools under ESX – but I like to edit part of it.

NOTE: if you’re running FreeBSD 9, you need to follow the guide here instead.

To install, connect with your VM Infrastucture Client, edit the CD Drive, select ‘Datastore ISO file’, and Browse.  Open up the ‘vmimages’ folder and select ‘freebsd.iso’.  Make sure to check the ‘Connected’ checkbox before clicking OK.

In freebsd, as root, do the following:

mount /cdrom
cd /tmp
gunzip -c /cdrom/vmware<tab> | tar xvf –
umount /cdrom
cd vmware<tab>
./vmware-install<tab>

This will start the vmware installer… follow the instructions and select all the defaults.  Once it is complete, you can remove the folder in /tmp/

NOTE: vmtools requires perl to be installed and also “compat6x” port/package if you are using FreeBSD 7 – do this beforehand!

now… edit /usr/local/etc/rc.d/vmware-tools.sh and search for “–background”.  This should be around line 626.  At the end of that line, add:

–halt-command “/sbin/shutdown -p now”

then restart the vmware tools with:

/usr/local/etc/rc.d/vmware-tools.sh restart

This will ensure that, when you use ‘shutdown guest’, the freebsd virtual machine will power off.  Without this update, it will shutdown but not power off.

FreeBSD with ESX

If you run FreeBSD under ESX (unsupported, but works) and you use a type of storage that is susceptable to slowdowns (in my case a SAN with a failed hard drive forced to do RAID5 reconstruction), you may find your FreeBSD virtual machines panic and crash.

This is caused by the SCSI disk timeout being reached on the root device.  You can spot these by looking in your log for SCSI timeout messages.

To get around this, we can increase the number of retries before it fails (hopefully giving the storage device time to catch up).  This is done with the following command:

sysctl kern.cam.da.retry_count=120

You can set this to happen each boot, by editing the file /etc/sysctl.conf and adding:

kern.cam.da.retry_count=120