How to install VMware Tools (pfSense 2.2 was released )
Update 2016-05-04: If you are using pfSense 2.3 (or newer) then please do not follow this guide, or it will break your system! Use the pfSense Package Manager to install the open-vm-tools package instead!
I’m a big fan of pfSense, an Open Source firewall and router appliance, that I use in my hosted lab. Recently version 2.2 of pfSense was released with a lot of bugfixes and new features. Please review the announcement blog post to find out what’s new.
In my lab I upgraded one of the “not so important” pfSense VMs to version 2.2 and then tried to get VMware Tools installed and running again following my own guide that I wrote a while back for pfSense 2.0 and 2.1. But, well, things have changed a lot with pfSense 2.2, because it is now based on the latest FreeBSD version 10.1. Here is what I found out and what I ended up with.
First an important heads-up: FreeBSD 10.1 as a Guest OS is supported since VMware ESXi 5.5 Update 2, but not earlier! In any case you need the VMware Tools of 5.5 Update 2, earlier versions will fail to install on FreeBSD 10.1 / pfSense 2.2. If you run an earlier version of ESXi and do not want to upgrade then you can download the Tools package of 5.5 U2 from the VMware Online Depot (right-click, save as…), extract the freebsd.iso file from it using 7zip like described in this post, and connect that ISO to the VM in step 4 below.
The good news is that FreeBSD 10.1 has a built-in driver for vmxnet3 network adapters, so you do not really need to install VMware Tools just to get this driver. Nevertheless I wanted to try out if the guide that I wrote for pfSense 2.0 and 2.1 still works. Well, the process is still the same, but commands have slightly changed in FreeBSD 10.1:
Warning: Before trying the following steps please create a snapshot of your pfSense VM so that you can quickly roll back in case things go wrong – for me it went wrong :-(, and I love snapshots 🙂
To install the required packages for VMware Tools run
pkg install perl5
pkg install compat6x-`uname -m`
(“uname -m” will output either “i386” or “amd64” depending on whether you installed the 32- or 64-bit version of pfSense. Answer all pkg prompts with “yes”.)
To update shared libraries just run
(No need to edit /etc/rc anymore)
Create a symlink for the perl executable, because the VMware Tools install script expects it in /usr/bin:
ln -s /usr/local/bin/perl /usr/bin/perl
Attach the VMware Tools ISO to the VM’s CD drive by choosing “Install/Upgrade VMware Tools” in the VM/guest menu of the vSphere Client. In the VM run these commands then:
mkdir -p /mnt/cdrom
mount_cd9660 /dev/cd0 /mnt/cdrom
tar xvzf /mnt/cdrom/vmware-freebsd-tools.tar.gz
./vmware-install.pl -d –clobber-kernel-modules=vmxnet3,pvscsi,vmmemctl
(just like in the original guide, only the CD device name has changed from /dev/acd0 to /dev/cd0)
Reboot the VM.
Please note that with the FreeBSD builtin vmxnet3 driver the network interface names are vmx0, vmx1 etc. With the VMware supplied driver these names will change to vmx3f0, vmx3f1 etc., so after the reboot you need to reassign the interfaces at the console of the pfSense VM.
Okay, I did all this and ran into trouble: With the VMware supplied vmxnet3 driver I had very strange networking issues. I was able to ping the network interfaces of the pfSense VM from the outside, I was also able to ping out from inside the VM at its console, but I was not able to log in via ssh and the pfSense web interface was also not reachable.
Maybe that’s only me, and it works fine for other people … I decided to not tinker with this for too long, because there is an alternative to the official VMware Tools! So I reverted to the snapshot that I created at the beginning (you have been warned!) and installed the Open-VM-Tools package using the pfSense package manager in its web interface.
The Open-VM-Tools would suit my basic needs. Now that the vmxnet3 driver is already builtin I only wanted the ability to shutdown or reboot the pfSense VM from within the vSphere Client, but … guess what was not working after installing open-vm-tools? :
With the out-of-the-box install of open-vm-tools you are not able to shutdown or reboot a pfSense 2.2 VM using the vSphere Client … not on the first try, but interestingly the second try would work (as the error message above even suggests). Obviously there is something wrong with the VMware Tools scripts inside the VM. These scripts are launched by the VMware Tools inside the VM prior to a shutdown, boot-up, suspend or resume event, and they can be customized. I decided to just disable them and found instructions for this in the official VMware docs:
In the VM run the following commands;
vmware-toolbox-cmd script power disable
vmware-toolbox-cmd script resume disable
vmware-toolbox-cmd script suspend disable
vmware-toolbox-cmd script shutdown disable
This will create a file tools.conf in the directory /usr/pbi/open-vm-tools-amd64/local/share/vmware-tools and add the following lines to it:
I guess you can also just create and edit the file manually, but I haven’t tried that. I restarted the VMware Tools daemon with
et voilà: a shutdown or reboot from the vSphere Client worked fine – on every try!
While I was looking at the files of the open-vm-tools package I noticed a second glitch: The other boot script /usr/local/etc/rc.d/vmware-kmod.sh is supposed to load the VMware Tools kernel modules (like vmmemctl for the memory ballooning feature), but it looks for these in a directory that just doesn’t exist. To fix that I created a symbolic link to the correct location:
ln -s /usr/pbi/open-vm-tools-amd64/local/lib/vmware-tools vmware-tools
and after a restart of the boot script the modules were correctly loaded:
You can check what kernel modules are loaded with the command kldstat.
As always I hope that you find these instructions useful. If you have any questions or remarks, or if you know what’s wrong with the VMware supplied vmxnet3 driver then please let me know in the comments. Thanks!