Vagrant on Fedora 22 - Part 2

This post is about one of the most useful plugins for vagrant, vagrant-cachier.

Vagrant makes it very easy to bring up and destroy VMs. It gives independence from trying to maintain VMs in a sane state. The downside of bringing up VMs so often is the amount of data usage that happens. Thankfully we have a great vagrant plugin which solves this problem by keeping the the downloaded data on the host and serves as cache for VMs. The plugin is vagrant-cachier and you can find code and documentation at

Here is how you enable vagrant-cachier plugin in your Vagrantfile.

However, on a rhel/fedora derivative guest VM I had to make a few changes with the box before I could achieve a truly off-network Vagrant setup. Basically, my requirement was that I should be able to perform a "vagrant up" when the host machine(Laptop in my case) does not have a working Internet connection. Here are the things that I had to do to achieve that.

  • For fedora 22 as guest OS, we have a new package manager, dnf. DNF by default removes all downloaded rpms once they are installed. Also, vagrant-cachier is not updated to support dnf yet. I wrote a patch to get dnf support in vagrant-cachier which you can find at
  • vagrant-cachier kicks in after the VM is booted and it itself requires nfs-utils to be installed in the guest. Although it is intelligent enough to install nfs-utils on guest when not available, in the case where no network is available it would fail. I made a few changes in the box and updated it(Booted a VM using the box.img and made changes) to get it working. Changes:
    • Added "metadata_expire=never"  line in /etc/dnf/dnf.conf.
    • Installed nfs-utils in the base image.
    • Changed skip_if_unavailable to true for all repos in yum.repos.d.