Thursday, September 1, 2011

FreeBSD 8.2, open-vm-tools and VMware Workstation

(A note for russian-speaking dudes: поцаны, прежде чем писать мне письма мелким почерком "у меня ни работаит шарные папки" или храбро скачивать х.з. какую версию порта откуда, откройте для себя 'vmware' тэг в левой колонке. Я верю что вы можете. На русский этот потс мне переводить лень, звиняйте панове.)

A custom port of open-vm-tools-2011.08.21-471295 for FreeBSD 8.2 can be obtained by typing:

% git clone

The port contains only a minimum version of VMware guest tools. It doesn't include kernel modules, hgfs client and wrappers for vmtoolsd.


  • The 'shared folders' option needs a guest support for vmblock file system and a hgfs kernel module. If one tries to say

    # mount -t vmhgfs .host:/shared-folder /mnt/hgfs

    He may get a kernel panic in FreeBSD 8.2. So, no shared folders for Jakucha.

  • vmblock is also required by drag&drop function provided by a vmusr/ plugin for vmtoolsd. Despite my attempts to repeat the struggle in 7.2, I couldn't achieve the same results with this version of open-vm-tools. So, no drag&drop and vmblock (fuse or .ko version) is useless.

  • I don't see a point of having external vmxnet driver instead of working em(4). And vmmemctl is like a furniture in the loft.

What have we in the so called minimum version?

  • Time sync.
  • Copy/paste under X.
  • VIX support.

The difference from previous versions:

  • vmware-user was removed and completely replaced by plugins for vmtoolsd utility.
  • GTK program vmware-toolbox was removed in favor of console version vmware-toolbox-cmd.
  • Unity plugin was excluded. It is too boring to explain why.


Delete all previous installations of open-vm-tools-minumum or open-vm-tools. This is mandatory, not optional.

After gitclonning cd to the open-vm-tools-minumum directory and decide: do you need X support for your virtual machine or it is just a console server? If the second variant is true, type:

# make WITHOUT_X11=1 install clean


# make install clean

Then add to /etc/rc.conf line:


and type:

# /usr/local/etc/rc.d/vmware_vmtoolsd_vmsvc start

OK, now you have time sync and VIX.

If you've installed full variant with X support add this line to your ~/.xinitrc:

vmtoolsd -n vmusr &

(Don't miss the ampersand.)

Now if you start X (if X is already running type previous command in a xterm) you'll get copy/paste function between host and FreeBSD guest.

VIX Tests

The good news is: VIX works with FreeBSD guests and doens't require those kernel modules that were cutted.

To test VIX, we will use vmrun program (it comes with modern versions of Workstation). In Windows hosts it usually sit in C:\Program Files\VMware\VMware VIX directory.

Get a list of all running virtual machines:

>vmrun list
Total running VMs: 2
D:\vm\FreeBSD Stable\FreeBSD Stable.vmx
D:\vm\FreeBSD test\FreeBSD test.vmx

Get a list of all running processed in a virtual machine (it requires a name & a password of a particular user in the guest):

>vmrun -T ws -gu bob -gp asecretpass listProcessesInGuest \
 "D:\vm\FreeBSD test\FreeBSD test.vmx"
Process list: 50
pid=77251, owner=bob, cmd=/usr/local/bin/vmtoolsd -n vmsvc
pid=60007, owner=bob, cmd=/bin/csh

If vmrun hands for a long time there is a problem with vmtoolsd and its plugins in the guest. Check if vmtoolsd is running:

% ps -ax | grep vmtoolsd
  823  ??  S      1:02.33 /usr/local/bin/vmtoolsd -n vmsvc

And note the '-n vmsvc' option. Look into /var/log/messages file.

Something more interesting: copy a file from the host to the guest. This doesn't require any 'shared folders' or hgfs kernel modules. It works even if a network in the guest is down:

>vmrun -T ws -gu bob -gp asecretpass CopyFileFromHostToGuest \
      "D:\vm\FreeBSD test\FreeBSD test.vmx" d:\1.jpg "/tmp/1.jpg"

Cool, eh?

Cooking FreeBSD & Xorg under VMware Workstation 7.1

(The text below is for users who are new to configuring FreeBSD under VMware Workstation.)

Modern versions of Workstation automatically turn on emulation of Intel PRO/1000 network card if you choose 'FreeBSD' as an operating system while creating a new virtual machine. FreeBSD recognizes that device as em0. If it doesn't, turn off the virtual machine, close Workstation and insert ethernet0.virtualDev = "e1000" line into your .vmx file.

A long time ago mouse and video drivers were distributed only with a proprietry version of vmvare-tools. Today (it's like 4 years now) they are included with xorg and exist in FreeBSD ports collection. Install x11-drivers/xf86-video-vmware and x11-drivers/xf86-input-vmmouse ports.

The mouse configuring may be tricky. By default VMware Workstation emulates your mouse a ps/2 one with 5 buttons, disregarding if it a usual USB mouse on the host or a touchpad. You can force Workstation to exclusively grab the HID device (USB mouse) but then it will dissapear from the host. (VMware guest tools for MS Windows ship a special ps/2 driver which supports 6 & 7 mouse buttons (binded to back & forward in browsers) but I don't know any for FreeBSD.)

If you need mouse in syscons & X simultaneously, do not use moused option '-3' to emulate middle button for 2-buttons touchpad because you'll have problems with double click in X.

Xorg vmmouse driver (12.6.9) supports only 2 options (after Protocol & Device): Buttons and ZAxisMapping. Setting Buttons option to '7' won't bring you working 6 & 7 mouse buttons, though. (xev just ignores them.)

To turn on sound, type:

# kldload snd_es137x

and add to /boot/loader.conf file:


If your laptop has the screen resolution 1280x800, add to xorg.conf section Monitor the line:

Modeline "1280x800" 70.00 1280 1312 1344 1376 800 801 804 850