vagrant卡在“默认值:警告:连接超时。正在重试...”

时间:2015-11-04 11:51:14

标签: laravel ssh vagrant homestead

我谷歌搜索了几天,我找不到任何解决方案来解决我的问题。

我很确定,这个问题不是来自VT-x,因为我在Windows 8.1上使用了bento / ubuntu-14.04-i386(我想我的CPU允许使用32位作为访客而64位不使用C2D E7200)

我从laravel/settler克隆github repo并将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

请帮助,谢谢:)

1 个答案:

答案 0 :(得分:2)

这可能有多种原因,主要是关于私钥/公钥。您可以按照以下步骤进行故障排除:

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
vagrant@127.0.0.1's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
vagrant@127.0.0.1'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

中的私钥进行比较

如果你做了smt,还要确保~/.ssh/authorized_keys中的键在一行上。像复制粘贴一样,可能会发生插入换行符,这显然会破坏公钥。

以下是关于流浪汉和宅基地的一些注意事项,这将有所帮助:

通常vagrant用一个安全的替换insecure_private_key并在启动时调整所有内容,或者在配置中config.ssh.insert_key设置为true时暂停(这是最新版本1.7中的默认值) 。4)。因此,您可能会在.vagrant目录下看到IdentityFile的某个路径。

我的问题是,您可以正常定义在Homestead.yaml中使用的私钥,但是出于某种原因,宅基地并不尊重自定义密钥,并且流浪者没有替换不安全的钥匙......

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

在修复公钥后,我意识到流浪者成功地取代了insecure_private_key一些安全的公钥......

相关问题