Oscar Godson
Oscar Godson

Reputation: 32716

vagrant up provisioning before files sync

I'm playing with vagrant for the first time and want to add it to our fairly large project. If I run the bootstrapping shell file I wrote though vagrant ssh after the files sync everything works great. However, after destroying the VM and doing a vagrant up for the first time causes a bunch of errors to occur on my Ubuntu 12.04 64bit machine once it hits bundle install

Bundler::GemfileNotFound


Stderr from the command:

stdin: is not a tty
dpkg-preconfigure: unable to re-open stdin: No such file or directory
dpkg-preconfigure: unable to re-open stdin: No such file or directory
dpkg-preconfigure: unable to re-open stdin: No such file or directory
dpkg-preconfigure: unable to re-open stdin: No such file or directory
dpkg-preconfigure: unable to re-open stdin: No such file or directory

I'm assuming this is because it gets to this before my Gemfile / Gemfile.lock finishes syncing. This might not be the case, but it seems like it is. How would I get around this?

Here's my full boostrap.sh script that runs on v up

#!/usr/bin/env bash

apt-get update
apt-get -y install git

# Required for nokogiri
apt-get -y install libxslt-dev libxml2-dev

# Required for eventmachine
apt-get -y install build-essential

# Required for typhoeus
apt-get -y install libcurl3-dev

apt-get -y install ruby1.9.3
gem install bundler
bundle install

Upvotes: 2

Views: 2794

Answers (1)

Matt Cooper
Matt Cooper

Reputation: 10840

I am presuming you are running that script with Vagrants shell provisioner?

Where is your gem file? Most probably it is in the same folder as your Vagrantfile on the host machine so try adding:

cd /vagrant

Before bundle install and it should work...

Upvotes: 1

Related Questions