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

87,072

Solution 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.

Solution 2

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

enter image description here

Solution 3

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.

Solution 4

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.

Solution 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
Share:
87,072
xserrat
Author by

xserrat

Updated on August 14, 2022

Comments

  • xserrat
    xserrat almost 2 years

    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.

  • xserrat
    xserrat almost 9 years
    Thanks @Akalanka for your comment. I solve the problem through turn on the intel VT-x BIOS's setting.
  • xserrat
    xserrat over 8 years
    Thanks, I think that it's the best option to solve the problem if BIOS supports this configuration. If it doesn't support, a possible solution is via vagrant config as @Akalanka said.
  • Sharath
    Sharath about 8 years
    Ive enabled GUI, but in GUI i can see the login screen of the VM and i can login with user name and password both as vagrant. ssh timeouts. ==> 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
  • activatedgeek
    activatedgeek about 8 years
    Any ideas why that would be necessary?
  • KalC
    KalC over 7 years
    After fighting tooth and nail with this problem, this solution worked for me. Thank you so much!
  • sameera sy
    sameera sy over 7 years
    Thanks a million man! I was stuck up with this the whole day! :)
  • Niklas Rosencrantz
    Niklas Rosencrantz about 6 years
    But not everybody can access their BIOS. I can't.
  • Brian Jackson
    Brian Jackson almost 6 years
    This worked for me on my laptop. After enabling IVT in BIOS vagrant command worked fine. Thanks!
  • sarathkm
    sarathkm over 5 years
    For me solution was step 3 and reloading vagrant.
  • lsimonetti
    lsimonetti over 5 years
    For me, I turned on the vb.gui and saw that it had problems with the disk drive boot, and that the /tmp folder is not yet ready or present. Doing a vagrant destroy took care of that problem.
  • Yashu Mittal
    Yashu Mittal over 5 years
    Didn't work for me. Still getting the same error message.
  • paulalexandru
    paulalexandru over 5 years
    Update your Virtual Box. Move to VB 5 or something. It should work.
  • user1012513
    user1012513 over 4 years
    In my case "Cable connected" is already selected! Answer by @Akalanka helped, but vagrant up is very slow.
  • retrovius
    retrovius over 4 years
    You can set "Cable connected" to true within the Vagrantfile btw. Add vb.customize [ "modifyvm", :id, "--cableconnected1", "on" ] to the config.vm.provider section.
  • Alex MM
    Alex MM over 4 years
    Thanks for the tip of showing the VirtualBox UI! In my case everything was normal, no found errors, so increasing the timeout was enough. IMPORTANT: I have realized about that I only had the timeout problem when disconnecting the laptop from the electricity apparentlly because after doing that the laptop enters in a "battery saver" mode. When it is connected to electricity it is in a "performance" mode and then I never have the problem.
  • Arcones
    Arcones almost 4 years
    good point but, no need to launch the heavy UI though... just vagrant ssh and then sudo ufw disable as you said
  • lovecoding
    lovecoding over 3 years
    Where is config file? How can I find vagrantfile?
  • Henry Bui
    Henry Bui over 3 years
    I did Option 2 and it worked for me. It took 4 hours of my life.
  • Sayad Ahmed Shaurov
    Sayad Ahmed Shaurov over 3 years
    I see! I had also wasted lots of time. That's why i put on my solution here.
  • noelicus
    noelicus over 3 years
    Wow. Over 5 years later and is still a valid workaround ¯_(ツ)_/¯
  • monteirobrena
    monteirobrena over 3 years
    @noelicus glad that was useful for you.
  • DeltaTango
    DeltaTango over 3 years
    Thanks, this is the ONLY thing that worked for me. Everything else here was a complete waste of time.