Re: Problem while launching provisioning script on a Windows guest box

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Problem while launching provisioning script on a Windows guest box

wenlock
Hey, 

I saw this issue today with vagrant 1.1.5.   Trying out a simple echo provision script with shell and get the output:
[default] Running provisioner: VagrantPlugins::Shell::Provisioner...
bash: sudo: command not found
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell


Also trying windows guest with cygwin.

Found that in https://github.com/mitchellh/vagrant/blob/master/plugins/communicators/ssh/communicator.rb#L259

line 259, there is this code:

# Determine the shell to execute. If we are using `sudo` then we
        # need to wrap the shell in a `sudo` call.
        shell = @machine.config.ssh.shell
        shell = "sudo -H #{shell}" if sudo

Is there a @machine.config.sudo  ???  Does @machine.config come from the plugin/guest ??

Would be nice if this was platform independent, is it an issue?


On Tuesday, December 4, 2012 5:15:43 PM UTC-8, RP wrote:
bumping this post.any pointers anyone? paul did you manage to find a fix for this?

On Wednesday, 9 November 2011 16:30:38 UTC, paulgreg wrote:
I’m trying to launch a provisioning shell script on a Windows 7 guest
box (host system is an Ubuntu 10.04).
On that Windows 7 box, I’ve installed cygwin, ruby, vagrant and ssh
which all seems to work.
I had to create a fake sudo command (like :
http://superuser.com/questions/122418/theres-no-sudo-command-in-cygwin).

The box is able to boot but fails to launch the provisioning shell
script :
------------------------------------------------------------------------------------------------
➜  win7 git:(master) vagrant up
[default] Importing base box 'win7'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] Running provisioner: Vagrant::Provisioners::Shell...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell
/tmp/vagrant-shell

The output of the command prior to failing is outputted below:

[no output]
------------------------------------------------------------------------------------------------

If I’m logging by SSH, the tmp folder contains the script but without
execution rights :

------------------------------------------------------------------------------------------------
➜  win7 git:(master) vagrant ssh
Last login: Mon Nov  7 14:02:15 2011 from 10.0.2.2

vagrant@vagrant-win-7 ~
$ ls -la /tmp/
total 8
drwxrwxrwt+ 1 vagrant root    0 Nov  7 13:52 .
drwxr-xr-x+ 1 vagrant root    0 Nov  7 13:52 ..
-rw-r--r--  1 vagrant None 2210 Nov  7 13:52 vagrant-shell
------------------------------------------------------------------------------------------------

However, I can do it "by hand" and then, execute the shell :

------------------------------------------------------------------------------------------------
vagrant@vagrant-win-7 ~
$ chmod +x /tmp/vagrant-shell

vagrant@vagrant-win-7 ~
$ ls -la /tmp/
total 8
drwxrwxrwt+ 1 vagrant root    0 Nov  7 13:52 .
drwxr-xr-x+ 1 vagrant root    0 Nov  7 13:52 ..
-rwxr-xr-x  1 vagrant None 2210 Nov  7 13:52 vagrant-shell

vagrant@vagrant-win-7 ~
$ /tmp/vagrant-shell
[script begins to execute]
------------------------------------------------------------------------------------------------

Any idea why Vagrant cannot set rights by a chmod and launch the
script ?

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Problem while launching provisioning script on a Windows guest box

wenlock
Hey, 

I attempted a fix at this, probably not the best way to do it, but seems to work for me.

https://github.com/wenlock/vagrant/commit/eac9c5f753484218f21e23e8ab6a0131d04e34f3#commitcomment-2941825

I'm sure there is a better way to deal with this using plugin/guest... just not sure how yet.

Edward

On Wednesday, April 3, 2013 8:17:08 PM UTC-7, mocchi wrote:
Hey, 

I saw this issue today with vagrant 1.1.5.   Trying out a simple echo provision script with shell and get the output:
[default] Running provisioner: VagrantPlugins::Shell::Provisioner...
bash: sudo: command not found
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell && /tmp/vagrant-shell


Also trying windows guest with cygwin.


line 259, there is this code:

# Determine the shell to execute. If we are using `sudo` then we
        # need to wrap the shell in a `sudo` call.
        shell = @machine.config.ssh.shell
        shell = "sudo -H #{shell}" if sudo

Is there a @machine.config.sudo  ???  Does @machine.config come from the plugin/guest ??

Would be nice if this was platform independent, is it an issue?


On Tuesday, December 4, 2012 5:15:43 PM UTC-8, RP wrote:
bumping this post.any pointers anyone? paul did you manage to find a fix for this?

On Wednesday, 9 November 2011 16:30:38 UTC, paulgreg wrote:
I’m trying to launch a provisioning shell script on a Windows 7 guest
box (host system is an Ubuntu 10.04).
On that Windows 7 box, I’ve installed cygwin, ruby, vagrant and ssh
which all seems to work.
I had to create a fake sudo command (like :
http://superuser.com/questions/122418/theres-no-sudo-command-in-cygwin).

The box is able to boot but fails to launch the provisioning shell
script :
------------------------------------------------------------------------------------------------
➜  win7 git:(master) vagrant up
[default] Importing base box 'win7'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] Mounting shared folders...
[default] -- v-root: /vagrant
[default] Running provisioner: Vagrant::Provisioners::Shell...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

chmod +x /tmp/vagrant-shell
/tmp/vagrant-shell

The output of the command prior to failing is outputted below:

[no output]
------------------------------------------------------------------------------------------------

If I’m logging by SSH, the tmp folder contains the script but without
execution rights :

------------------------------------------------------------------------------------------------
➜  win7 git:(master) vagrant ssh
Last login: Mon Nov  7 14:02:15 2011 from 10.0.2.2

vagrant@vagrant-win-7 ~
$ ls -la /tmp/
total 8
drwxrwxrwt+ 1 vagrant root    0 Nov  7 13:52 .
drwxr-xr-x+ 1 vagrant root    0 Nov  7 13:52 ..
-rw-r--r--  1 vagrant None 2210 Nov  7 13:52 vagrant-shell
------------------------------------------------------------------------------------------------

However, I can do it "by hand" and then, execute the shell :

------------------------------------------------------------------------------------------------
vagrant@vagrant-win-7 ~
$ chmod +x /tmp/vagrant-shell

vagrant@vagrant-win-7 ~
$ ls -la /tmp/
total 8
drwxrwxrwt+ 1 vagrant root    0 Nov  7 13:52 .
drwxr-xr-x+ 1 vagrant root    0 Nov  7 13:52 ..
-rwxr-xr-x  1 vagrant None 2210 Nov  7 13:52 vagrant-shell

vagrant@vagrant-win-7 ~
$ /tmp/vagrant-shell
[script begins to execute]
------------------------------------------------------------------------------------------------

Any idea why Vagrant cannot set rights by a chmod and launch the
script ?

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.