Vagrant SSH不执行任何操作,仅跳至下一行

时间:2019-02-22 14:05:00

标签: ubuntu vagrant virtual-machine vagrant-windows

我是无所事事的新手,正在尝试连接到我的虚拟机。

C:\Users\my_username\Desktop\Vagrant\Ubuntu>vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
    default: Configuring the VM...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
    default: Timeout: 120 seconds
    default: IP: 172.20.x.x
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 172.20.x.x:22
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!

Vagrant requires administrator access for pruning SMB shares and
may request access to complete removal of stale shares.
==> default: Preparing SMB shared folders...
    default: You will be asked for the username and password to use for the SMB
    default: folders shortly. Please use the proper username/password of your
    default: account.
    default:
    default: Username: my_username
    default: Password (will be hidden):

Vagrant requires administrator access to create SMB shares and
may request access to complete setup of configured shares.
==> default: Mounting SMB shared folders...
    default: C:/Users/my_username/Desktop/Vagrant/Ubuntu => /vagrant
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

C:\Users\my_username\Desktop\Vagrant\Ubuntu>vagrant ssh

C:\Users\my_username\Desktop\Vagrant\Ubuntu>vagrant ssh

上次,我没有考虑就关闭了PC,那可能就是它不起作用的原因。还有,有没有办法在不破坏虚拟机的情况下进入该虚拟机?

这里有一些错误日志,为了便于阅读,我做了简短说明。

(那些-------行是由我制作的,错误几乎相同,只是您可以在此处看到的这一行不同)

EERORS LOGS(SHORT):

 INFO subprocess: Starting process: ["C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\/powershell.EXE", "-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "$env:PSModulePath=$env:PSModulePath+';C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\utils'; &('C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\get_vm_status.ps1')", "-VmId", "'74cdf86e-daba-454f-91ab-34617cadec07'", "-ErrorAction", "Stop"]
-----------------------------------------------------------------
 INFO subprocess: Starting process: ["C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\/powershell.EXE", "-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "$env:PSModulePath=$env:PSModulePath+';C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\utils'; &('C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\get_vm_status.ps1')", "-VmId", "'74cdf86e-daba-454f-91ab-34617cadec07'", "-ErrorAction", "Stop"]
-----------------------------------------------------------------
 INFO subprocess: Starting process: ["C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\/powershell.EXE", "-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "$env:PSModulePath=$env:PSModulePath+';C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\utils'; &('C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\get_vm_status.ps1')", "-VmId", "'74cdf86e-daba-454f-91ab-34617cadec07'", "-ErrorAction", "Stop"]
-----------------------------------------------------------------
 INFO subprocess: Starting process: ["C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\/powershell.EXE", "-NoLogo", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "$env:PSModulePath=$env:PSModulePath+';C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\utils'; &('C:\\HashiCorp\\Vagrant\\embedded\\gems\\2.2.3\\gems\\vagrant-2.2.3\\plugins\\providers\\hyperv\\scripts\\get_network_config.ps1')", "-VmId", "'74cdf86e-daba-454f-91ab-34617cadec07'", "-ErrorAction", "Stop"]
 INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: ===Begin-Output===
{
    "ip":  "172.20.166.100"
}
===End-Output===
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31998
DEBUG subprocess: Exit status: 0
DEBUG provider: IP: 172.20.166.100
 INFO subprocess: Starting process: ["C:\\WINDOWS\\System32\\OpenSSH\\/ssh.EXE"]
 INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-E log_file] [-e escape_char]
           [-F configfile] [-I pkcs11] [-i identity_file]
           [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec]
           [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address]
           [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]]
           destination [command]
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 255
 INFO ssh: Invoking SSH: C:\WINDOWS\System32\OpenSSH\/ssh.EXE ["vagrant@172.20.166.100", "-p", "22", "-o", "LogLevel=FATAL", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "IdentitiesOnly=yes", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", "C:/Users/lasoodom/Desktop/Vagrant/Ubuntu/.vagrant/machines/default/hyperv/private_key"]
DEBUG safe_exec: Converting command and arguments to common UTF-8 encoding for exec.
DEBUG safe_exec: Command: `"C:\\WINDOWS\\System32\\OpenSSH\\/ssh.EXE"` Args: `["vagrant@172.20.166.100", "-p", "22", "-o", "LogLevel=FATAL", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "IdentitiesOnly=yes", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", "C:/Users/lasoodom/Desktop/Vagrant/Ubuntu/.vagrant/machines/default/hyperv/private_key"]`
DEBUG safe_exec: Converted - Command: `"C:\\WINDOWS\\System32\\OpenSSH\\/ssh.EXE"` Args: `["vagrant@172.20.166.100", "-p", "22", "-o", "LogLevel=FATAL", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "IdentitiesOnly=yes", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-i", "C:/Users/lasoodom/Desktop/Vagrant/Ubuntu/.vagrant/machines/default/hyperv/private_key"]`

1 个答案:

答案 0 :(得分:0)

我能够使其安装GIT Shell,然后通过GIT Shell运行它。

如果您有任何相同的问题,我建议您访问此网站:https://tech.osteel.me/posts/2015/01/25/how-to-use-vagrant-on-windows.html