Timed out while waiting for the machine to boot when vagrant up

狂风中的少年 提交于 2019-11-27 05:21:44

问题


I have an Ubuntu 13.10 and I installed Vagrant 1.5.4 and VirtualBox 4.3.10r93012. My problem occurs when I write the command vagrant up at the first time the script up the virtual machine correctly. But after doing vagrant halt and write the command vagrant up again, a problem occurs:

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.

Is there any solution? Thanks.


回答1:


I increase the time using config.vm.boot_timeout. But for me it was not the reason although the error tells about a timeout.

I opened the Vagrantfile using vim and add the following lines which turns on GUI for the VM.

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

After re-running the vagrant up i saw the real reason in the GUI. There was an error dialog and it keeps waiting. That was the reason for the connection timeout.

To fix this i had to do some configurations in the system BIOS. I had to turn on the intel VT-x setting. And please check for AMD-V setting as well. These settings help hardware virtualization.




回答2:


Select your Ubuntu server, click on Settings, go to Network tab and make sure that your Cable Connected option is selected.




回答3:


I had the same problem on windows 10 and the solution for me was to enable Intel Virtualization.

I'm afraid I can't give you specific instructions, as far as the BIOS menu options vary from computer to computer depending on the manufacturer. However, generally you should follow these steps:

1-Power on the machine and open the BIOS.

2- Open the Processor submenu. The processor settings menu may be hidden in the Chipset, Advanced CPU Configuration or Northbridge.

3-Enable Intel Virtualization Technology (also known as Intel VT) or AMD-V depending on the brand of the processor.

4- Save the changes and restart.




回答4:


I used "vagrant destroy" and solved the problem.

This command stops the running machine Vagrant is managing and destroys all resources that were created during the machine creation process. After running this command, your computer should be left at a clean state, as if you never created the guest machine in the first place.




回答5:


You need to able the GUI. Remove the comment of this lines in your Vagrant file:

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

After you need shutdown your machine and start again:

vagrant halt
vagrant up



回答6:


I was also getting error message Timed out while waiting for the machine to boot. After enabling the GUI through vagrant file, I could see that vagrant tp was asking for login & password. providing vagrant/vagrant worked but the machine was still not up.

Finally, Vagrant destroy worked. After this vagrant up provisioned machine & now I could do ssh.




回答7:


Edit config.vm and increase the value of config.vm.boot_timeout to your needs.




回答8:


I know this is an old thread, but I recently ran into this same issue with an Ubuntu vagrant box (19.04) and wanted to post the solution that worked for me.

The key part was the number of cpus. The box had been trying to boot with 2 enabled and that was absolutely killing the performance during boot, so much so that vagrant would time out waiting.

By setting it to 1 my box came up immediately on vagrant up!

In your Vagrantfile under the config.vm.provider "virtualbox" do |v| section try adding v.cpus = 1 and see if that helps.

Hope this helps someone else having a similar issue.




回答9:


Prerequisite: Please Make sure your virtualization is enabled.

I had the same problem in my windows 10 system and I researched a lot about the issue in both StackOverflow and GitHub issues but nothing worked. So I simply updated my virtual box to the latest version and rebooted the system. Afterwards, it worked absolutely fine for me :)




回答10:


Potential Issue: Virtualization might be disabled in your bios

Restart your computer and keep hitting F10 key. This will take you into the system BIOS. There you can check if your Intel-Virtualization is disabled. If so, change it to Enabled, save and continue to restart your pc.




回答11:


just enable virtualization technology of cpu setting in BIOS




回答12:


Few things you can try:

  1. Check the Vagrant version (vagrant -v) you are running and it should be latest. Also run vagrant box update.
  2. Increase config.vm.boot_timeout value in Vagrantfile.
  3. Add vb.gui = true after config.vm.provider :virtualbox do |vb| line in Vagrantfile to open VM with GUI. Try reload, and see what is the exact error at which it is getting stuck and try fixing that. Also click on Settings, go to Network tab and make sure that your Cable Connected option is selected.

  4. Once GUI is enabled try reloading and once the login screen is up, you can login with the username vagrant and the password is the same as the username. You need to open up /etc/default/grub. Add the following to the bottom of the file and save the file: GRUB_RECORDFAIL_TIMEOUT=2. Run sudo update-grub. Shutdown the VM and run vagrant up.



来源:https://stackoverflow.com/questions/23293071/timed-out-while-waiting-for-the-machine-to-boot-when-vagrant-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!