我有一個Ubuntu 14.04 Vagrant框。它似乎大多數時間都工作正常,但是每隔幾天我都會遇到問題。當流浪試圖ssh到機器,它得到一個警告:遠程連接斷開連接,連接到169.254.169.254超時
Warning: Remote connection disconnect. Retrying...
這是每隔幾秒鐘打印一段時間,直到我給一個錯誤,說其超時等待機器啓動。我發現this question這表明啓動進入GUI,其中:
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
看看發生了什麼拿着VM起來。它看起來像被卡住的VM調用url_helper.py
:
url_helper.py[WARNING]: Calling 'http://169.254.168.254/2009-04-04/meta/instance-id'
failed [101/120s]:request error [(<urllib3.connectionpool.HTTPConnectionPool object
at 0x7ff2d6691450>, 'Connection to 169.254.168.254 timed out.
(connect timeout=50.0)')]
url_helper.py[WARNING]: Calling 'http://169.254.168.254/2009-04-04/meta/instance-id'
failed [119/120s]:request error [(<urllib3.connectionpool.HTTPConnectionPool object
at 0x7ff2d6682f50>, 'Connection to 169.254.168.254 timed out.
(connect timeout=50.0)')]
DataSourceEc2.py[CRITICAL]: Giving up on md from
['http://169.254.168.254/2009-04-04/meta/instance-id'] after 120s
這一直遭到打印出來,直到流浪失敗:
<machine name>: Warning: Remote connection disconnect. Retrying...
<machine name>: Warning: Remote connection disconnect. Retrying...
<machine name>: Warning: Remote connection disconnect. 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.
但隨後一小會兒後會繼續到登錄屏幕。在這一點上,我可以登錄或ssh,除了一些事情是不正確的。即。共享文件夾未安裝。我能找到唯一的解決方法是摧毀並重新起機器:
vagrant destroy -f && vagrant up
從而可以根據機器的配置需要一段時間。
有沒有其他人遇到過這個問題?對於如何解決這個問題,有任何的建議嗎?
這是我目前的Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "trusty64"
config.vm.box_url = "/media/resources/Development/Vagrant/Boxes/trusty64.box"
config.vm.define "name" do |name|
name.vm.hostname = "name"
name.vm.network :private_network, ip: "192.168.45.12"
name.vm.network :forwarded_port, guest: 7070, host: 7070
name.vm.network :forwarded_port, guest: 7443, host: 7443
name.vm.provider :virtualbox do |vb|
vb.name = "name"
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "provisioning/playbook.yml"
ansible.sudo = true
ansible.verbose = "v"
ansible.extra_vars = "@provisioning/user_vars.yml"
end
end
順便說一句,對方的回答上面的鏈接的問題(通過發送的vboxmanage
回車鍵到虛擬機沒有工作,因爲我有一個不同的問題對這個問題的提問者)
UPDATE:繼@ ElfElix的意見,我在/ etc /網絡/接口,一看,只見這一點:
#VAGRANT-BEGIN
#The contents below are automatically generated by Vagrant. Do not modify
auto eth1
iface eth1 inet static
address 192.168.45.11
netmask 255.255.255.0
#VAGRANT-END
雖然,在/etc/network/interfaces.d/eth0.cfg是:
# The primary network interface
auto eth0
iface eth0 inet dhcp
我試着刪除這個文件來禁用DHCP,但只是讓事情變得更糟。 vagrant up
不僅失敗,因爲它無法連接,但在等待一段時間後我無法ssh進入。
有沒有人有任何其他想法?
UPDATE II: 看來,虛擬機將只有初始vagrant up
這將創造和提供本機後開始。在停止機器之後,它會遇到上述錯誤,因此不能正確顯示。
兩件事:不要添加日誌的屏幕截圖,複製粘貼數據,以便我t可以是有用的(例如可搜索的)。我不喜歡ip爲「169.254.168.254」,169.254.x.x的IP地址用於網絡問題的特殊場合 – xlembouras 2014-09-26 06:07:24