验证失败。使用自定义创建的框时,在Vagrantfile中重试...

时间:2017-07-27 21:57:53

标签: vagrant virtual-machine vagrantfile vbox

我使用以下命令打包VM,

vagrant package --base VMID —-output builder.box

我的Vagrantfile如下所示,

box = "centos/7"
prefix_ip_addr = "174.10.10."

Vagrant.configure("2") do |config|
    config.vm.box = box 
    builder_ip = "%s100" % [prefix_ip_addr]
    config.ssh.forward_agent = true
    config.ssh.insert_key = false

    config.vm.define :builder do |builder|
        # Setup builder VM and IP
        builder.vm.hostname = "builder"
        builder.vm.network :private_network, ip: builder_ip

        # Setup builder VM system requirements
        builder.vm.provider "virtualbox" do |v| 
            v.memory = 1024 * 16
            v.cpus = 8 
            v.customize ["modifyvm", :id, "--natdnshostresolver1","on"]
            v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
        end 
    end 
end

然后我使用创建的框来启动另一台机器,Vagrantfile如下所示,

Vagrant.configure("2") do |config|
    config.ssh.forward_agent = true
    config.vm.define :builder1 do |builder|
        builder.vm.box = "package.box"
    end 
end

但是我收到了这个错误,

builder1: Warning: Authentication failure. Retrying...
builder1: Warning: Authentication failure. Retrying...
builder1: Warning: Authentication failure. 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.

请帮助我长时间坚持这个错误。 :(

1 个答案:

答案 0 :(得分:0)

我知道这已经很老了,但我自己就开始和流浪汉一起开始讨论这个问题。对于那些可能也会发现自己的人,我只是将以下内容添加到我的Vagrantfile中:

config.vm.boot_timeout = 60

对于op,我也可能会检查你是否需要设置config.ssh.username和config.ssh.password指令。