vagrant default- Warning- Authentication failure. Retrying...

在终端输入: vagrant up后 显示

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
ed out while waiting for the machine to boot. This means that
rant was unable to communicate with the guest machine within
configured ("config.vm.boot_timeout" value) time period.
you look above, you should be able to see the error(s) that
rant had when attempting to connect to the machine. These errors
usually good hints as to what may be wrong.
you're using a custom box, make sure that networking isproperly
king and you're able to connect to the machine. It is a common
blem that networking isn't setup properly in these boxes.
ify that authentication configurations are also setup properly,
well.
the box appears to be booting properly, you may want to increase
timeout ("config.vm.boot_timeout") value.

看错误提示可能是认证出现了问题,但是guest机器仍然可以通过vagrant ssh登陆,解决方法,让vagrant启动的时候重新生成keypair.

解决办法:

  1. cd /tmp
  2. wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
  3. cat vagrant.pub >> ~/.ssh/authorized_keys

最后是:

vagrant reload


上面的办法不太完美,就是说仍然会报下面这些错误提示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...

然后才能启动完成(这浪费了太多时间,不能忍啊),到Vagrantfile里,把这一行注释去掉:

# config.vm.network "private_network", ip: "192.168.33.10"

具体参考了这篇文章: ->

生活不止眼前的苟且,还有那片海