vagrant icon indicating copy to clipboard operation
vagrant copied to clipboard

Sometimes hangs on "Waiting for VM to boot. This can take a few minutes."

Open jonleighton opened this issue 15 years ago • 95 comments

HI there,

Sometimes (I mean, fairly often, maybe 30-50% of the time for me) vagrant seems to hang on:

Waiting for VM to boot. This can take a few minutes.

I mean possibly it would finish eventually, but I have never waited to potentially infinite length of time to see. It certainly seems to take longer than 'usual', when I do manage to successfully boot.

When this happens, the only thing I can do is poweroff the VM through VBoxManage and try again.

Is there any way I can get more output about what it's doing in order to help debug this?

Cheers

jonleighton avatar Aug 05 '11 09:08 jonleighton

This has happened to me for a while now and I'm not sure what's up.

wsc avatar Aug 05 '11 14:08 wsc

I have noticed the same. It feels very "non-deterministic" in that there is an random chance the VM will just keep thrashing at 100% CPU. I found that when I didn't specify a config.vm.network in the Vagrantfile, there is a much lower chance of the VM entering this state. This makes me think it has something to do with the networking/dhcp configuration. For what it's worth, I also have config.ssh.max_tries = 100.

Were either of you using config.vm.network to specify a specific IP? If so, try commenting it out and see if that works.

pattern avatar Aug 06 '11 03:08 pattern

Same problem here; seems to have started when I updated my lucid32.box to fix #445.

I'm not setting config.vm.network but it does seem network configuration related - to work around it I'm using config.vm.boot_mode = :gui and when it gets stuck, manually logging in to the machine and running sudo /etc/init.d/networking restart.

tomusher avatar Aug 06 '11 13:08 tomusher

This happens to me too:

[mathew@thepixeldeveloper]$ vagrant up
[default] VM already created. Booting if its not already running...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] Cleaning previously set shared folders...
[default] Creating shared folders metadata...
[default] Running any VM customizations...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] Failed to connect to VM!
Failed to connect to VM via SSH. Please verify the VM successfully booted
by looking at the VirtualBox GUI.

I can see the machine has booted with the GUI.

I also tried using the vagrant ssh command when the vagrant up command failed. SSH fails with the following error message:

[mathew@thepixeldeveloper]$ vagrant ssh
ssh_exchange_identification: Connection closed by remote host

Rebooting sudo reboot from the GUI fixes this for me.

Gems

  • vagrant (0.8.6, 0.8.5)
  • virtualbox (0.9.2, 0.9.1, 0.9.0)

Virtualbox

Virtualbox 4.1.2r73507

ThePixelDeveloper avatar Aug 29 '11 14:08 ThePixelDeveloper

bump. I just posted question in a group with a same issue. My vagrant up works only once after reboot/ reinstall Virtual Box.

AlexMikhalev avatar Aug 29 '11 14:08 AlexMikhalev

Quick question, are you guys running boxes built with VeeWee?

ThePixelDeveloper avatar Aug 29 '11 14:08 ThePixelDeveloper

I am not

jonleighton avatar Aug 29 '11 15:08 jonleighton

