Fix vagrant VMHGFS file corruption bug in VMWare 6.0.2 and 6.0.3

Fix vagrant VMHGFS file corruption bug in VMWare 6.0.2 and 6.0.3

There is a problem in VMWare 6.0.2 and 6.0.3 where Sublime Text (and many other editors) partially save or corrupts files to the vmhgfs mount aka /vagrant directory on the VM. Most posts like this one on GitHub say you need to set this option in Sublime Text and the problem goes away:

{
    "atomic_save": false
}

This did not work for me on VMWare 6.0.3. Bah! Let's fix this once and for all. Thanks to Steve Goddard in on the VMWare forums I was able to fix the corruption bug by downgrading VMWare tools on my vagrant VM to 6.0.1. Below are the instructions in order on how to accomplish this annoying but necessary feat. You can also downgrade VMWare to 6.0.1 but I was tired of having to do this.

Download ISO for your Guest OS type

In my case, my guest os was Ubuntu 12.0.4 LTS from chefs vagrant cloud so the file I would need is called com.vmware.fusion.tools.linux.zip.tar

From a terminal in your parent os in some temporary directory:

$ wget https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/6.0.1/1331545/packages/com.vmware.fusion.tools.linux.zip.tar
$ tar xf com.vmware.fusion.tools.linux.zip.tar
$ unzip com.vmware.fusion.tools.linux.zip

The file we care about is the linux.iso file that gets extracted from the zip file in the payload folder.

Set the VMWare tools into manual mode by editing the VMX file

This step is very important. If you skip this step, VMWare tools will automatically upgrade. You don't want that.

You will want to change the line tools.upgrade.policy to read tools.upgrade.policy = "manual" by option+rightclicking the VM in the library list and clicking "Open Config File in Editor"

OSX TEXT EDIT USERS VERY IMPORTANT While editing the .vmx file in TextEdit, disable Smart Quotes option from TextEdit > Preferences > New Document. Smart quotes, if enabled, will not work in the .vmx file and the virtual machine will fail to boot.

See how to edit your VMX file here: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd;=displayKC&externalId;=1014782

Mount the linux.iso file

Next we want to mount the linux.iso file we extracted in the instructions above onto the cd drive. Make sure the VM is halted

Screen Shot 2014-05-08 at 3.26.29 PM.png

Install VMware tools

vagrant up
vagrant ssh
sudo mkdir /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom

At this point you should have a a tar file in /mnt/cdrom. Mine was called /mnt/cdrom/VMwareTools-9.6.0-1294478.tar.gz. Extract this file.

$ cd /tmp
$ tar zxpf /mnt/cdrom/VMwareTools-9.6.0-1294478.tar.gz
$ cd vmware-tools-distrib/
$ ./vmware-install.pl

Just accept all the defaults from the command vmware-install.pl.

Most people at this point will just need to run vagrant halt then vagrant up and you're done. In my case, the vmhgfs driver did not compile correctly. I received this error:

/tmp/modconfig-2ot93R/vmhgfs-only/inode.c: In function ‘HgfsPermission’:
/tmp/modconfig-2ot93R/vmhgfs-only/inode.c:1893:29: error: ‘struct dentry’ has no member named ‘d_count’
make[2]: *** [/tmp/modconfig-2ot93R/vmhgfs-only/inode.o] Error 1
make[1]: *** [_module_/tmp/modconfig-2ot93R/vmhgfs-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.11.0-15-generic'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory `/tmp/modconfig-2ot93R/vmhgfs-only'

If that happens to you, root into the VM from the console and follow the instructions below.

Patching the inode.c file so it compiles on newer kernels

$ cd root/
$ wget https://raw.githubusercontent.com/rasa/vmware-tools-patches/master/patches/vmhgfs/vmhgfs-d_count-kernel-3.11-tools-9.6.0.patch
$ cd /usr/lib/vmware-tools/modules/source/
$ cp vmhgfs.tar /root  # copy just in case
$ tar xvf vmhgfs.tar
$ cd vmhgfs-only/
$ patch inode.c < /root/vmhgfs-d_count-kernel-3.11-tools-9.6.0.patch
$ cd ..
$ rm vmhgfs.tar
$ tar cvf vmhgfs.tar vmhgfs-only/*
$ vmware-config-tools.pl

Accept all the defaults from the vmware-config-tools.pl command. Now you can vagrant halt and vagrant up and will never see file corruption again.

Happy Coding!

Aggcat Python client for Intuit

I have a little budgeting side project that I am making into a product. Currently, I export my bank data via CSV and then import it into my tool. Tedious, but it works. I discovered two companies that own the financial institution aggregation space, Yodlee and Intuit.

Yodlee seems to own majority of the space but the documentation and examples were difficult. I'm hopeful this will change soon. After all, they are significantly cheaper once your application goes to production and they have an accelerator for startups. Very sweet!

On the other hand we have Intuit, the 800-lb gorilla. You probably know about Quickbooks, Turbo Tax, and Mint right? Yeah that's them, and they released a full REST api service to boot. They have nice documentation for developers and seem to be established with 18000+ institutions you can get data from.

I decided to make a rest client for Intuit's customer data API. It's called python-aggcat and you can get python-aggcat from the cheese shop as well. To install it just do the song and dance:

$ pip install python-aggcat

Then, read the python-aggcat docs. Now you can get all of your financial data via a pythonic API client. Enjoy! :)

Remove RSA Host Key

When you are SSHing into virtual machines on a daily basis this message tends to get annoying:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: POSSIBLE DNS SPOOFING DETECTED!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
The RSA host key for XXX has changed,
and the key for the corresponding IP address XXX.XXX.XXX.XXX
is unknown. This could either mean that
DNS SPOOFING is happening or the IP address for the host
and its host key have changed at the same time.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
XXXX.
Please contact your system administrator.
Add correct host key in /Users/XXXX/.ssh/known_hosts to get rid of this message.
Offending key in /Users/XXXX/.ssh/known_hosts:28
RSA host key for XXXXXX has changed and you have requested strict checking.
Host key verification failed.

YUCK! You might get tired of editing the ssh known_hosts file and removing the offending line, but there is an easier way. Use ssh-keygen. If you know the host is bobby.example.com then just run

$ ssh-keygen -R bobby.example.com

And you're done!

GitHub – glenbot

Glen Zangirolami

Houston, TX