ppggff / vagrant-qemu

Use Vagrant to manage machines using QEMU. Test with Apple Silicon / M1 and CentOS aarch64 image
MIT License
408 stars 32 forks source link

bash hardcoded? making tmp directory on windows fails #38

Open jayunit100 opened 1 year ago

jayunit100 commented 1 year ago

Update 3

So , I guess ultimately: Vagrant provisioning doesnt work via communicator.rb when talking to a windows box. I think you have to use winRM, but i not sure. To that end, i think we can close this issue.

I'll leave it open for a little bit though just in case others want to search or comment.

update 2

I guess .//communicators/ssh/communicator.rb is the doing the wrong thing, somehow, and behaving like its in a bash environment, it is being misconfigured, maybe when the QEMU plugin calls it , its not telling it that its running in a windows environment? I found that if i hacked this file to use powershell, then it gets further.

So, is there a thing inside of vagrant-qemu that , when provisioning, tells the vagrant ssh library how it should be calling underlying functions such as this one?

update 1

Looks like its bash hardcoded, possibly, somewhere in the provisioning process ?

INFO ssh: Execute: mkdir -p "/tmp" (sudo=false)
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: stderr: bash : The term 'bash' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 

Details

In https://github.com/kubernetes-sigs/sig-windows-dev-tools/issues/240 , we are now able to make 2 VMs, one linux, one windows. The linux one provisions fine. However the windows one never starts provisioning b/c of failure to make a tmp directory...

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
failed_win_up
cni: calico
qemu loopcalico: 3.25.0; containerd: 1.6.15
==> winw1: Running provisioner: shell...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p "/tmp"

Detailed logs

first

 INFO ssh: Execute: mkdir -p "/tmp" (sudo=false)
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: Sending SSH keep-alive...
DEBUG ssh: stderr: bash : The term 'bash' is not recognized as the name of a cmdlet, function, script file, or operable program. Check 

DEBUG ssh: stderr: the spelling of the name, or if a path was included, verify that the path is correct and try again.

DEBUG ssh: stderr: At line:1 char:1
+ bash -l
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (bash:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

DEBUG ssh: Exit status: 1
ERROR warden: Error occurred: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p "/tmp"

Stdout from the command:

Stderr from the command:

then


ERROR vagrant: #<Vagrant::Errors::VagrantError: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p "/tmp"

Stdout from the command:

Stderr from the command:

>
ERROR vagrant: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p "/tmp"

Stdout from the command:

Stderr from the command:

ERROR vagrant: /opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:268:in `execute'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:769:in `create_remote_directory'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:328:in `block (2 levels) in upload'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:338:in `block in upload'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:748:in `block in scp_connect'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:523:in `connect'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:746:in `scp_connect'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/communicators/ssh/communicator.rb:307:in `upload'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/provisioners/shell/provisioner.rb:114:in `block (2 levels) in provision_ssh'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/provisioners/shell/provisioner.rb:106:in `tap'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/provisioners/shell/provisioner.rb:106:in `block in provision_ssh'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/provisioners/shell/provisioner.rb:357:in `with_script_file'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/provisioners/shell/provisioner.rb:104:in `provision_ssh'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/provisioners/shell/provisioner.rb:36:in `provision'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/provision.rb:138:in `run_provisioner'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/environment.rb:543:in `hook'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/provision.rb:126:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/provision.rb:126:in `block in call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/provision.rb:103:in `each'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/provision.rb:103:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:127:in `block in finalize_action'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/call.rb:53:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/warden.rb:48:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/builder.rb:180:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `block in run'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/action/runner.rb:101:in `run'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:248:in `action_raw'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:217:in `block in action'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/environment.rb:631:in `lock'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:203:in `call'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/machine.rb:203:in `action'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/commands/provision/command.rb:30:in `block in execute'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/plugin/v2/command.rb:243:in `block in with_target_vms'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/plugin/v2/command.rb:232:in `each'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/plugin/v2/command.rb:232:in `with_target_vms'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/plugins/commands/provision/command.rb:29:in `execute'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/cli.rb:67:in `execute'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/lib/vagrant/environment.rb:301:in `cli'
/opt/vagrant/embedded/gems/2.3.4/gems/vagrant-2.3.4/bin/vagrant:248:in `<main>'
 INFO interface: error: The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p "/tmp"

Stdout from the command:

Stderr from the command:

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mkdir -p "/tmp"

Stdout from the command:

Stderr from the command:

 INFO interface: Machine: error-exit ["Vagrant::Errors::VagrantError", "The following SSH command responded with a non-zero exit status.\nVagrant assumes that this means the command failed!\n\nmkdir -p \"/tmp\"\n\nStdout from the command:\n\n\n\nStderr from the command:\n\n"]

We do not have any /tmp directory creation steps in our Vagrantfiles, so, i assume theres something either in the vagrant QEMU plugin, or vagrant itself, which harcodes an attempt to make this directory.