Vagrant: custom virtual environment

vagrant_compPreconfigured virtual machines always come in handy and save the pain and time of manually setting them up from scratch. Vagrant is a community based service that works like a repository of preconfigured virtual machines of diverse configuration. Need an Ubuntu 14.04 server with LAMP or a Red Hat server with chef configuration? Vagrant has those! Vagrant supports both VMware and VirtualBox VMs.

Whether you are a developer or a system administrator, Vagrant is always at your beck and call to create an isolated development environment or a dedicated server.

Here’s how easy it is to use Vagrant. It is multiplatform and supports Linux, Windows and Mac. Download Vagrant from its website (link below) and install it on you machine. You need to have either VMware or VirtualBox installed on your box to install VMs from Vagrant.

Initialize and start a 32-bit Precise VM:

$ vagrant init hashicorp/precise32
$ vagrant up

In case you are wondering how to get the container for precise32, you can search VMs and use the container that matches your needs. There are a number of criteria to filter the results. Find more community provided boxes (standard templates) here.

Vagrant is very flexible and has many options. Vagrant docs is the best place to get started.

Webpage: Vagrant

VMware Player 6.0.2, Ubuntu 14.04, kernel 3.15.0-rc7 patch

vmware_compVMware Player throws errors while compiling the vmci and vsock modules with just-released kernel 3.15.0 rc7 on Ubuntu 14.04 (Trust Tahr) x86_64. Instead of Ubuntu kernel-ppa mainline this time I have compiled the kernel from Linus’s Git tree and using it.

The errors in vmci module are:

/tmp/modconfig-5Nq5Lx/vmci-only/linux/driver.c:740:12: error: incompatible types when assigning to type ‘VMCIHostUser’ from type ‘kuid_t’
user = current_uid();
make[2]: *** [/tmp/modconfig-5Nq5Lx/vmci-only/linux/driver.o] Error 1

In addition to similar errors as above, other errors in vsock module are:

/tmp/modconfig-KpbL9l/vsock-only/linux/notify.c:519:4: error: too many arguments to function ‘sk->sk_data_ready’
sk->sk_data_ready(sk, 0);

The above are happening due to introduction of a structure kuid_t and change in signature of sk_data_ready(). I have uploaded the patches for both the modules here.

Once you download the patches, run the following as root:

# cd /usr/lib/vmware/modules/source
# mv /path/to/kernel_3.15.0-rc7-patch.tar.gz .
# tar -zxvf kernel_3.15.0-rc7-patch.tar.gz
# tar -xf vmci.tar
# tar -xf vsock.tar
# mv vmci.patch vmci-only/
# mv vsock.patch vsock-only/
# cd vmci-only/
# patch -p1 < vmci.patch
# cd ../vsock-only/
# patch -p1 < vsock.patch
# cd ..
# tar -cf vmci.tar vmci-only/
# tar -cf vsock.tar vsock-only/
# vmware-modconfig --console --install-all

All the modules should compile without any issues now.

VMware-Player 6.0.1, Ubuntu 13.10, kernel 3.13.5 patch

vmware_compI didn’t upgrade my kernel for a while since 3.12. After upgrading the Linux kernel to version 3.13.5-031305-generic (published today in the Ubuntu mainline kernel PPA) on Ubuntu Saucy, vmplayer 6.0.1 build-1379776 (x86_64) threw the following error while compiling the vmnet module:

