menu

Questions & Answers

Vagrant "Timed out while waiting for the machine to boot" after deleting /project/.vagrant

Problem

I was working with bento/centos7.2 box. I did a vagrant up and while it was booting up, I noticed the box has an update and I instinctively cancelled the operation (which I suggest not to do, ever!). So I went ahead and did vagrant destroy, rm -rf .vagrantjust to be sure (Again, I suggest not to do, ever!). I removed my box by vagrant box remove bento/centos7.2 and did vagrant up and ended up with this:

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.

Environment

  1. Ubuntu 16.04
  2. Vagrant 1.81
  3. Centos 7.2 Box

Things I tried

Following are the threads I have tried:

  1. vagrant + virtualbox Timed out while waiting for the machine to boot
  2. Timed out while waiting for the machine to boot when vagrant up
  3. Vagrant "Timed out while waiting for the machine to boot."

When I enabled the GUI, I realized the box is booting up properly; it's just stuck at login screen(bug in box with ssh?). Screenshot:

enter image description here

Any help is much appreciated.

Comments:
2023-01-17 00:50:24
I believe it's a bug in bento/centos-7.2 box I have added config.vm.box_version = "2.2.9" to revert to old version of box which works fine.
Answers(1) :

There are multiple possibilities that cause this issue:

  1. Try running:

    vagrant reload

This re-installs the guest-additions on the box.

  1. Try opening Virtualbox (GUI interface) and the open the virtualbox (console). The box might for example be

i) waiting for fsck (filesystem check) if it was shutdown uncleanly

ii) login to the box over Virtualbox GUI by using the default username/password (typically vagrant/vagrant) and figure out is the ssh server running on the box or not.

  1. Run

    vagrant ssh-config

and see to what port and by which ssh key it is trying to use. Use them manually e.g.:

ssh -i <identity_key_location> vagrant@localhost -p 2222