Vagrant SSH 什么都不做,它只是跳到下一行

Vagrant SSH does nothing, it just jumps on a next line

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

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

上次,我不假思索地关闭了电脑,这可能就是它不起作用的原因。不过,有没有办法进入这个 VM 而不必破坏它?

以下是一些错误日志,为了便于阅读,我已将其缩短。

(那些------线是我做的,错误几乎是一样的,不同的是你在那里看到的这一行)

EERORS 日志(短):

 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"]`

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

如果你们有同样的问题,我会推荐访问这个网站:https://tech.osteel.me/posts/2015/01/25/how-to-use-vagrant-on-windows.html