43

Having some issues to get my vagrant up, Got the box, run vagrant init and after vagrant up command I get this message.

Bringing machine 'default' up with 'virtualbox' provider...
    ==> default: Importing base box 'precise32'...
    ==> default: Matching MAC address for NAT networking...
    ==> default: Setting the name of the VM: virtm_default_1400193131859_61200
    ==> default: Fixed port collision for 22 => 2222. Now on port 2201.
    ==> default: Clearing any previously set network interfaces...
    ==> default: Preparing network interfaces based on configuration...
        default: Adapter 1: nat
    ==> default: Forwarding ports...
        default: 22 => 2201 (adapter 1)
    ==> default: Booting VM...
    ==> default: Waiting for machine to boot. This may take a few minutes...
        default: SSH address: 127.0.0.1:2201
        default: SSH username: vagrant
        default: SSH auth method: private key 
    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.

Any suggestions?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Merlo
  • 631
  • 1
  • 6
  • 11
  • http://stackoverflow.com/questions/23293071/timed-out-while-waiting-for-the-machine-to-boot-when-vagrant-up/39892470#39892470 – paulalexandru Oct 06 '16 at 13:49

14 Answers14

23

There are several different problems which can lead to this timeout problem. A good tip for tracking it down is to enable the GUI mode. This will bring up the VirtualBox machine UI which may provide a better clue as to the problem.

To enable GUI mode, make sure this section in your Vagrantfile is uncommented:

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

Then do a vagrant reload. This should bring up the VirtualBox application showing your virtual machine UI. Usually the problem will become apparent, whether it's a network issue or grub boot loader problem.

After fixing the issue, you can comment this out again, then do another vagrant reload to return to headless mode.

Reference: Vagrant docs

BrianC
  • 10,591
  • 2
  • 30
  • 50
  • 2
    Thanks. In my case, the VM was stuck at the bootloader (grub) waiting for ENTER key. I am using the default `hashicorp/precise32`. I started the machine with GUI, then ran `sudo grub-mkconfig` that reset the `/boot/grub/grub.cfg` file, and I could then comment back the `vb.gui=true` line. – maggix Jun 11 '14 at 21:52
  • 2
    @maggix that's the same problem I had; I'm not 100% sure but I think it happened whenever starting a VM after it had been previously 'vagrant halt'; now I do a cleaner shutdown like: `vagrant ssh -c 'sudo shutdown -h now'` – BrianC Jun 12 '14 at 17:26
  • Thanks @BrianC I will follow your advice if something goes wrong again! – maggix Jun 12 '14 at 20:10
  • I've done this and then what is described here in order to fix my issue: https://github.com/hashicorp/vagrant/issues/10208#issuecomment-422626935 – marquito Mar 27 '19 at 19:15
5

A solution is gracefully described here. It was the only one that worked for me on a i686 with Ubuntu 16.04.2, Vagrant 1.9.3 and Virtualbox 5.1.18 trying to run a ubuntu/trusty32.

What you do is fix the networking on the server and add some extra time for the boot:

  • start the VM, log in to the server via GUI (username: vagrant, password: vagrant) and run the following commands

    $ sudo ifdown eth0
    $ sudo ifup eth0
    
  • then add the following to the file /etc/rc.local

    ifdown eth0
    ifup eth0
    
  • on the host, add the following to the Vagrantfile

    config.vm.boot_timeout = 600
    

Now stop the VM. Next time you do a 'vagrant up' it will be OK.

fkaralis
  • 445
  • 1
  • 6
  • 10
  • [EDIT] added a previously ommited step (the two sudo commands). Worked again OK. Had to wait a few minutes though. – fkaralis Dec 17 '18 at 20:50
4

If your Vagrant box is running Ubuntu 16.04, it's because of this boot step ... A start job is running for raise network interfaces (5 mins 8 sec) One way to overcome this is to start the VM from VirtualBox and then do vagrant ssh

KalC
  • 1,530
  • 3
  • 22
  • 33
3

config.vm.boot_timeout didn't help me even after setting up-to maximum!!!

The real problem in my case was, it was unable to create the network adapter. I have to explicitly edit the box.ovf file in order to enable it.

