Vagrant NFS Retryable exception

Last week I hit an odd issue with Vagrant. My environment was working fine when suddenly while resuming my box I started to get the following exception printed in the console:

INFO retryable: Retryable exception raised: #<Vagrant::Errors::LinuxNFSMountFailed: The following SSH command responded with a non-zero exit status.  
    Vagrant assumes that this means the command failed!

After checking VirtualBox I could see my virtual machine was running and I was able to open a shell connection to it, however, the NFS shares were not mounted.

That lead me to a path of trying to figure it out what could be the cause of the problem. In the end I didn't find a clear answer, the closest I got was this answer from Hashimoto: I understand that this is an intermittent issue for people. Iv'e even seen it myself. I'm still not sure what exactly causes this or how to get a solid reproduction. Or, how to fix it. Because of that, I'm going to close it since it is a rare issue. If someone can shed more light, I'd be happy to fix. Thanks.

What I did manage to do was gather a few steps that helped some people solved the Vagrant problems with NFS, they are listed below:

Before trying any of the options below make sure to export the VAGRANT_LOG=DEBUG environment variable to get more details in the console:


1 - Configure firewall

On the mac, under System Preferences > Security & Privacy - Firewall
Make sure the Automatically allow signed software to receive incomming connections is checked

A more detailed firewall rule list can be found on this github issue

2 - Install vagrant VBGuest plugin

To install the plugin:

vagrant plugin install vagrant-vbguest  

The plugin's github page

3 - Restart vboxnet0 interface

Bring the interface down and up

$ sudo ifconfig vboxnet0 down
$ sudo ifconfig vboxnet0 up

4 - Restart NFSD daemon

First remove all the entries for your vagrant box in the /etc/exports file and then restart the nfsd daemon

sudo nfsd restart  

5 - Install NFS dependencies on the client

In the case of an Ubuntu virtual machine make sure the nfs-common and nfs-kernel-server are installed

apt-get install nfs-common nfs-kernel-server  


Accessing docker containers from your mac

The most prevalent solution for running docker on the mac is using boot2docker or maybe a CoreOS vagrant VM. In either case the docker0 network is not accessible in the mac since the it is created as a host only network on Virtual Box, usually with the CIDR of

A simple way to get connectivity to the host only network created for docker is to add a route for the docker's network CIDR with the gateway of the VM's IP

  1. Find the IP of your VM, if you are using docker machine then: $: docker-machine ls
  2. Find the CIDR for you docker private network
    • $: docker-machine ssh yourVmName
    • $: ifconfig docker0 | grep "inet addr" if the netmask is that means it is a /16 network so if the gateway is its CIDR would be
  3. Create a route for docker0 network: $: sudo route -n add

To confirm that the route was added successfuly you can check the route table entries with netstat, you should see something like this:

netstat -nr  
172.17        UGSc            1        4 vboxnet  

VMware Fusion MacBook Pro 2012 3D Acceleration Bug

After a couple of hours trying to figure it out why every time I tried to log in to my Ubuntu VM using VMware Fusion on a mac the vm would crash and restart itself, I came up with a thread in the VMware Communities forum explaining the reason + possible solution for the problem.

Basically what happened was that the Ubuntu would start just as expected, but after logging in it would popup this message:
Screen Shot 2013-01-20 at 9.31.51 PM

Quoting their explanation:

…If you are running a mid-2012 MacBook Pro with the latest Apple updates, you’ll likely encounter crashes unless you disable 3D graphics: With your VM powered off, go into Virtual Machine > Settings, then choose Display, and turn off the Accelerate 3D Graphics option.
For others encountering the same problem: if you only run Windows VMs, you would also have the option of reverting to Fusion 5.0.1 to avoid this issue.

Indeed, after disabling 3D acceleration support everything came back to normal.

Creating a bootable USB drive on Mac OSX

Below are the steps needed to create a bootable USB device:

1.Download/create the ISO file you want to load in the USB

Once you have the ISO then it is time to convert to an image file:

hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso

Breaking down the command:
hdiutil description:

hdiutil uses the DiskImages framework to manipulate disk images. Common verbs include attach, detach,
verify, create, convert, compact, and burn.

