2014-01-08 46 views
12

我有一個Ubuntu的virtualbox。一切工作正常,但在啓動,它的消息後,大約需要5分鐘或更長時間「等待機器啓動需要很長時間,這可能需要幾分鐘......」來完成啓動

Waiting for machine to boot. This may take a few minutes...

它完成啓動前:

➜ my_box vagrant reload 
/Users/pinouchon/.vagrant.d/boxes/my_box/virtualbox/include/_Vagrantfile:5: warning: already initialized constant VAGRANTFILE_API_VERSION 
[default] Attempting graceful shutdown of VM... 
[default] Clearing any previously set forwarded ports... 
[default] Creating shared folders metadata... 
[default] Clearing any previously set network interfaces... 
[default] Preparing network interfaces based on configuration... 
[default] Forwarding ports... 
[default] -- 22 => 2222 (adapter 1) 
# More port forwards 
[default] Booting VM... 
[default] Waiting for machine to boot. This may take a few minutes... 
# waits about 5 minutes at this point, then: 

[default] Machine booted and ready! 
[default] The guest additions on this VM do not match the installed version of 
VirtualBox! In most cases this is fine, but in rare cases it can 
cause things such as shared folders to not work properly. If you see 
shared folder errors, please update the guest additions within the 
virtual machine and reload your VM. 

Guest Additions Version: 4.3.0 
VirtualBox Version: 4.2 
[default] Configuring and enabling network interfaces... 
[default] Mounting shared folders... 
[default] -- /vagrant 

這個盒子曾經是更快(約30秒開機)。所以我認爲這是一個網絡配置,導致超時或類似的東西。

它試圖在這裏提出的修正: https://github.com/mitchellh/vagrant/wiki/%60vagrant-up%60-hangs-at-%22Waiting-for-VM-to-boot.-This-can-take-a-few-minutes%22

但沒有成功。 (我嘗試了修復Resolve itworkaround 2.)。

我也嘗試刪除我的/etc/hosts文件中的任何127.0.0.1條目。沒有成功。

任何提示?

OS /版本:

Host: OSX 10.8.5 
Guest: Ubuntu 12.05 
Virtualbox: 4.2 
+0

很難從眼前這個診斷。您是否嘗試過[啓用VirtualBox的GUI]在(http://docs.vagrantup.com/v2/virtualbox/configuration.html)你'Vagrantfile',所以你可以在控制檯啓動時看到它? – phs

+0

它確實會說「這可能需要幾分鐘」,所以我不確定是否存在真正的問題 – sevenseacat

回答

13

您使用的盒子具有的VirtualBox客戶附加版本4.3.x,但您的主機運行時,由於這種差異的4.2.x版

,VirtualBox是無法執行一些屬於創建過程的命令。

要麼運行guest虛擬機添加4.2.x,要麼將虛擬機升級到4.3.x將可能解決此問題。

更新

嘗試設置你的遊民文件中的以下

config.vm.boot_timeout = 300 

也可以嘗試開啓調試運行

vagrant up --debug 

更新2

某些虛擬機不能很好地與客戶添加的不兼容版本進行比較。例如,來自同一家公司的一個centos和debian盒子。 Centos將會封鎖,而debian會正常工作。

http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box
http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box

+0

我使用類似的安排並且沒有奇怪的啓動顯示正如警告所說,這種不匹配大多是無害的 – phs

+0

感謝您指出我在正確的方向 –

+0

vagrant up --debug 這不工作 –

0

固定的問題。我做了什麼:

  • 更新的VirtualBox 4.3.0至
  • 更新流浪到1.4.2(我想1.4。3會工作相同)
  • 遵循此修復程序(用於更新vBoxAdditions):需要

    注意事項。 (我的vBoxGuestAdditions太近了)

  • 需要升級vagrant,因爲vagrant 1.3不適用於virtualbox 4.3(vagrant 1.4 does)。
  • 固定我所做的是這一次的更新版本:https://gist.github.com/fernandoaleman/5083680

其他說明:

  • 更改config.vm.boot_timeout = 300沒有幫助

編輯:另請嘗試在客機中運行remove /etc/udev/rules.d/70-persistent-net.rules

1

不知道你是否已經解決了這個問題,但是我有同樣的錯誤並修復它,我在重新啓動之前刪除了在vagrant上發佈的DHCP租約。

@本地您可以使用

VBoxManage controlvm <vmname> poweroff 

然後在VirtualBox的,你一定要刪除DHCP

sudo rm -Rf /var/lib/dhcp/* 

執行poweroff虛擬機,你會發現更多的信息來指導你THROU

https://github.com/mitchellh/vagrant/wiki/%60vagrant-up%60-hangs-at-%22Waiting-for-VM-to-boot.-This-can-take-a-few-minutes%22

7

如果流浪無法建立SSH連接,也會發生這種情況。

它似乎不報告爲什麼它掛在這種情況下的任何錯誤。

硒的GUI顯示:

# Show GUI or not. 
config.vm.provider "virtualbox" do |v| 
    v.gui = true 
end 

您可能會看到「開發登錄:」或其他類似的提示一切就好了。

那麼你可能還記得您更改SSH密鑰集上的來賓昨晚...

解決方案:其中私鑰是在主機上告訴無業遊民。

# Use a new keyset 
config.ssh.private_key_path = "~/.ssh/id_rsa" 

公共密鑰需要在客人了。

這隻有在您已將匹配公鑰放在來賓的authorized_keys文件中時纔有效。

這種變化的操作系統,但在公共Precise64中,它看起來像這樣從終端:

Linux主機在OpenSSH客戶端

ssh-copy-id -i .ssh/id_rsa.pub [email protected] 

的Mac主機

cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys" 

還有一個用於mac的ssh-copy-id端口。 https://github.com/beautifulcode/ssh-copy-id-for-OSX

此SO帖子有一個簡單的內聯shell配置程序,用於在配置計算機以使其自動運行時交換authorized_keys。 Vagrant insecure by default?

2

我偶爾會遇到這種情況:虛擬機需要很長時間才能啓動,隨後網絡出現問題(我運行的網站變得無法訪問)。

對於我來說,這是固定的由以下:

  1. vagrant ssh到VM
  2. 在虛擬機,運行sudo /etc/init.d/networking restart
0

嘗試生成insecure_private_key

我解決了這個由刪除insecure_private_key,位於~/.vagrant.d

也許原因是insecure_private_key文件是舊

1

@的vagrant up --debug spuder的建議修正了這個問題對我來說。似乎VirtualBox GUI運行得更順利,並且在這個過程中更快地彈出一個窗口。我在其他人建議的路上轉過身:

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

並已設置config.vm.boot_timeout = 600

這與Udacity課程Full Stack Foundations的setup有關。

+0

這對我有用主持人:Windows Server 12,VM:ubuntu/precise32, VirtualBox 5.1 – scottlittle

0

我解決了這個問題:

wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys 
chmod 700 .ssh 
chmod 600 .ssh/authorized_keys 
chown -R vagrant:vagrant .ssh 

有些人還可以這樣做:

Warning: Authentication failure. Retrying... 
-1

在VirtualBox虛擬管理器,選擇合適的虛擬機,然後用鼠標右鍵單擊設置→網絡。啓用適配器1 →電纜已連接。最後,執行

$vagrant reload 
0

嘗試取消對該行:

config.vm.network 「private_network」 IP:「192.168.33。11"

內VagrantFile

相關問題