Shell provisioning file with "source" not working on windows

465 views
Skip to first unread message

Micky Hulse

unread,
Aug 9, 2019, 1:02:11 PM8/9/19
to vagra...@googlegroups.com
Hello,

I had a coworker run my Vagrant CentOS setup on his windows box.

He ended up getting this:

==> default: Configuring and enabling network interfaces...
==> default: Running provisioner: shell...
default: Running: inline script
default: NETWORK IP: 172.28.128.3
==> default: Running provisioner: shell...
default: Running:
C:/Users/ddd/.babun/cygwin/tmp/vagrant-shell20190809-12720-1ots9lj.sh
default: /tmp/vagrant-shell: line 13:
/vagrant/bootstrap/functions.sh: No such file or directory
default: /tmp/vagrant-shell: line 14:
/vagrant/bootstrap/profile.sh: No such file or directory
default: /tmp/vagrant-shell: line 15:
/vagrant/bootstrap/firewall.sh: No such file or directory
default: /tmp/vagrant-shell: line 16: /vagrant/bootstrap/nano.sh:
No such file or directory
default: /tmp/vagrant-shell: line 17: /vagrant/bootstrap/git.sh:
No such file or directory
default: /tmp/vagrant-shell: line 18: /vagrant/bootstrap/mysql.sh:
No such file or directory
default: /tmp/vagrant-shell: line 19: /vagrant/bootstrap/http.sh:
No such file or directory
default: /tmp/vagrant-shell: line 21: /vagrant/bootstrap/node.sh:
No such file or directory
default: /tmp/vagrant-shell: line 22: /vagrant/bootstrap/php.sh:
No such file or directory
default: /tmp/vagrant-shell: line 23:
/vagrant/bootstrap/phpmyadmin.sh: No such file or directory
default: /tmp/vagrant-shell: line 24:
/vagrant/bootstrap/composer.sh: No such file or directory
default: /tmp/vagrant-shell: line 26: /vagrant/bootstrap/ruby.sh:
No such file or directory
default: /tmp/vagrant-shell: line 27:
/vagrant/bootstrap/mailcatcher.sh: No such file or directory
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Here's my vagrant setup (provisioning scripts at bottom, in this case
it's the bootstrap one):

https://github.com/mhulse/vagrant-latmp/blob/master/Vagrantfile

And here is the bootstrap entry point for the other "source" shell files:

https://github.com/mhulse/vagrant-latmp/blob/master/vagrant/bootstrap/init.sh

On my mac, this works without a hitch. On his windows box, using babun
and powershell, I get the above errors.

Any tips on how to homogenize the sourcing of my provisioning scripts
to make this mac/windows-agnostic?

Thanks so much!

Salty Vagrant

unread,
Aug 9, 2019, 1:21:48 PM8/9/19
to vagra...@googlegroups.com

It looks like you disable the default sync folder on Windows. This would mean the /vagrant files will not be available while they will be on non-Windows environments.

I find it generally best to copy all provisioning scripts explicitly onto the guest machine, then run them locally. This avoids this sort of mismatched environment.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/CAKzdcNmuNDfQ6h%2BJb1tFCf4S53eTD5bKJZK90jUEHbXTe96T2Q%40mail.gmail.com.

Micky Hulse

unread,
Aug 9, 2019, 2:08:24 PM8/9/19
to vagra...@googlegroups.com
Arrrrgh, you're right, I am disabling as I thought the sync/shared
folders would not work on Windows. I figured having a conditional to
disable shared folders would be a good workaround to having my
Vagrantfile/bootstrap work on Windows/Mac (not having a Windows box to
test with). I completely overlooked the fact that the /vagrant is one
of the shared dirs that the scripts get copied to when provisioning.

Is there anyway to make the default /vagrant shared folder work on
Windows? Or, like you say, is it best to just copy the scripts over
and manually run them locally?

Thanks so much for your help! I really appreciate it!
> To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/F84AA477-60C6-43B9-9E33-B0EBA33771C9%40gmail.com.

Salty Vagrant

unread,
Aug 10, 2019, 4:32:42 AM8/10/19
to vagra...@googlegroups.com

You don’t need to run them manually. I do something like this (assuming all bootstrap scripts are in ./bootstrap directory):

config.vm.provision "file", source: “./bootstrap", destination: "/tmp/bootstrap"
config.vm.provision "shell", inline: "/tmp/bootstrap/bootstrap-script.sh”

Micky Hulse

unread,
Aug 12, 2019, 11:51:29 AM8/12/19
to vagra...@googlegroups.com
On Sat, Aug 10, 2019 at 1:32 AM Salty Vagrant <saltyv...@gmail.com> wrote:
> You don’t need to run them manually. I do something like this (assuming all bootstrap scripts are in ./bootstrap directory):
> config.vm.provision "file", source: “./bootstrap", destination: "/tmp/bootstrap"
> config.vm.provision "shell", inline: "/tmp/bootstrap/bootstrap-script.sh”

Oooh, very nice! Thank you for the tip! I will definitely add this
technique to my setup. :)

Many thanks for your help, it's greatly appreciated!
Reply all
Reply to author
Forward
0 new messages