The -fomat argument specifies the format of the image you want to create, by default UDZO is used.
UDZO stands for “UDIF zlib-compressed” image and UDIF is an acronym for Universal Disk Image
More info about UDIF
However, instead of UDZO we’ll use the format UDRW (UDIF read/write image)
More info on disk image formats

The argument -o defines where the image will be savedScreen Shot 2013-01-21 at 10.19.07 AM

2. Copy the image to the USB device

Before copying the image, find where the usb device is located by running:

diskutil list

diskutil description:

diskutil manipulates the structure of local disks. It provides information about, and allows the
administration of, the partitioning schemes, layouts, and formats of disks. This includes hard disks,
solid state disks, optical discs, CoreStorage volumes, and AppleRAID sets. It generally manipulates
whole volumes instead of individual files and directories.

Once you find where the device is located run:

diskutil unmountDisk /dev/diskN (N is the number of the device)

Now that the image is created and the usb device is in place it is time to copy the image to the usb:

sudo dd if=/path/to/image.img of=/dev/diskN bs=1m

The dd command will copy everything from the standard input to standard output

The if argument is to specify the input
The of the output
And the bs the block size of the data that will be copied, in this case it’s set to 1M, or 1024 bytes
Screen Shot 2013-01-21 at 11.35.02 AM

Once the dd command is finished, a popup window might show up:
Screen Shot 2013-01-21 at 11.34.51 AM

Just to make sure check if the usb was ejected:

diskutil list

Find where the device is located and if it is still there:

diskutil eject /dev/diskN

That’s all, you should have a bootable USB device by now :)

Install Ubuntu using USB drive
hdiutil man page
diskutil man page
dd man page
dd command info
Disk Images

Building GNU Scientific Library(GSL) from source

In the DPS915 workshop 2 we started working with the GNU Scientific Library(GSL) to perform some matrix operations.

GSL is an implementation of Basic Linear Algebra Subprograms(BLAS)

By default, the GSL libraries don’t come pre install on OSX, so if you want to use them you gotta install it yourself


You can download the latest stable release from here.
At this time, the latest stable one is version 1.15


Unzip the files and navigate to the folder.
The steps to install:

Check if all the dev dependencies are installed


Build the libraries.

time make -j12 > /dev/null

  • time will output how much the build process took
  • -j lets you specify how many cores to use during the build
  • > /dev/null redircts the output to make the build faster

Finally, it is time to install the libraries

sudo make install

The header files are installed in:


And some libraries in:


Test it

To check if the gsl libs are working you can try to run a sample program:

 // matMult.cpp

 extern "C" {  
 using namespace std;  
 #define WIDTH 5

 int main(int argc, char** argv) {  
 if (argc != 2)  
 cerr << "** invalid number of arguments**" << endl;  
 else {  
 int n = atof(argv[1]);  
 float* a = new float[n * n];  
 float* b = new float[n * n];  
 float* c = new float[n * n];  
 int k = 0;  
 double f = 1.0 / RAND_MAX;  
 for (int i = 0; i < n; i++)  
 for (int j = 0; j < n; j++)  
 a[k++] = rand() * f;  
 k = 0;  
 for (int i = 0; i < n; i++)  
 for (int j = 0; j < n; j++)  
 b[k++] = rand() * f;

 // compute matrix product  
 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,  
 n, n, n, 1.0, a, n, b, n, 0.0, c, n);

 // output result  
 k = 0;  
 cout << setprecision(6) << fixed;  
 for (int i = 0; i < n; i++) {  
 cout << setw(5) << i+1 << ‘:';  
 for (int j = 0; j < n; j++) {  
 cout << setw(10) << c[k++] << ‘ ‘;  
 if (j % WIDTH == WIDTH – 1)  
 cout << endl << setw(5) << i+1 << ‘:';  
 cout << endl;  
 cout << endl;  
 delete [] a;  
 delete [] b;  
 delete [] c;  

To compile:

g++ -std=c++0x -Wall matMult.cpp -o matMult -lgslcblas

-std=c++0x enables c++0x support

To run the program:

./matMult 2

The first argument is the size of the matrix you want to generate

If you see a 2 by 2 matrix then it means it worked :)

*The code sample was taken from