2017-07-27 43 views
0

我用下面的命令來打包VM,身份驗證失敗。正在重試...在Vagrantfile在使用自定義創建箱

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. 

請幫我解決這個錯誤很長時間了。 。:(

+0

明天告訴我,我會盡力提供幫助。 –

回答

0

我知道這是很老,但我剛開始與流浪者自己,就遇到了這個問題,對於那些誰也可以在這裏找到自己,我只是增加了以下我Vagrantfile:

config.vm.boot_timeout = 60 

對於op,我可能還會檢查是否需要設置config.ssh.username和config.ssh.password指令。