No, clean vagrant. But I think I found a solution - check your networking settings for Virtual Box. (on Mac command +, then Networking, host only networks. I deleted a host only network which happened to be there and now I can restart my VMs without restarting Mac. Folks if you can confirm verify it, that would be excellent.

AlexMikhalev avatar Aug 29 '11 15:08 AlexMikhalev

I only have one networked device listed (NAT).

@AlexMikhalev You have two networked devices because at some point you enabled the

# Assign this VM to a host only network IP, allowing you to access it
# via the IP.
config.vm.network "33.33.33.10"

option which meant Vagrant created the Host-Only interface.

However, still having just the NAT interface was no improvement for me.

ThePixelDeveloper avatar Aug 29 '11 15:08 ThePixelDeveloper

@ThePixelDeveloper I didn't mean second adapter on VM, but common settings for host only networks in Virtual Box preferences - basically I removed vboxnet0 completely from my host. But it didn't help in truth.

AlexMikhalev avatar Aug 29 '11 16:08 AlexMikhalev

I suspect this is a VirtualBox bug. The networking interface is failing to get an IP address from the DHCP server for whatever reason. Which releases of Virtualbox are we running? I can rule out Virtualbox 4.1.2r73507 already, I'll go backwards until it's "fixed"

ThePixelDeveloper avatar Aug 29 '11 16:08 ThePixelDeveloper

I think it may be related to issue described here: http://blog.techprognosis.com/2011/02/28/how-to-enable-dhcp-in-virtualbox-4.html I have a feeling that DHCP server for NAT addresses broken, but I wasn't able to influence it with commands like: VBoxManage dhcpserver add –netname vboxnet0 –ip 10.0.3.100 –netmask 255.255.255.0 –lowerip 10.0.3.101 –upperip 10.0.3.254 –enable I know it should be for internal network, but I feel that dhcp server for NAT doesn't work or issue incorrect IP addresses.

AlexMikhalev avatar Aug 29 '11 16:08 AlexMikhalev

I don't think it's broken because if it was then you wouldn't be able to get an IP address running sudo dhclient. Lets see ...

  • Is this isolated to Vagrant boxes?
  • Does anyone have problems on the same operating system, but not built with Vagrant/VeeWee?

I have another Ubuntu server I just booted and don't have such problems (it doesn't have the VBadditions). I installed the VBadditions and still no problems there. Very very strange.

ThePixelDeveloper avatar Aug 29 '11 16:08 ThePixelDeveloper

I do not use VeeWee. In my VBox logs difference between successful boot and failed in these lines: 00:00:26.584 NAT: IPv6 not supported 00:00:26.622 NAT: DHCP offered IP address 10.0.2.15 00:00:26.623 NAT: DHCP offered IP address 10.0.2.15
while hang up start finishes at: 00:00:24.642 NAT: IPv6 not supported

I use lucid32 and lucid64 base boxes and both have same issue. This issue is not related to vagrant specifically in my case as I have a same problem trying to start vagrant generated boxes from virtual box GUI - sometimes I get ip (10.0.2.15), sometimes I don't - so I need to run sudo dhclient and get same ip from DHPC server 10.0.2.15. If I start two VM's - one with lucid32 and other with lucid64, they both have same IP - 10.0.2.15 after I will run `sudo dhclient'

AlexMikhalev avatar Aug 29 '11 17:08 AlexMikhalev

update: I downloaded box from http://opscode-vagrant-boxes.s3.amazonaws.com/ubuntu10.04-gems.box - same behaviour, I can start it first time with vagrant up successfully, shut it down, then attempt to start again with vagrant up hangs forever.

AlexMikhalev avatar Aug 29 '11 17:08 AlexMikhalev

This issue is not related to vagrant specifically in my case as I have a same problem trying to start vagrant generated boxes from virtual box GUI

I mean you should try and install and run the operating system without using a vagrant base box.

I have another that works fine, you should try it too, then we can confirm if it's to do with Vagrant or not.

Look at this for the explanation of the 10.0.2.15 IP Address


Edit. I'm out of ideas on this one. I've built a system using box using VeeWee which works as expected, then seemingly fails once it's been compiled into a box and imported into Vagrant. I have no idea what Vagrant does to the image when it's been packaged, maybe something to look into.

ThePixelDeveloper avatar Aug 29 '11 17:08 ThePixelDeveloper

I fixed this for me, or at least I think I did. Start the troubled machine in gui mode, login and execute the following commands as root:

  1. rm /var/lib/dhcp3/* - Removes any existing DHCP leases

Disable automatic udev rules for network interfaces in Ubuntu

  1. rm /etc/udev/rules.d/70-persistent-net.rules
  2. mkdir /etc/udev/rules.d/70-persistent-net.rules

The machine now starts up and has the correct IP address.


Perhaps this has something to do with the different network adapter MAC addresses. The base box would have been built on a VirtualBox instance where the MAC is different to the one that your using now, just a thought.

ThePixelDeveloper avatar Aug 30 '11 00:08 ThePixelDeveloper

ThePixelDeveloper - tried you solution, doesn't work for me on lucid32.

AlexMikhalev avatar Aug 30 '11 20:08 AlexMikhalev

setting gui on and then manually logging in and restarting networking fixed it for me..

rozza avatar Sep 01 '11 13:09 rozza

Had the same issue. I could work around by booting in gui mode, logging in and manually doing


niko avatar Sep 04 '11 15:09 niko