2014-04-25 123 views
24

我有一個Ubuntu 13.10,我安裝了Vagrant 1.5.4和VirtualBox 4.3.10r93012。我在第一次正確編寫虛擬機腳本時編寫命令vagrant up時發生問題。但同樣做vagrant halt和寫入命令vagrant up後,會出現一個問題:超時等待機器啓動時超時

vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Clearing any previously set forwarded ports... 
==> default: Clearing any previously set network interfaces... 
==> default: Preparing network interfaces based on configuration... 
    default: Adapter 1: nat 
    default: Adapter 2: hostonly 
==> default: Forwarding ports... 
    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... 
    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. 

有沒有什麼解決辦法嗎?謝謝。

+0

Stack Overflow是編程和開發問題的網站。這個問題似乎與題目無關,因爲它不涉及編程或開發。請參閱幫助中心的[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)。也許[超級用戶](http://superuser.com/)或[Unix&Linux堆棧交換](http://unix.stackexchange.com/)會是一個更好的地方。另請參閱[我在哪裏發佈關於Dev Ops的問題?](http://meta.stackexchange.com/q/134306) – jww

回答

31

我使用config.vm.boot_timeout增加了時間。但對我來說,這不是原因,儘管錯誤告訴了超時。

我使用vim打開了Vagrantfile,並添加了以下幾行代碼,爲虛擬機啓用了GUI。

config.vm.provider :virtualbox do |vb| 
    vb.gui = true 
end 

重新運行vagrant up後,我看到了GUI中的真正原因。有一個錯誤對話框,它一直在等待。這是連接超時的原因。

要解決這個問題,我必須在系統BIOS中進行一些配置。我必須打開intel VT-x設置。請檢查AMD-V設置。這些設置有助於硬件虛擬化。

+0

感謝@Akalanka的評論。我通過打開intel VT-x BIOS的設置來解決問題。 – xserrat

+2

我已啓用GUI,但在GUI中我可以看到虛擬機的登錄屏幕,並且我可以用用戶名和密碼登錄爲流浪漢。 ssh超時。 ==>默認值:等待機器啓動。這可能需要幾分鐘的時間... 默認:SSH地址:127.0.0.1:2222 默認:SSH用戶名:流浪 默認:SSH驗證方法:私鑰 – Sharath

0

編輯config.vm並根據您的需要增加config.vm.boot_timeout的值。

4

我用「流浪摧毀」並解決了這個問題。

該命令停止正在運行的機器Vagrant正在管理和銷燬機器創建過程中創建的所有資源。運行此命令後,您的計算機應保持清潔狀態,就好像您從未創建客戶機一樣。

4

您需要能夠使用GUI。在Vagrant文件中刪除此行的評論:

config.vm.provider :virtualbox do |vb| 
    vb.gui = true 
end 

後,您需要關閉您的計算機並再次啓動:

vagrant halt 
vagrant up 
+0

任何想法爲什麼這將是必要的? – activatedgeek

8

我對窗口10同樣的問題,我的解決辦法是啓用英特爾虛擬化

恐怕我不能給你具體的說明,只要BIOS菜單選項因電腦而異,具體取決於製造商。但是,通常您應該按照以下步驟操作:

1-打開機器電源並打開BIOS。

2-打開處理器子菜單。處理器設置菜單可能隱藏在芯片組,高級CPU配置或北橋中。

根據處理器的品牌,啓用Intel虛擬化技術(也稱爲Intel VT)或AMD-V。

4-保存更改並重新啓動。

+2

謝謝,我認爲如果BIOS支持這種配置,這是解決問題的最佳選擇。 @Akalanka說,如果它不支持,一個可能的解決方案是通過流浪配置。 – xserrat

35

選擇您的Ubuntu服務器,單擊設置,轉到網絡選項卡,並確保您的電纜連接選項被選中。

enter image description here

+0

這個問題解決了牙齒和指甲後,這個解決方案爲我工作。非常感謝! – KalC

+0

感謝萬人!這一整天我都被這個問題困住了! :) –

-1

重新啓動計算機,並保持打F10鍵。這會將您帶入系統BIOS。在那裏你可以檢查你的英特爾虛擬化是否被禁用。如果是這樣,將其更改爲啓用,保存並繼續重新啓動您的電腦。

-1

一些事情你可以試試:

  1. 檢查流浪版本(vagrant -v)你正在運行,它應該是最新的。還運行vagrant box update
  2. 增加config.vm.boot_timeout Vagrantfile中的值。
  3. config.vm.provider :virtualbox do |vb|之後加上vb.gui = true行使Vagrantfile打開帶有GUI的虛擬機。嘗試重新加載,看看它發生什麼確切的錯誤,然後嘗試修復它。 也點擊設置,轉到網絡選項卡,並確保選擇了電纜連接選項。

  4. 一旦GUI啓用嘗試重裝一次登錄界面時,你可以用用戶名流浪漢登錄名和密碼相同的用戶名。你需要打開/etc/default/grub。將以下內容添加到文件底部並保存文件:GRUB_RECORDFAIL_TIMEOUT=2。運行sudo update-grub。關閉VM並運行vagrant up

0

我也越來越錯誤消息Timed out while waiting for the machine to boot.通過遊民文件啓用GUI後,我能看到流浪的TP被要求登錄&密碼。提供vagrant/vagrant工作,但機器仍然沒有起來。

最後,Vagrant destroy工作。經過這個流浪者上調配置的機器&現在我可以做ssh了。