Last modified: 2014-09-17 03:41:19 UTC
This has happened to me twice today while I've been testing a bug that only happens on during initial provisioning. * Vagrant brings up a new VM using a the base image stored on my machine. * Puppet runs in that VM. * At some point Puppet decides it needs to install a package via apt. * The apt cache that is baked into the VM image is used because Puppet decided that this run isn't the run to apply the once-per-hour `apt-get update` command on. * The apt cache is old enough that the version of the package given in the cache is not available in the upstream apt repo anymore. * `apt-get install whatever` fails with "Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?" * The puppet run fails The hack fix for this is to ssh into the vm and run `sudo apt-get update` followed by running `vagrant provision`. Is there a way to keep the "schedule => hourly" parameter to Exec['update_package_index'] in Class['apt'] but still ensure that on an initial provision of a VM this is executed? If not we maybe need to switch this to an "onlyif => test `stat -c %Y /var/lib/apt/periodic/update-success-stamp` -le $(( `date +%s` - 3600 ))"
Updating the base image available on my laptop seems to fix this issue: $ vagrant box add -f --name trusty-cloud https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box Vagrant provides a command to do this update more gracefully (`vagrant box update`) but it seems to not work with the unversioned base image that we specify in our Vagrantfile.