2015-11-04 155 views
2

我搜索了几天,我没有找到任何解决方案来解决我的问题。vagrant卡住在“默认:警告:连接超时。重试...”

我敢肯定,因为我利用VT-x此问题不是便当/ Ubuntu的14.04-I386在Windows 8.1(我想我的CPU允许使用32位的客人,但64位不C2D E7200)

我从​​克隆GitHub库和替换config.vm.box = 'bento/ubuntu-14.04'config.vm.box = 'bento/ubuntu-14.04-i386'Vagrantfile

而且随着vagrant up开始流浪汉,我得到这个

λ vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Importing base box 'bento/ubuntu-14.04-i386'... 
==> default: Matching MAC address for NAT networking... 
==> default: Checking if box 'bento/ubuntu-14.04-i386' is up to date... 
==> default: Setting the name of the VM: settler_default_1446635664316_42330 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
==> default: Forwarding ports... 
    default: 80 => 8000 (adapter 1) 
    default: 3306 => 33060 (adapter 1) 
    default: 5432 => 54320 (adapter 1) 
    default: 35729 => 35729 (adapter 1) 
    default: 22 => 2222 (adapter 1) 
==> default: Running 'pre-boot' VM customizations... 
==> default: Booting VM... 
==> default: Waiting for machine to boot. This may take a few minutes... 
    default: SSH address: 127.0.0.1:2222 
    default: SSH username: vagrant 
    default: SSH auth method: private key 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
    default: Warning: Connection timeout. Retrying... 
Timed out while waiting for the machine to boot. This means that 
Vagrant was unable to communicate with the guest machine within 
the configured ("config.vm.boot_timeout" value) time period. 

If you look above, you should be able to see the error(s) that 
Vagrant had when attempting to connect to the machine. These errors 
are usually good hints as to what may be wrong. 

If you're using a custom box, make sure that networking is properly 
working and you're able to connect to the machine. It is a common 
problem that networking isn't setup properly in these boxes. 
Verify that authentication configurations are also setup properly, 
as well. 

If the box appears to be booting properly, you may want to increase 
the timeout ("config.vm.boot_timeout") value. 

vagrant ssh-config

Host default 
    HostName 127.0.0.1 
    User vagrant 
    Port 2222 
    UserKnownHostsFile /dev/null 
    StrictHostKeyChecking no 
    PasswordAuthentication no 
    IdentityFile C:/Users/Jame/.vagrant.d/insecure_private_key 
    IdentitiesOnly yes 
    LogLevel FATAL 

vagrant global-status

id  name provider state directory 
------------------------------------------------------------------------------------------ 
87ba96c default virtualbox running C:/Users/Jame/Dropbox/Private/myscript/config/settler 

The above shows information about all known Vagrant environments 
on this machine. This data is cached and may not be completely 
up-to-date. To interact with any of the machines, you can go to 
that directory and run Vagrant, or you can use the ID directly 
with Vagrant commands from any directory. For example: 
"vagrant destroy 1a2b3c4d" 

和GUI是

screenshot virtualbox

请帮帮忙,谢谢:)

+0

的情况可能是因为VirtualBox的失败重定向端口,尽管说 “** ==>默认:转发端口... 默认:22 => 2222(适配器1)**' 您可能在这里查看我的问题的完整描述[链接](http://stackoverflow.com/questions/36529651/virtualbox- NAT-未能对重定向-TCP-127-0-0-12222-10-0-2-1522)。 我仍然不知道如何解决重定向失败( 请在我的帖子中放下一个注释,如果你的成功! – WebComer

回答

1

这可能有多种原因,它的大部分是关于私人/公共密钥。您可以按照以下步骤排除故障:

1)首先尝试是否可以使用密码ssh来确保它是关于密钥的。如果你不能,那么你应该首先找到原因,第3步也会有帮助。

2)要做的第二件事是找出哪些密钥流浪者正在使用。 运行vagrant ssh-config和检查IdentityFile,在你的情况下,这是由vagrant提供的默认insecure_private_key

3)现在运行vagrant ssh -- -v,它会告诉你ssh进程的细节,仔细检查使用的私钥。如果你看到smt。像这样在结束时,你可以肯定的是服务器无法比拟的公钥,这就是问题:

debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: publickey 
debug1: Trying private key: /Users/ozan/.vagrant.d/insecure_private_key 
debug1: Authentications that can continue: publickey,password 
debug1: Next authentication method: password 
[email protected]'s password: 
debug1: Authentications that can continue: publickey,password 
Permission denied, please try again. 
[email protected]'s password: 

4)ssh登录你的客人有密码,并检查公钥是确定的。您应该检查~/.ssh目录和/.ssh/authorized_keys文件的权限。它们必须分别为755(drwx ------)和600(-rw -------),它们必须归vagrant用户所有。

5)检查公钥与您的私钥是否匹配。要做到这一点从产生像ssh-keygen -f ~/.vagrant.d/insecure_private_key -y主机上的私钥的公钥,并将其与一个在~/.ssh/authorized_keys

同时确保密钥是在~/.ssh/authorized_keys是在一行,如果你做的SMT比较。像复制粘贴它可能会发生,插入新行字符,这将显然破坏公钥。


这里是关于流浪者和宅基地的一些注意事项,这将有助于:

通常流浪汉替换此insecure_private_key一些安全的一个,并在启动时调整一切,或者如果config.ssh.insert_key在您的配置设置为true停止(这是最新版本1.7.4中的默认设置)。因此,您可能会在.vagrant目录下看到IdentityFile的一些路径。

我的问题是,您可以定义哪个私钥在您的Homestead.yaml中正常使用,但是由于某种原因,宅基地并不尊重自定义密钥,而且流浪者也没有取代不安全的密钥。

因此,我基本上生成并复制列出为IdentityFile的私钥的公钥,并将其放入authorized_keys这确实解决了问题。

固定的公共密钥后,我意识到,流浪者取代了insecure_private_key与successfuly一些安全的一个...

+0

我跟着你的步伐,但我没有运气http://pastebin.com/pingEEYJ –

+0

我假设我的问题是关于我的网络原因,当我使用gui和登录与vagrant密码vagrant我不能ping任何网站(google.com) 感谢帮助我:)对不起我的郎,我希望你能理解我。 T^T –

+0

是的,在第三步你会得到:'ssh_exchange_identification:由远程主机关闭的连接你应该关注这个。这可能与你所说的网络问题有关...... – madpoet