Locate the box.ovf file & open it in an text editor, then add cable="true" as shown in below, after that save and exit. Post that destroy your vagrant using vagrant destroy and then bring it up.

Locate(box.ovf): C:\Users\<use_name>\.vagrant.d\boxes\box-cutter-VAGRANTSLASH-centos68-desktop\2.0.21\virtualbox\box.ovf

Before: <Adapter slot="0" enabled="true" MACAddress="084017AA8CEB" type="virtio">

After: <Adapter slot="0" enabled="true" MACAddress="084017AA8CEB" cable="true" type="virtio">

There is a nice thread here

lambodar
  • 3,495
  • 5
  • 34
  • 58
2

Upgrade VirtualBox to 5.1.12

I had the same problem using:

  • VirtualBox 5.0.0
  • Vagrant 1.9.1 (vagrant -v)
  • Test Kitchen 1.14.2 (kitchen -v)
  • centos-7.2

when I was trying to run the following commands:

kitchen create

and

kitchen test

Upgrading Oracle VirtualBox (download + install) to VirtualBox 5.1.12 fixed the problem.


If the upgrade is not a solution for you, you can use the following workaround mentioned by @paulalexandru, but it has the following main disadvantage: you need to make that manual step for every command that you are running.


But it seems that VirtualBox fixed the "Cable Connected" option problem. Now, if you go to Settings > Network > Adapter 1 > Advanced, you can see that the Cable Connected check box is checked by default:

Cable Connected is checked

Community
  • 1
  • 1
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
  • With 5.0.26r108824 I got the "Cable connected" disabled by default on the first of two network interfaces, over a freshly new created box running OpenSuse-42.2. It was not happening on OpenSuse Leap-42.1. But I can't confirm that the issue is with the OS version. – Kamafeather Mar 09 '17 at 16:04
1

This is the same problem that occurred to me. At last we found out that this problem is due to the Linux OS that we are using with Vagrant version is not compatible. So, we took the latest version (i.e. v1.6.3) of Vagrant and updated our OS to point to agent.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-i386-v20131103.box"

Vagrant version 4.3.8 was not working with the below OS. agent.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130731.box".

We exactly got the same issue that shown above.

Raj
  • 11
  • 1
0

For me, enabling virtualization option from BIOS fixed it.

Anonymous
  • 1,658
  • 2
  • 14
  • 19
0

I am using Windows 10.

I solved this problem by following the steps in the note

"If you are using Windows, you may need to enable hardware virtualization (VT-x). It can usually be enabled via your BIOS. If you are using Hyper-V on a UEFI system you may additionally need to disable Hyper-V in order to access VT-x."

0

For me, I have uninstalled Docker-CE in my windows 10 then vagrant worked fine. Also please check this option disabled.

0

with my setup, windows 11, vagrant 2.2.19:

I tried all the suggested solutions on the internet and all of them were useless to me, finally my problem was solved simply by changing the settings of Oracle VM VirtualBox Manager as follows: setting---> system ----> Processor --- -> Uncheck the box PAE / NX.

Nastaran
  • 1
  • 1
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 19 '22 at 12:00
0

Changing the WinRM timeout from 120 seconds to 25 minutes worked for me.

config.winrm.timeout =   1500 
config.vm.boot_timeout = 1500 
mht.haque
  • 185
  • 2
  • 8
0

For me just running

vagrant reload

helped, since it seems that on the first start the box had older version of guest additions. By running vagrant reload, it was able to reboot the box and install newer version, and it started to work. vagrant destroy didn't help since it always had the older guest additions on the first boot.

PHZ.fi-Pharazon
  • 1,479
  • 14
  • 15
0

https://i.stack.imgur.com/gux1t.png

Trying to use gui and still didnt help. Already triying to activate virtual machine on bios, disabled hypervisor.

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 19 '23 at 00:49
-1

With my setup Win10, Vagrant 2.1.2 and Ubuntu 16 while working firewall i have enabled "ufw" for port 80 post which i was facing same problem. Command used as below to enable firewall

ufw enable

ufw 80 allow

I did login in GUI enable mode in Vagrantfile and disabling the same is life saver for me.

ufw disable

Now, just do

vagrant reload

vagarnt ssh
LuFFy
  • 8,799
  • 10
  • 41
  • 59