How to install (or update) VMware Tools in pfSense


Update 2015-01-26: If you are using pfSense 2.2 then please refer to this newer post: pfSense 2.2 was released - How to install VMware Tools (sort of). The following instructions are still valid for pfSense 2.0 and 2.1.

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 blogged before about pfSense, the Open Source FreeBSD-based router and firewall appliance that I use in my hosted virtual lab (SBHVL) to implement IPv6-capable routing and firewalling and connecting two hosts through an OpenVPN tunnel.
I use the current development branch pfSense 2.1, because it supports IPv6. After a long beta phase it has recently reached Release Candidate (RC) status, and this inspired me to update my appliances, although I didn't have any problems with the beta build that I was using before.

After updating I had the challenge to get the VMware Tools up and running again.
There are already several blog posts available on how to do this, but I found each of them to be either incomplete, missing important caveats or hard to follow. So I decided to write my own quick check list for this task and to share it of course. Here are the necessary steps to install VMware Tools for the first time on a newly installed pfSense box (They require that pfSense itself is already configured at least to such an extent that it can access the Internet):

1. Check if the pfSense VM has a CD-ROM drive configured in its virtual hardware. If not add one of type IDE.

2. Enable ssh in pfSense by following the instructions from the pfSense docs. This is not really necessary for VMware Tools, but will let you easily use cut-and-paste into a putty terminal window for the following shell commands. This will also avoid keyboard-mapping problems that you might have at the console (Note: By default ssh will only be enabled on the internal LAN interface, so it's not a big security risk).

3. Install additional packages needed by VMware Tools by running the following commands in a shell:

   pkg_add -rv perl
   pkg_add -rv compat6x-i386
   (OR: pkg_add -rv compat6x-amd64, if you have deployed the 64bit version of pfSense)

These commands will download the packages from the FreeBSD repositories, so you need to have a working Internet access at this time!

4. Fix the Shared Libraries Configuration by editing the file /etc/rc (with vi /etc/rc): Find the line starting with ldconfig and add the directory /usr/local/lib/compat at its end so that it look like this:

   /sbin/ldconfig -elf /usr/lib /usr/local/lib /lib /usr/local/lib/compat

Also run this command interactively now to make the change effective!

5. Start the VMware Tools install at the pfSense VM's console by choosing "Install/Upgrade VMware Tools" from the VM/Guest menu. This will attach the Tools ISO to the VM's CD drive.
Then run the following commands in a shell:

   mkdir -p /mnt/cdrom
   mount_cd9660 /dev/acd0 /mnt/cdrom
   cd /tmp
   tar xvzf /mnt/cdrom/vmware-freebsd-tools.tar.gz
   cd vmware-tools-distrib
   ./vmware-install.pl -d --clobber-kernel-modules=vmxnet3,pvscsi,vmmemctl

All done!

If you want to update VMware Tools at a later time then you just need to repeat step 5.

If you have updated the pfSense firmware (through the System/Firmware WebConfigurator menu) then you need to repeat step 4. Then re-configure VMware Tools in order to make them automatically start at boot time again by running the following command:

   /usr/local/bin/vmware-config-tools.pl -d --clobber-kernel-modules=vmxnet3,pvscsi,vmmemctl

These instructions apply to both pfSense 2.1 and 2.0. I hope that someone will find them useful.




46 comments:

  1. Thanks! All we need in one place.

    ReplyDelete
  2. Looks interesting, but I'm not sure about IPv6 support?

    ReplyDelete
  3. Personally I abandoned Endian
    Not that much updates
    Not support
    Almost no community

    Pfsense is the way especially for IPV6

    I have one question
    Why don't you use the vmtools package ????

    ReplyDelete
    Replies
    1. The open-vm-tools package does no longer include the vmxnet3 driver, and I was advised that the vmxnet3 adapter offers better performance over the e1000 adapter.
      - Andreas

      Delete
  4. aah
    sustained
    I'll try your way :)

    ReplyDelete
  5. I followed this method, but had to do it in console session via VMware vSphere Client as I found I didn't have the right permissions to perform step 3 from an SSH session.
    After then performing your steps above, I then set both NIC's "Speed and duplex" to "10Gbase-T". Works GREAT with my 100mbps FTTP connection :D

    Also, just a question, would this work better as a pfSense Package? I've noticed that if you do update pfSense via System -> Firmware, it automatically re-installs the previously installed packages after updating pfSense, so would fix the problem of having to manually repeat the steps required after updating. More info here on packages; http://doc.pfsense.org/index.php/Developing_Packages

    ReplyDelete
    Replies
    1. I do not understand your permissions issue. Were you not able to log on via ssh as root? Or were you logged on as root, but could not run the commands? Any error messages?

      Regarding the package: The Open Source variant of the VMware Tools (open-vmtools) is available as a package, but lacks the vmxnet3 driver (see comment above). I'm not sure if you can make the proprietary Tools available as a package, because they are closed source.

      Delete
  6. I'm running the recent 2.1rc snapshot and have install the vmtools as per your guide:

    After every reboot, ESXi reports in the "Summary" section "Not running (Not installed)" and I have to repeat the process.

    Thoughts?

    ReplyDelete
    Replies
    1. Just one thought: Can you please check if a file named /etc/vmware-tools/not_configured exists on your system even after you have gone through all the steps?! If yes then delete it and try again.

      Delete
    2. had the same problem, deleting the file worked for me, thanks

      Delete
    3. So some reason the /etc/vmware-tools/not_configured file always reappears after every reboot. Others experiencing the same? pfsense 2.1 and esxi 5.1

      Delete
    4. Anonymous, are you just deleting the file, or are you running

      /usr/local/bin/vmware-config-tools.pl -d --clobber-kernel-modules=vmxnet3,pvscsi,vmmemctl

      before rebooting?

      Delete
    5. I'm just deleting the file with rm -f as per this guide: https://doc.pfsense.org/index.php/VMware_Tools

      and I am not running the above before rebooting. The file seems to come back after every reboot.

      Delete
    6. Anonymous, instead of manually deleting the file please run the vmware-config-tools.pl script as indicated above. This will re-configure the tools and also delete the not_configured file. Then reboot and check if the file returns.

      Delete
    7. Hey Guys, sorry for dragging this back up , but thought i'd try and explain what I have found on my installation..(PfSense 2.1 , ESXi 5.5)

      when i run

      /usr/local/bin/vmware-config-tools.pl -d --clobber-kernel-modules=vmxnet3,pvscsi,vmmemctl

      my vmtools then shows up running.. and there is no /etc/vmware-tools/not_configured file.

      if i then reboot pfsense , it starts normally including vmtools, but a check shows /etc/vmware-tools/not_configured file now exists, meaning that after the NEXT reboot , I will not have a running vmtools any more. (unless i delete the /etc/vmware-tools/not_configured file beforehand.) I'll probably setup a crontab or similar to routinely look for and delete the file if it exists.

      Delete
    8. Hi GarFin,

      I also looked into this issue and noticed that the not_configured file is created by the VMware Tools boot script /usr/local/etc/rc.d/vmware-tools.sh whenever it thinks that something went wrong.
      You can just uncomment the code there, but this change will be reverted on the next update or re-installation of the Tools.

      Andreas

      Delete
  7. I Andreas,
    I am trying to install vmtools VMware Tools 8.6.10 build-913593 on pfsense 2.0.3-RELEASE

    During install /vmware-install.pl an error appears "ELF binary type "0" not known" ... Execution aborted.

    an idea

    Thanks
    Vincent

    ReplyDelete
    Replies
    1. Hi Vincent,

      have you installed the packages from step 3?

      Andreas

      Delete
  8. I want to give you a bid ol', trans-internet, bear hug. This just worked beautifully.

    Interestingly enough the NIC names are much longer on VMXNET3 (mine were vmx3f0 and vmx3f1) which caused the names to be flush with their MAC addresses. Took a moment to realize where the name ended and the MAC started.

    ReplyDelete
  9. While it seems you can get the tools to run, from looking on the vm showing them running - to the ability to restart/shutdwon the vm via command.

    both the esxi client or vcenter seem to have issue - where they say a tool is running. But show it not installed with red !

    ReplyDelete
    Replies
    1. I also experienced this strange behavior after upgrading to ESXi 5.5.
      I could fix it with the following steps:
      1. Choose "Install VMware Tools" from the VM's console menu
      2. Wait a few seconds, then choose "End VMware Tools install".
      3. Wait a few seconds, refresh the VM view, and the status might eventuell change to "Installed".

      Delete
    2. Andreas, thanks for this workaround, worked very nice for me under 5.5 and freebsd 9.2.

      Also had status installed, with ip displayed in the summary view of the VM, but announced as not running.

      Restart install vmware tools wait few second and stop solved the problem, now it's running and installed ;-)

      Delete
  10. Just wanted to drop a line to say thanks.

    ReplyDelete
    Replies
    1. You're welcome. I'm glad that you found my post useful.

      Delete
  11. Great Post! On ESXi 5.5 with pfsense 2.1 this works perfectly for me. Thanks, Vincent

    ReplyDelete
  12. Andreas Peetz,

    Thanks for this great article. I was able to install 2 VMs using this method. However on my 3rd VM, following all same instructions, i run stubbornly to this error in the last command:

    $ ./vmware-install.pl -d --clobber-kernel-modules=vmxnet3,pvscsi,vmmemctl
    ./vmware-install.pl: not found

    what might be the problem? your advice and ideas will be of great help.

    ReplyDelete
    Replies
    1. Hi Darkangel64,

      have you followed all the steps before? Did the tools tgz file properly unpack? Is Perl installed? Is is the 32bit-version or the 64bit-version?

      Andreas

      Delete
  13. Great post and thank you!

    ReplyDelete
  14. Thanks for your article !

    David.

    ReplyDelete
  15. Just a gotcha:

    Should you get an error similar to the following when adding the packages:

    looking up ftp.freebsd.org
    connecting to ftp.freebsd.org:21
    Error: Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.3-release/Latest/perl.tbz: File unavailable (e.g., file not found, no access)
    pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8.3-release/Latest/perl.tbz' by URL
    pkg_add: 1 package addition(s) failed

    This is due to the fact the release lcoation is coded to look for 8.3 release (which is no longer available)

    I have successfully used the 8.4 versions following the above steps but you need to set the PACKAGESITE environment variable using the following command in order to point the pkg_add command at the correct location:

    setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-8.4-release/Latest/


    Enjoy!

    ReplyDelete
  16. Thanks for the post, something funny however. Tools install fine, restarting the VM all seems well. However when I power off and power it back on keeps saying "Not Running (Current)" Any ideas?

    ReplyDelete
  17. What should I comment out of the /usr/local/etc/rc.d/vmware-tools.sh file so I don't lose vmtools on reboot?

    ReplyDelete
    Replies
    1. The section looks like this:

      if [ "$exitcode" -gt 0 ]; then
      # Set the 'not configured' flag
      touch "$vmware_etc_dir"'/not_configured'
      chmod 644 "$vmware_etc_dir"'/not_configured'
      db_add_file "$vmware_db" "$vmware_etc_dir"'/not_configured' \
      "$vmware_etc_dir"'/not_configured'
      exit 1
      fi

      Comment out the whole section by putting a # in front of every line.

      Andreas

      Delete
  18. Thanks that worked!

    ReplyDelete
  19. Hi,
    I could not find ldconfig

    ReplyDelete
    Replies
    1. Try /sbin/ldconfig instead. Make sure that your are logged in as root.

      Delete
  20. This article was a big help for me und er 2.1.5. It would be great if you could update it for 2.2.

    ReplyDelete
    Replies
    1. I'm looking into this... Actually I got it already working, but ran into strange networking issues after that. I need to test different install and upgrade scenarios.

      Anyway, pfSense 2.2 is based on FreeBSD 10.1, and that already includes a vmxnet3 driver, so maybe you do not really need the "official" VMware Tools.

      Delete
    2. I have a problem with VMware Tools, because the VMware supplied vmxnet3 adapter doesn't really work well, but the open-vm-tools package works ... sort of. You need to fix / work around two glitches - see this pfSense forums' post.

      Andreas

      Delete
  21. In my case the vmxnet3 driver that comes with pfSense/FreeBSD doesn't work at all. I can assign interfaces and IP adresses, but I cannot ping the host or access the configurator. Pinging google from the pfSense shell works however. I tried 32 and 64 bit versions.

    I assume the OS supplied vmxnet3 driver is working for you?

    ReplyDelete
    Replies
    1. I assume you are referring to pfSense 2.2 (FreeBSD 10.1) now? You should have commented on the new post then ...

      But well that's funny. For me the builtin vmxnet3 driver works well.

      Delete
    2. sorry, yes I was referring to the previous post

      I'll keep trying :)

      Delete
    3. It seems the Windows VM I used to access pfSense was broken. I got is working now and the included vmxnet3 driver is working nicely.

      Delete

***** All comments will be moderated! *****
- Please post only comments or questions that are related to this post's contents!
- Advertising and link spamming will not be tolerated!