Fixing error “apt-get… return 100 expected 0” (Chef/Vagrant)

When running Chef for the first time on a VM, you may see an error like the following:

apt-get -q -y install couchdb=0.10.0-1ubuntu2 returned 100, expected 0

The problem is that your Vagrantfile script does not require Chef to do an “apt-get update” before running it’s scripts. This normally triggers updating the apt database, and something is referenced in the Chef script that is missing from the VM.

To fix this, download the cookbook called “apt” and run it prior to running the cookbooks you actually want.