Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant shell provisioning is not working

Tags:

vagrant

I have been trying to use vagrant to set up an Ubuntu virtual machine on Windows for Rails development.

What I did was first create a "plain" vm and SSHed into it and then ran all the commands that I need such as sudo apt-get install x to make sure that they worked (which they did), before putting them into a shell script.

When I try run vagrant up using the shell script that I made it falls over with an extremely long error message with things such as stdin: is not a tty and other equally cryptic error messages.

My vagrant file looks like this:

Vagrant.configure("2") do |config|

  config.vm.box = "precise32"
  config.vm.provision :shell, :path => "Vagrant.sh" 
  config.vm.network :forwarded_port, host: 3003, guest: 3000,  auto_correct: true

end

My shell script is here (because it is a little long and GitHub provide syntax highlighting): https://gist.github.com/leebrooks0/5477591

and the console output is here: https://gist.github.com/leebrooks0/5477627

Any help will be greatly appreciated.


After more trying I have realised that not even the demo script from the vagrant docs (http://docs.vagrantup.com/v2/getting-started/provisioning.html) works, which is quite strange because that script definitely worked yesterday when I started this work and tried it out.

like image 369
Lee Avatar asked Apr 28 '13 17:04

Lee


1 Answers

/tmp/vagrant-shell: line 5: $'\r': command not found

line 5

echo 'Updating system packages...'

looks like possible issue with windows "carriage return / line feed" \r\n vs unix "new line" \n

consider also using chef-solo option in vagrant file, takes a bit to get used to chef, but probably worth it - http://docs.vagrantup.com/v2/provisioning/chef_solo.html

like image 197
house9 Avatar answered Sep 18 '22 15:09

house9