# vmware-modconfig --console --install-all
/tmp/modconfig-OEBtR5/vmnet-only/filter.c:206:1: error: conflicting types for ‘VNetFilterHookFn’
 VNetFilterHookFn(unsigned int hooknum,                 // IN:
/tmp/modconfig-OEBtR5/vmnet-only/filter.c:64:18: note: previous declaration of ‘VNetFilterHookFn’ was here
 static nf_hookfn VNetFilterHookFn;

NetFilter is enabled and compiled in with the generic mainline kernel. I wanted to keep the change localized to the vmnet driver code and used the same signature from filter.c that  VNetFilterHookFn uses. I have uploaded the patch here.

To apply the patch and recompile the modules run the following as root:

# cd /usr/lib/vmware/modules/source
# tar -xf vmnet.tar
# cd vmnet-only
# patch < filter.patch
# cd ..
# tar -cf vmnet.tar vmnet-only/
# vmware-modconfig --console --install-all

After applying the patch vmplayer compiled without any further issues and the network works fine on my VMs.

Mount VMware disk images (vmdk) on Linux

vmware_compThere is a trivial way to mount vmware disk images (*.vmdk files) from the GUI using VM settings. However, to do that remotely from the cmdline, VMware provides a specific tool vmware-mount which can be used as a regular user. Usage:

  1. Create the directory to mount the virtual disk:
    $ mkdir vmmnt
  2. Mount the virtual disk:
    $ vmware-mount myVM/myVM.vmdk vmmnt/
  3. Now any changes you make under vmmnt directory will be saved when you unmount:
    $ vmware-mount -k myVM/myVM.vmd

To mount vdi files on Ubuntu, download the right virtualbox-fuse package for your release and architecture from Launchpad. Then run:

$ sudo dpkg -i --force-depends virtualbox-fuse_$version_$arch.deb
//Mount vdi and volume
$ mkdir ~/vdisk
$ mkdir ~/vol1
$ sudo vdfuse -f Machine.vdi ~/vdisk
$ sudo mount ~/vdisk/Partition1 ~/vol1

Install VMware tools manually on Ubuntu

vmware_compIf your VM is not network connected or the network speed is slow you might need to install vmware-tools manually on your guest OS. VMware-tools can be downloaded for different VMware versions, host and guest OS from the following location:

Navigate to the correct directory corresponding to your vmplayer version and host OS. For example, the path to vmware-tools package for vmplayer 5.0.2 and Linux is:

The package file name should have the name of your guest OS. For example, if your guest VM is Windows XP and youst host OS architecture is 64-bit, you should download the following file:

To install, extract the downloaded package and install on Ubuntu using the following command:

# vmware-installer --install-component=xxx.component

Boot from USB on VMware

The default BIOS on VMware doesn’t support booting from USB in VMs (at least not yet). However, it is possible to do that using the Plop boot manager easily. Download the latest version and extract the files (I tried version 5.0.15-test). We need the plpbt.iso file to boot the VM.

Create a new VM and use the plpbt.iso to boot it.


USB Controller should be present with following settings –


On boot, use the USB option in bootloader menu. In case of any issues, check that the USB pen drive is connected in the VM settings.


Plop works with VirtualBox. It is useful for booting older machines with no USB boot capability as well.

VMware Player 5.0.2, Ubuntu 13.04, kernel 3.8.0 patch

vmware_compAfter upgrading my kernel to 3.8.0-6-generic on Ubuntu Raring today vmplayer 5.0.1-894247.x86_64 was not able to find the C header files matching the latest kernel on first run. It was throwing the following error:

C header files matching your running kernel were not found. Refer
to your distribution's documentation for installation instructions.

Evidently the installation process is unable to find the correct version.h file. I used:

ln -s /usr/src/linux-headers-3.8.0-6-generic/include/generated/uapi/linux/version.h \

It continued for a while but eventually failed to compile all the modules. Then I found the required patch to complete the compilation in vmware community forums. To apply the patch:

cd /usr/lib/vmware/modules/source
tar -xf vmci.tar
cd vmci-only
patch -p1 < 'patchfile'
cd ..
tar -cf vmci.tar vmci-only/

then re-run vmware installer.
In case VMware is asking for your preferences on every run, you probably need to create the preferences file manually:

mkdir .vmware
touch .vmware/preferences
chmod  777 .vmware
chmod 666 .vmware/preferences

If you face any issues while compiling the kernel modules you can also try compiling them from the terminal using:

vmware-modconfig --console --install-all


  1. I tried installing the latest VMware Player 5.0.2 on the same setup. It uninstalled the previous version and installed itself without any issues. The procedure works fine on Ubuntu mainline kernel 3.9.0 and 3.9.7 as well.
  2. VMware Player 6.0.0 has been released on Sep 3, 2013. I have installed it on kernel 3.11.0 and 3.12.0 from Ubuntu mainline kernel PPA without any issues.

Disable VMware services at boot on Ubuntu

vmware_compIf you are not a frequent user of VMs then you might consider disabling the VMware services autostart. I use VMware Player once in a while and so wanted to stop them from starting at boot.

To do that, run:

$ sudo update-rc.d vmware disable
$ sudo update-rc.d vmware-USBArbitrator disable

Crude method: Move the following two files to some other location, e.g. /usr/bin:


To start manually:

$ sudo /path_to_new_location/vmware start
$ sudo /path_to_new_location/vmware-USBArbitrator start

VMware Player 4.0.4 & kernel 3.6.0 on Precise patch

vmware_compThe following procedure was written for Quantal but it works for Precise as well.

I am using Ubuntu 12.04 right now but wanted to try kernel 3.6.0 which is available for Quantal here. I downloaded the 4 packages I need for x86_64 and installed them using dpkg -i as usual, rebooted and was up and running with 3.6.0. Removed the old kernel from the system.

Shortly I found that my VMware Player is compiling every time I run it and the Block Filesystem compilation shows the warning symbol. Issuing vmplayer I found that the following error is  thrown on the console when the Block Filesystem is being compiled –

/tmp/vmware-root/modules/vmblock-only/linux/filesystem.c: In function ‘FsOpReadSuper’:
/tmp/vmware-root/modules/vmblock-only/linux/filesystem.c:528:4: error: implicit declaration of function ‘d_alloc_root’ [-Werror=implicit-function-declaration]

And as a result the vmblock.ko module is missing from /lib/modules/3.6.0-030600-generic/misc.

This is what I did to fix it:
1. Extract the Block Filesystem source code (vmblock.tar) in /usr/lib/vmware/modules/source as root
# tar -xvf vmblock.tar
2. Edit the file filesystem.c as indicated in the error – find and replace d_alloc_root with d_make_root (this link turned up in google search)
3. Create the archive again.
# mv vmblock.tar vmblock.tar.orig
# tar -cvf vmblock.tar vmblock-only

Done! Run VMPlayer once and let it compile. No re-compilation next time.