Timed out while waiting for the machine to boot in vagrant

If you see the following error message, this post shows how to fix the problem.

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.

Naturally, the first thing that would come to your mind would be to increase config.vm.boot_timeout value. This would work if the bottleneck is the boot_timeout. However, if something is hanging, the boot will never complete regardless of the timeout value you set.

Add the following code to see what is happening in the system and where it is getting stuck

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

Do a

vagrant reload

You will see trace of what is happening and where the boot stalled. Since this boot error occurs before provisioning, the problem is not caused by your provisioning code. There is a good chance you will see an error message regarding your VTx. If you see this error, you would need to enable VTx in your machine's BIOS. Restart your machine, hit F2 or F10 to get into your BIOS. In the BIOS settings enable VTx. Save and exit. This should solve your problem.

Technologies: 
Actions: