Installing VMWare Tools on FreeBSD 9

Virtualizing a FreeBSD server is common place. Knowing how to install VMWare Tools on a FreeBSD server without X11 is going to be extremely important. This article will provide the steps.

Lets get started.

Step 1 – Install FreeBSD as VMWare Guest.

Instructions for installing FreeBSD 9 are found here: How do I install FreeBSD 9?

It shouldn’t be much of an effort to follow these steps inside a VMWare guest.

Note: You may consider taking a snapshot here to save your current state.

Step 2 – Update FreeBSD and Install ports

Instructions for updating FreeBSD and installing ports are found here:
Update FreeBSD and Install ports

Note: You may consider taking a snapshot here to save your current state.

Step 3 – Install Prerequisites

Step 3.1 – Install Perl

Installing Perl is easy. Use either of the following commands.

From ports

# cd /usr/ports/lang/perl5.12
# make install

From packages

# pgk_add -r perl

Step 3.2 – Install compat6x-amd64

The compat6x-amd64 port is also easily installed.

From ports

# cd /usr/ports/misc/compat6x/
# make install

From packages

# pkg_add -r compat6x-amd64

Step 4 – Take a VMWare Snapshot

Important! Take a snapshot here! Do not skip this step.

Step 5 – Mount the VMWare Tools ISO

I am using VMWare workstation. Some steps may be slightly different if you are using ESXi or other VMWare solution.

  1. In VMWare Workstation, choose VM | Install VMWare Tools.
  2. In FreeBSD as root, create a directory to mount the CD-Rom to.
    # mkdir /cdrom
    
  3. Mount the cd-rom.
    # mount -t cd9660 /dev/cd0 /cdrom
    

Note: You may consider taking a snapshot here to save your current state.

Step 6 – Extract the vmware-freebsd-tools.tar.gz

Now that the drive is mounted, it should be easy to get to the vwmare-tools file.

  1. Copy the vmware-freebsd-tools.tar.gz file to a local location.
    # cp /cdrom/vmware-freebsd-tools.tar.gz /root
    
  2. Extract the vmware-freebsd-tools.tar.gz file.
    # cd /root
    # tar -xzf vmware-freebsd-tools.tar.gz
    

VMWare tools should now be extracted.

Step 7 – Recompile VMWare Tools Modules

Before you install VMWare tools on FreeBSD 9, you need the modules to work with FreeBSD 9. VMWare is slow to update the vmware tools for the FreeBSD guest. So you are just going to have to update them yourself.

Note: We are now at the point where we are going to do more and install more than you want to for your nice new clean server, but that is ok, because we have a snapshot and once we get the files compiled you can revert to the clean snapshot. Alternately if you have another FreeBSD system, you can do these steps on that system.

If you install without recompiling as of May 10, 2012, you will get this result.

Starting VMware Tools services in the virtual machine:
   Switching to guest configuration:                                   done
   Guest memory manager:                                              failed
   Blocking file system:                                              failed
   Guest operating system daemon:                                      done
Unable to start services for VMware Tools

Execution aborted.

Compiling the modules first should prevent the above failures.

Step 7.1 – Get FreeBSD Source

Download the FreeBSD Source as described here.

How to download FreeBSD source using svn?

Step 7.2 – Configure the /etc/make.conf

Right now there is a move toward compiling with clang over gcc. Because of changes due to this, you need to add the following line to your /etc/make.conf to compile with gcc. I have not tried to compile with clang yet.

  1. As root open the /etc/make.conf file with you favorite editor and add the following line:
    MK_CLANG_IS_CC=no
    
  2. Save and close the /etc/make.conf file.

Your /etc/make.conf is now configured.

Note 1: You may want to compile a custom kernel while you are at this. If so, check out this article: How to build and install a custom kernel on FreeBSD? If you do this, remember that you have to copy the new kernel to your clean system too.

Step 7.3 – Compile the vmmemctl module

Recompile vmmemctl using these steps.

  1. Go to the lib/modules/source directory under where you extracted vmware-freebsd-tools.tar.gz.
    # cd /root/vmware-tools-distrib/lib/modules/source/
    
  2. Extract vmmemctl.tar
    # tar -xf vmmemctl.tar
    
  3. Change to the vmmemctl-only directory.
    # cd vmmemctl-only
    
  4. Run make.
    # make
    
  5. Run make install.
    # make install
    

You have now built and installed the vmmemctl module.

Step 7.4 – Compile the vmblock module

  1. Go to the lib/modules/source directory under where you extracted vmware-freebsd-tools.tar.gz.
    # cd /root/vmware-tools-distrib/lib/modules/source/
    
  2. Extract vmblock.tar
    # tar -xf vmblock.tar
    
  3. Change to the vmblock-only directory.
    # cd vmblock-only
    
  4. Run make.
    # make
    
  5. Run make install.
    # make install
    

You have now built and installed the vmblock module.

Step 8 – Install VMWare Tools

You are now ready to install the VMWare Tools.

Note: If you are trying to keep you server clean and pristine, then copy the /root/vmware-tools-distrib directory off the server somewhere. THen revert to the snapshot you took just before Step 4. Copy the directory back to your clean snapshot and continue.

  1. Move into the directory created by the extraction.
    # cd /root/vmware-tools-distrib/
    
  2. Run vmware-install.pl
    # ./vmware-install.pl
    
  3. Select all the defaults.

Your vmware tools installation should go smoothly.

50 Comments

  1. new casino says:

    You actually make it appear so easy with your presentation however I to find this matter
    to be actually one thing that I feel I would by
    no means understand. It kind of feels too complex and extremely huge for me.
    I'm looking forward on your subsequent submit, I'll try to get the cling of it!

  2. It's trulky very difficult in this active life to listen news on Television, so I just use world wide web for that purpose,
    and take the most recent news.

  3. AT Partnerships says:

    AT Partnerships

    Installing VMWare Tools on FreeBSD 9 | Rhyous

  4. Miklos says:

    I was just installing a FreeBSD 10 in VMware and found some patches that worked for my ESXI 5.1.0.

    I put together a simple BASH script that let's you choose between ESXi 5+ or 5.5 and then downloads patches and compiles as needed so you can run the normal install script afterwards. The script supports both old pkg tools and pkgng.

    https://www.dropbox.com/s/cso7ad37wo4necv/fbsd10_vmtools.bash

    Note: As always with VMware tools you need compat6x and perl installed before running the actual VMware installer (after my bash script).

  5. Bad news for FreeBSD 10 says:

    No GCC in the default install of FreeBSD 10 - It's CLANG only and GCC from ports cannot be used to build the modules.

    Sure you can rebuild world and have gcc in the base, but what a pain. Surely there's a better way?

  6. Jeffrey Walton says:

    I don't believe the steps work as claimed by Miklos. I'm not sure exactly where, but the VM shutdown/restarted (no clean shutdown) during somepoint while running vwmware-install.pl.

    God it would be nice if these common configurations were supported out of the box....

    • Miklos says:

      So because your setup rebooted by itself I'm wrong? Also which post are your referring to - this is an old thread 🙂

      Fact is I have over 50 FreeBSD 9.1-pX x64 VMs running in production - all on ESXi 5.1u1 Build: 1065491 - all worked with the VMware guest tools without having to modify anything. All VMs had compat6x installed.

      It's the same story every time I create a VM in my Workstation 9 - compat6x and VMware tools just works.

  7. cars says:

    It is hard to dispute the fact that car shopping is a stressful, anxiety-ridden task for many individuals.
    The sheer size of the expenditure involved and the myriad
    of choices on the market make the need for education and information quite critical.
    Fortunately, the tips below can make the process far simpler than
    you may have believed.

  8. トリーバーチ靴 says:

    Hello Dear, are you really visiting this web site on a regular basis, if so afterward you will absolutely get good
    know-how.

  9. Ceyhun says:

    Great article. I've just installed VMware tools in FreeBSD 9.1. I recorded the session. You can watch it on youtube

    https://www.youtube.com/watch?v=Ae0zYA56MrY

  10. VMware Tools on FreeBSD 9 | hosthealth.net says:

    [...] https://www.rhyous.com/2012/05/09/installing-vmware-tools-on-freebsd-9-without-xorg/ [...]

  11. Dmitriy says:

    Hi!

    FreeBSD 9.1 on ESXi 5.0 (build 623860)

    # cd vmmemctl-only
    # make
    "/usr/share/mk/bsd.own.mk", line 478: MK_CLANG_IS_CC can't be set by a user.

    What is this?
    Thanks.

    • Mark says:

      I followed these instructions today on a FreeBSD 9.1-RELEASE-p5 (amd64) VM and when I commented out the line "MK_CLANG_IS_CC=no" in /etc/make.conf it worked fine. This is on ESX 4.1.

      Thanks for the walk-through, i've bookmarked this!

  12. UKPensionsAdvisor says:

    Informative site.
    You really write the most useful posts and
    as usual Installing VMWare Tools on FreeBSD 9 | Rhyous is simply no
    exception.

    Also visit my blog: UKPensionsAdvisor

  13. David says:

    Hi!

    I'm installing Tools in a FreeBSD 9.1 x64 running on a vSphere 4.1 system, I've also tried this on a 5.0 with same result and it was the same in a 9.0 aswell.

    I have no problem to get it to work when I install in the same machine as I downloaded the SVN and source files on but if I move the tools package to a machine without it I get the usual errors for memory and vmblock.

    What do I miss here? Am I not able to install in a machine without the source installed?

    As a side note I might add that we who have huge active directory domains can't use vCenter 5.1 yet since SSO fails while enumerating accounts. For small ADs it's no problem though, keep at it.

    BR,

    /David

  14. Larry says:

    Rhyous,
    excellent instructions. you saved me on my upgrade from 9.0 to 9.1-release. I figured everything would be fine since it was a minor version upgrade but after last run of freebsd-update install my pc got caught in a core dump reboot loop with a kernel trap 12 page fault pointing to the vm blocking file system. using you vmware recompile instructions from SUM fixed everything. One note though - make wouldn't run on 9.1 with MK_CLANG_IS_CC=no in make.conf so removed the line and all modules compiled without problem.

    Thanks again for your excellent instructions.

  15. HW says:

    Hello,

    Great instructions, as usual... of all the instructions I have ever looked at, yours are the best -- always detailed and accurate.

    I'm trying to install VMware Tools on FreeBSD 9.1, but I always get a file not found/access denied message when I try to add the compat6x package remotely (pkg_add -r compat6x-amd64). I've looked in the FTP site, but can't find it... my understanding of using the -r (remote) flag is that I shouldn't have to supply a version number, so I'm not sure what is happening or why.

    You also don't specify using the xf86-input-vmmouse VMware mouse driver in any of your posts. Don't you need it for things like drag and drop, and copy and paste?

    I've seen you mention that you have auto-sizing working, but I've never been able to make that work, even using the xf86-video-vmware driver. Do you have any clues?

    And I've only been able to make drag and drop, and copy and paste work on the root account, not a regular user account. Is there any difference between installing as root instead of as "su," in terms of permissions propagating to user accounts? Is using "su" instead of "root" a possible reason why?

    Thanks in advance for any help you can offer. I'm pretty new to FreeBSD, but I've learned a lot from reading your posts.

  16. Miklos says:

    Just letting you know - 9.1 and latest vSphere and Workstation has no issues - I didn't test without compat6x but just running the pl script works without any issues.

    [root@toolbox /tmp/vmware-tools-distrib]# ./vmware-install.pl
    Creating a new VMware Tools installer database using the tar4 format.

    Installing VMware Tools.

    In which directory do you want to install the binary files?
    [/usr/local/bin]

    In which directory do you want to install the startup script?
    [/usr/local/etc/rc.d]

    In which directory do you want to install the daemon files?
    [/usr/local/sbin]

    In which directory do you want to install the library files?
    [/usr/local/lib/vmware-tools]

    The path "/usr/local/lib/vmware-tools" does not exist currently. This program
    is going to create it, including needed parent directories. Is this what you
    want? [yes]

    In which directory do you want to install the documentation files?
    [/usr/local/share/doc/vmware-tools]

    The path "/usr/local/share/doc/vmware-tools" does not exist currently. This
    program is going to create it, including needed parent directories. Is this
    what you want? [yes]

    The installation of VMware Tools 9.0.0 build-782409 for FreeBSD completed
    successfully. You can decide to remove this software from your system at any
    time by invoking the following command:
    "/usr/local/bin/vmware-uninstall-tools.pl".

    Before running VMware Tools for the first time, you need to configure it by
    invoking the following command: "/usr/local/bin/vmware-config-tools.pl". Do you
    want this program to invoke the command for you now? [yes]

    Initializing...

    Making sure services for VMware Tools are stopped.

    Stopping VMware Tools services in the virtual machine:
    Guest operating system daemon: done

    The vmblock enables dragging or copying files between host and guest in a
    Fusion or Workstation virtual environment. Do you wish to enable this feature?
    [no]

    No X install found.

    Starting VMware Tools services in the virtual machine:
    Switching to guest configuration: done
    Guest memory manager: done
    Guest operating system daemon: done
    For the VMware Tools for FreeBSD 9.1 it is recommended that you install the
    following packages:

    xf86-video-vmware
    xf86-input-vmmouse

    The easiest way to install these packages is by using pkg_add utility. Refer
    to the man pages on how to properly use this utility.

    The configuration of VMware Tools 9.0.0 build-782409 for FreeBSD 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 "/usr/local/bin/vmware-toolbox-cmd"
    from the command line.

    Please remember to configure your network by adding:
    ifconfig_vxn0="dhcp"
    to the /etc/rc.conf file and start the network with:
    /etc/netstart
    to use the vmxnet interface using DHCP.

    Enjoy,

    --the VMware team

  17. Eric says:

    Thanks, made installing VMWare Tools in VMWare Fusion painless and straightforward.

  18. Sebastian says:

    Hi,

    I have install on FreeBSD 9.1 and did not add the line MK_CLANG_IS_CC=no in to make.conf, and worked just fine.
    no issue. The installation was done on vSphere 5.1

    Thanks for the great tutorial.
    Great job

  19. Alexey says:

    With version 9.0 everything was fine, but switched to version 9.1, and with the option MK_CLANG_IS_CC=no of no longer able to collect!

    Put simply tools - did not work. Then unpack the sources and put them together without this option, set it worked perfectly!

  20. Vacsatti says:

    It's great, works fine. Thanks a lot!

  21. bubblecode says:

    Excellent instructions Rhyous. You're the man, you made it worth my weekend:-)

    Followed it exactly, step by step and I have a perfect installation using VMware Workstation 8 on a Windows 7 Enterprise x64 host.

    Best regards

    BC

  22. eyal says:

    I'm pretty new to freeBSD however i did want to get familiar with the system and i did choose VMWare player since virtualBox has issues with NAT virtualization causing the system to fly during installation time with boot only disk.

    In any case i tried your tutorial , except for the source which i checked out using traditional CVSup, with the RELENG_9 tag which i presume identical to ' http://svn.freebsd.org/base/stable/9 /usr/src' path u were using, /and i mange to build everything.
    the issue is when VMWhere perl screens tries to start all it's services the exact two services ( Guest memory manager and Blocking File System) i built fail to start.
    I use 9.0 release of the free bsd (i used boot only method as i described so the system init was pretty much from scratch) so my first hunch might be source mismatch between kernel and modules ? or would that caused the build itself to fail ?
    if not does that mean i need to export my current generic kenrel defs and build a new one with the sources i have, or should i just get another source ?

    Just for the record i tried building twice with make clean before that to be on the safe side running the vmware tools configure after that to no avail.
    Any idea ?
    (the Vmware is VMware Player 4.0.4 build-744019).

  23. alex says:

    Hi all,

    I'm facing problems trying to compile the "vmblock-only" module on freebsd 9.0 amd64, it throws the following errors:

    vfsops.c:116: error: conflicting types for 'VMBlockVFSMount'
    vfsops.c:68: error: previous declaration of 'VMBlockVFSMount' was here
    vfsops.c: In function 'VMBlockVFSMount':
    vfsops.c:159: error: 'AT_FDCWD' undeclared (first use in this function)
    vfsops.c:159: error: (Each undeclared identifier is reported only once
    vfsops.c:159: error: for each function it appears in.)
    vfsops.c:190: error: too many arguments to function 'VOP_UNLOCK'
    vfsops.c:212: error: too many arguments to function 'VOP_UNLOCK'
    vfsops.c:220:5: error: "BSD_VERSION" is not defined
    vfsops.c: At top level:
    vfsops.c:257: error: conflicting types for 'VMBlockVFSUnmount'
    vfsops.c:72: error: previous declaration of 'VMBlockVFSUnmount' was here
    vfsops.c:291:55: error: macro "VOP_LOCK" passed 3 arguments, but takes just 2
    vfsops.c: In function 'VMBlockVFSUnmount':
    vfsops.c:291: error: 'VOP_LOCK' undeclared (first use in this function)
    vfsops.c:298: error: too many arguments to function 'VOP_UNLOCK'
    vfsops.c: At top level:
    vfsops.c:341: error: conflicting types for 'VMBlockVFSRoot'
    vfsops.c:69: error: previous declaration of 'VMBlockVFSRoot' was here
    vfsops.c:349:36: error: macro "vn_lock" passed 3 arguments, but takes just 2
    vfsops.c: In function 'VMBlockVFSRoot':
    vfsops.c:349: error: 'vn_lock' undeclared (first use in this function)
    vfsops.c: At top level:
    vfsops.c:377: error: conflicting types for 'VMBlockVFSStatFS'
    vfsops.c:71: error: previous declaration of 'VMBlockVFSStatFS' was here
    vfsops.c:387:64: error: macro "VFS_STATFS" passed 3 arguments, but takes just 2
    vfsops.c: In function 'VMBlockVFSStatFS':
    vfsops.c:387: error: 'VFS_STATFS' undeclared (first use in this function)
    vfsops.c: At top level:
    vfsops.c:427: error: conflicting types for 'VMBlockVFSSync'
    vfsops.c:70: error: previous declaration of 'VMBlockVFSSync' was here
    *** Error code 1

    Stop in /root/vmware-tools-distrib/lib/modules/source/vmblock-only.

    The "vmmemctl-only" module compiled fine.

    Any clue?

    Thanks for all!

  24. Muhammad Qasim says:

    Go to VM tab & Click On Install Vmware Tools & paste the following command

    pkg_add -r perl compat6x-amd64 bash && mkdir /cdrom && mount -t cd9660 /dev/cd0 /cdrom && cp /cdrom/vmware-freebsd-tools.tar.gz /root && cd /root && tar -xzf vmware-freebsd-tools.tar.gz && echo "MK_CLANG_IS_CC=no" >> /etc/make.conf && cd /root/vmware-tools-distrib/lib/modules/source/ && tar -xf vmmemctl.tar && cd vmmemctl-only && make && make install && cd /root/vmware-tools-distrib/lib/modules/source/ && tar -xf vmblock.tar && cd vmblock-only && make && make install && cd /root/vmware-tools-distrib/ && ./vmware-install.pl

    its a single command just paste it ...you dont need to go on every step

  25. Gerrit says:

    Lovely. Thanks a lot!

  26. netvope says:

    Were you using the VMware Tools ISO that comes with ESXi 5.0 or ESXi 5.0 Update 1?

    btw, I'm looking forward to your comparison between VMware Tools and open-vm-tools. In particular, whether vmxnet3 works 🙂

    • Rhyous says:

      We had two different tests...one was ESXi and one was VMWare Workstation. I know VMWare workstation was 8.x (latest). I am not sure if ESXi was version 5, I thought it was the latest 4.x version. I'll check.

  27. Mikkel says:

    Thanks for the guide but it seems a lot more work than this guide: https://www.dan.me.uk/blog/2012/01/31/how-to-install-vmware-tools-in-freebsd-9/

    Just altering the startup script and removing one file - I've run this on all my FreeBSD 9.0 VMs and VMware is reporting tools installed OK.

    • Rhyous says:

      Mikkel, It seems like a lot more work because it is a lot more work. If you are fine with just removing a feature when it doesn't work, then Dan's guide is for you. However, that method is hiding the problems not solving them. That is a valid option and a quality guide for those who choose that option.

      I chose a different approach, to make the features work.

      There are still a few bugs with my way but once finished, I can provide the compiled files then the solution will be to simply copy and replace a few files. I guess I could provide the few buggy files, and the source of course, even though I changed nothing, because one of them is GPL after all and so providing the source is mandatory when providing a binary.

  28. Frank says:

    Good article. However, I was wondering why you do not suggest to use the OpenSource Version of the VMware Tools, available in the Ports: emulators/open-vm-tools-nox11. I'm using this version on all of my servers and it works very well.

    • Rhyous says:

      I actually plan to write a post about Open VM Tools, and do a comparison against the shipped VM tools, it is just on a long list of "stuff to do when I get time".

    • Cornelia says:

      Aww, so sorry about your weekend plans getting the boot by pain. Th3ta#&9;s horrible. Hope you feel better soon! I'm a list person, and I always have way to much to do on my list, so hopefully, you can still get a couple of things crossed off to make you feel better 🙂

  29. Thijs says:

    Thx for this great guide! I still have a problem though. I got it working on the "messy" system. But now I copied the /vmware-tools-distrib/ folder and all it's contents to a usb thumbdrive, reverted back to the clean "step 4" snapshot, copied the /vmware-tools-distrib/ folder back and ran the install script again. Once again the error: "KLD vmmemctl.ko: depends on kernel - not available or version mismatch" and "freebsd kernel: linker_load_file: Unsupported file type" reappear.

    Anyone got an idea how to fix this?

    • Rhyous says:

      Sounds like a kernel mismatch error. Did you svn download the correct source for you kernel? release, releng, stable, etc...

      You may try compiling the kernel and installing it so you have the same kernel as the source code you downloaded.

      • Thijs says:

        Finally had some time to spend on this little project again. Started of from scratch more or less with a clean freebsd 9 release install (nothing fancy with custom kernels etc...) and went through the full guide. I made absolutely sure I downloaded the release source this time.

        Got it running on the "dirty" system again and copied the whole vmware-tools-distrib directory to a usb flashdrive. Went back to the step 4 snapshot, copied the vmware-tools-distrib directory back and ran the install script. Same error once again.

        I really have no idea what I'm doing wrong here...

        • David says:

          I'm experiencing exactly the same errors.

          I did not however return to step 4, instead I made a clone of my VM at step 4 and went on to install source etc and compiled on that VM. Then I copied the files to my clean machine and ran the installation and voila, KLD vmmemctl.ko error.

          Anyone who has succeded or have a working solution that doesn't demand a "dirty" installation?

          • Rhyous says:

            I have a feeling I missed documenting something for you guys...

            Yeah, the clone is better than just a snap-shot, because you can have both running at once!

          • Rhyous says:

            This error is caused by the source being not perfectly aligned with the kernel. I am pretty sure that I used the source on the CD and not from SVN the first time, and maybe that is why I didn't get this error. I haven't verified that.

            But my build system is so far along, I didn't want to revert. I just built a new kernel on my build system, the same place I built the VMWare-tools, and I copied over the new kernel.

            On build system
            1. build kernel.
            2. Tar kernel: tar -czf /usr/kernel.tgz /boot/kernel

            On clean system
            1. copy kernel.tgz to system.
            2. rename kernel folder: mv /boot/kernel /boot/kernel.old
            3. extract new kernel: tar -xzf kernel.tgz
            4. copy the kernel into place: cp kernel /boot/kernel

            VMware-tools installs just fine once the new kernel is in place.

        • Judith says:

          This piece was cogent, we-tlwrilten, and pithy.

    • Jake says:

      I had a similar problem. Here is what I did. Once you have the "modified" vmware-tools-distrib folder on the 'clean' machine go back and:

      cd vmware-tools-distrib/lib/modules/source/vmblock-only; make install
      cd ../vmmemctl-only; make install

      Then try vmware-install.pl - worked for me on FreeBSD 9.1 with Workstation 8.0.5 build-893925

Leave a Reply to Gerrit

How to post code in comments?