我在Windows机器内的ubuntu框中尝试ssh时遇到问题。我遵循Vagrant网站(http://docs.vagrantup.com/v2/getting-started/up.html)
的基本入门教程软件版本:
Vagrant:1.7.2
Virtualbox:4.3.22
SO:Windows 7
Box:hashicorp / precise32
情景:
当我点击vagrant up
时,一切都按计划进行:服务和vm启动,但在最后一步,哪个流浪者测试ssh,它在几个Warning: Connection refused. Retrying...
之后失败
之后,当我打开Virtualbox GUI时,我可以登录该框并检查openssh-server
是否正在运行。当我尝试通过命令行ssh时,我收到错误:
ssh 127.0.0.1 -p 2222
ssh: connect to host 127.0.0.1 port 2222: Bad file number
当我点击vagrant ssh
(INFO级别的日志)时,我得到了这个输出:
INFO global: Vagrant version: 1.7.2
INFO global: Ruby version: 2.0.0
INFO global: RubyGems version: 2.0.14
INFO global: VAGRANT_EXECUTABLE="C:\\dev\\tools\\Vagrant\\embedded\\gems\\gems\\vagrant-1.7.2\\bin\\vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="C:\\dev\\tools\\Vagrant\\embedded"
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_INTERNAL_BUNDLERIZED="1"
INFO global: VAGRANT_LOG="INFO"
INFO global: Plugins:
INFO global: - bundler = 1.7.11
INFO global: - mime-types = 1.25.1
INFO global: - rdoc = 4.0.0
INFO global: - rest-client = 1.6.8
INFO global: - vagrant-share = 1.1.3
INFO manager: Registered plugin: box command
INFO manager: Registered plugin: destroy command
INFO manager: Registered plugin: global-status command
INFO manager: Registered plugin: halt command
INFO manager: Registered plugin: help command
INFO manager: Registered plugin: init command
INFO manager: Registered plugin: list-commands command
INFO manager: Registered plugin: vagrant-login
INFO manager: Registered plugin: package command
INFO manager: Registered plugin: plugin command
INFO manager: Registered plugin: provision command
INFO manager: Registered plugin: push command
INFO manager: Registered plugin: rdp command
INFO manager: Registered plugin: reload command
INFO manager: Registered plugin: resume command
INFO manager: Registered plugin: ssh command
INFO manager: Registered plugin: ssh-config command
INFO manager: Registered plugin: status command
INFO manager: Registered plugin: suspend command
INFO manager: Registered plugin: up command
INFO manager: Registered plugin: version command
INFO manager: Registered plugin: ssh communicator
INFO manager: Registered plugin: winrm communicator
INFO manager: Registered plugin: Arch guest
INFO manager: Registered plugin: CoreOS guest
INFO manager: Registered plugin: Darwin guest
INFO manager: Registered plugin: Debian guest
INFO manager: Registered plugin: ESXi guest.
INFO manager: Registered plugin: Fedora guest
INFO manager: Registered plugin: FreeBSD guest
INFO manager: Registered plugin: Funtoo guest
INFO manager: Registered plugin: Gentoo guest
INFO manager: Registered plugin: Linux guest.
INFO manager: Registered plugin: Mint guest
INFO manager: Registered plugin: NetBSD guest
INFO manager: Registered plugin: NixOS guest
INFO manager: Registered plugin: OmniOS guest.
INFO manager: Registered plugin: OpenBSD guest
INFO manager: Registered plugin: PLD Linux guest
INFO manager: Registered plugin: RedHat guest
INFO manager: Registered plugin: SmartOS guest.
INFO manager: Registered plugin: Solaris guest.
INFO manager: Registered plugin: Solaris 11 guest.
INFO manager: Registered plugin: SUSE guest
INFO manager: Registered plugin: TinyCore Linux guest.
INFO manager: Registered plugin: Ubuntu guest
INFO manager: Registered plugin: Windows guest.
INFO manager: Registered plugin: Arch host
INFO manager: Registered plugin: BSD host
INFO manager: Registered plugin: Mac OS X host
INFO manager: Registered plugin: FreeBSD host
INFO manager: Registered plugin: Gentoo host
INFO manager: Registered plugin: Linux host
INFO manager: Registered plugin: null host
INFO manager: Registered plugin: Red Hat host
INFO manager: Registered plugin: Slackware host
INFO manager: Registered plugin: SUSE host
INFO manager: Registered plugin: Windows host
INFO manager: Registered plugin: kernel
INFO manager: Registered plugin: kernel
INFO manager: Registered plugin: docker-provider
INFO manager: Registered plugin: Hyper-V provider
INFO manager: Registered plugin: VirtualBox provider
INFO manager: Registered plugin: ansible
INFO manager: Registered plugin: CFEngine Provisioner
INFO manager: Registered plugin: chef
INFO manager: Registered plugin: docker
INFO manager: Registered plugin: file
INFO manager: Registered plugin: puppet
INFO manager: Registered plugin: salt
INFO manager: Registered plugin: shell
INFO manager: Registered plugin: atlas
INFO manager: Registered plugin: ftp
INFO manager: Registered plugin: heroku
INFO manager: Registered plugin: local-exec
INFO manager: Registered plugin: noop
INFO manager: Registered plugin: NFS synced folders
INFO manager: Registered plugin: RSync synced folders
INFO manager: Registered plugin: SMB synced folders
INFO global: Loading plugins!
INFO manager: Registered plugin: vagrant-share
INFO vagrant: `vagrant` invoked: ["ssh"]
INFO environment: Environment initialized (#<Vagrant::Environment:0x36893d0>)
INFO environment: - cwd: C:/dev/local-server
INFO environment: Home path: C:/Users/vitallan/.vagrant.d
INFO environment: Local data path: C:/dev/local-server/.vagrant
INFO environment: Running hook: environment_plugins_loaded
INFO runner: Preparing hooks for middleware sequence...
INFO runner: 1 hooks defined.
INFO runner: Running action: #<Vagrant::Action::Builder:0x2c494c8>
INFO environment: Running hook: environment_load
INFO runner: Preparing hooks for middleware sequence...
INFO runner: 1 hooks defined.
INFO runner: Running action: #<Vagrant::Action::Builder:0x2cc93a0>
INFO cli: CLI: [] "ssh" []
INFO loader: Set :root = #<Pathname:C:/dev/local-server/Vagrantfile>
INFO loader: Loading configuration in order: [:home, :root]
INFO command: Active machine found with name default. Using provider: virtualbox
INFO environment: Getting machine: default (virtualbox)
INFO environment: Uncached load of machine.
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "--version"]
INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
INFO loader: Set "27710496_machine_default" = []
INFO loader: Loading configuration in order: [:home, :root, "27710496_machine_default"]
INFO box_collection: Box found: hashicorp/precise32 (virtualbox)
INFO environment: Running hook: authenticate_box_url
INFO host: Autodetecting host type for [#<Vagrant::Environment: C:/dev/local-server>]
INFO host: Detected: windows!
INFO runner: Preparing hooks for middleware sequence...
INFO runner: 2 hooks defined.
INFO runner: Running action: #<Vagrant::Action::Builder:0x376dbc8>
INFO warden: Calling IN action: #<VagrantPlugins::LoginCommand::AddAuthentication:0x4727a18>
INFO warden: Calling OUT action: #<VagrantPlugins::LoginCommand::AddAuthentication:0x4727a18>
INFO loader: Set :"28616568_hashicorp/precise32_virtualbox" = #<Pathname:C:/Users/vitallan/.vagrant.d/boxes/hashicorp-VAGRANTSLASH-precise32/1.0.0/virtualbox/Vagrantfile>
INFO loader: Loading configuration in order: [:"28616568_hashicorp/precise32_virtualbox", :home, :root, "27710496_machine_default"]
INFO machine: Initializing machine: default
INFO machine: - Provider: VagrantPlugins::ProviderVirtualBox::Provider
INFO machine: - Box: #<Vagrant::Box:0x474dfb0>
INFO machine: - Data dir: C:/dev/local-server/.vagrant/machines/default/virtualbox
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "--version"]
INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b"]
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"]
INFO command: With machine: default (#<VagrantPlugins::ProviderVirtualBox::Provider:0x487e4f8 @logger=#<Log4r::Logger:0x487e4c8 @fullname="vagrant::provider::virtualbox", @outputters=[], @additive=true, @name="virtualbox", @path="vagrant::provider", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @machine=#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>, @driver=#<VagrantPlugins::ProviderVirtualBox::Driver::Meta:0x4897560 @logger=#<Log4r::Logger:0x48a4148 @fullname="vagrant::provider::virtualbox::meta", @outputters=[], @additive=true, @name="meta", @path="vagrant::provider::virtualbox", @parent=#<Log4r::Logger:0x487e4c8 @fullname="vagrant::provider::virtualbox", @outputters=[], @additive=true, @name="virtualbox", @path="vagrant::provider", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @level=2, @trace=false>, @interrupted=false, @vboxmanage_path="C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", @uuid="d2575078-1bc6-448b-9c70-04e21249f33b", @version="4.3.22", @driver=#<VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3:0x48d4568 @logger=#<Log4r::Logger:0x48ed108 @fullname="vagrant::provider::virtualbox_4_3", @outputters=[], @additive=true, @name="virtualbox_4_3", @path="vagrant::provider", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @interrupted=false, @vboxmanage_path="C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", @uuid="d2575078-1bc6-448b-9c70-04e21249f33b">>, @cap_logger=#<Log4r::Logger:0x491d600 @fullname="vagrant::capability_host::vagrantplugins::providervirtualbox::provider", @outputters=[], @additive=true, @name="provider", @path="vagrant::capability_host::vagrantplugins::providervirtualbox", @parent=#<Log4r::Logger:0x37e65e8 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x375fd50 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x375fc18>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x375dbd8 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x37e6540 @level=0, @outputters=[]>, @level=2, @trace=false>, @level=2, @trace=false>, @cap_host_chain=[[:virtualbox, #<#<Class:0x491d8d0>:0x4b76518>]], @cap_args=[#<Vagrant::Machine: default (VagrantPlugins::ProviderVirtualBox::Provider)>], @cap_caps={:docker=>#<Vagrant::Registry:0x491d7f8 @items={:public_address=>#<Proc:0x3806538@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/plugin.rb:54>, :proxy_machine=>#<Proc:0x3806490@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/docker/plugin.rb:59>}, @results_cache={}>, :hyperv=>#<Vagrant::Registry:0x491d780 @items={:public_address=>#<Proc:0x380ed10@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/hyperv/plugin.rb:25>}, @results_cache={}>, :virtualbox=>#<Vagrant::Registry:0x491d708 @items={:forwarded_ports=>#<Proc:0x383fcd0@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/plugin.rb:27>, :nic_mac_addresses=>#<Proc:0x383fc58@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/providers/virtualbox/plugin.rb:32>, :public_address=>#<Proc:0x2a38508@C:/dev/tools/Vagrant/embedded/gems/gems/vagrant-share-1.1.3/lib/vagrant-share.rb:39>}, @results_cache={}>}>)
INFO machine: Calling action: ssh on provider VirtualBox (d2575078-1bc6-448b-9c70-04e21249f33b)
INFO runner: Preparing hooks for middleware sequence...
INFO runner: 1 hooks defined.
INFO runner: Running action: #<Vagrant::Action::Builder:0x460fde8>
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckVirtualbox:0x4686480>
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "--version"]
INFO meta: Using VirtualBox driver: VagrantPlugins::ProviderVirtualBox::Driver::Version_4_3
INFO base: VBoxManage path: C:\Program Files\Oracle\VirtualBox\VBoxManage.exe
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "list", "hostonlyifs"]
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckCreated:0x4686468>
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"]
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckAccessible:0x4686450>
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"]
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::CheckRunning:0x4686438>
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"]
INFO warden: Calling IN action: #<Vagrant::Action::Builtin::SSHExec:0x4686420>
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"]
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "showvminfo", "d2575078-1bc6-448b-9c70-04e21249f33b", "--machinereadable"]
INFO subprocess: Starting process: ["C:\\Program Files (x86)\\Git\\bin/ssh.EXE"]
INFO ssh: Invoking SSH: ["vagrant@127.0.0.1", "-p", "2222", "-o", "Compression=yes", "-o", "DSAAuthentication=yes", "-o", "LogLevel=FATAL", "-o", "StrictHostKeyChecking=no", "-o", "UserKnownHostsFile=/dev/null", "-o", "IdentitiesOnly=yes", "-i", "C:/Users/vitallan/.vagrant.d/insecure_private_key"]
有谁知道我怎么能在我的盒子里ssh?
编辑:我尝试打开新的前进门(如@ user1389596建议),但它仍然无法正常工作
答案 0 :(得分:0)
嗯,ssh 127.0.0.1是环回地址(同一台机器)。你不应该使用你的ubuntu服务器intead的本地局域网IP吗?