Have you ever encountered this error?
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.
An error occurred in the underlying SSH library that Vagrant uses. The error message is shown below. In many cases, errors from this library are caused by ssh-agent issues. Try disabling your SSH agent or removing some keys and try again. If the problem persists, please report a bug to the net-ssh project. timeout during server version negotiating
There could be multiple reasons this is happening, and I'll walk through some steps to help diagnose and resolve the problem.
Hashicorp rewrote vagrants internals in version 2, so that errors like this happen less often, and when they do happen, they give better error messages. So if you see this issue, upgrade to version 2 of vagrant
Why Does It Happen?
When Vagrant v1 provisions, it tries to SSH into the virtual machine so that it can change things. It's this attempt to connect to the VM that's failing and generating the error. The Net SSH library used by Vagrant fails, causing the second error that mentions SSH Agents, and the longer error is Vagrants response.
The Vagrant SSH Key
Vagrant tries to authenticate its SSH connection using an insecure private key, but this can go wrong in several ways:
- The virtual machine is still booting
vagrant halt;vagrant upmight fix this, or increasing the timeout
- The current SSH Agent can interfere with the process
export SSH_AUTH_SOCK=""to disable the SSH agent for the current session and retry
- The public key never makes it into the VM's authorised list, and the VM rejects the insecure private keys attempt to connect
If you can run
vagrant sshyou can add the public key manually to the authorised keys list e.g. `
echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > .ssh/authorized_keysBe sure to use the official public key available from Vagrant themselves
If all else fails
Update Guest Additions
There's a vagrant plugin to do this. When the additions are updated, you'll need to turn the box off and on else you'll get cryptic errors mounting filesystems. To install it, run:
vagrant plugin install vagrant-vbguest
A number of Vagrant boxes int eh WordPress world and beyond rely on these plugins:
vagrant plugin install vagrant-hostsupdatervagrant plugin install vagrant-triggersvagrant plugin install vagrant-vbguest
While not free, it is more reliable than Virtualbox
Verify VirtualBox and Vagrant are up to date
Eliminate old bugs as a problem by updating to the latest versions of both. Be sure to check the Virtualbox guest additions are the latest version
Run Vagrant in Debug mode
Most messages are hidden from view, and that might include vital information. Use this command to provision Vagrant with a full verbose log file:
vagrant halt;vagrant up --provision --debug &> vagrant.log
Use User/Password Auth Instead
You can configure Vagrant to use user pass authentication instead of SSH key auth. If you receive these errors but can still SSH into the VM then this may work for you
config.ssh.insert_key = false config.ssh.paranoid = false config.ssh.keys_only = false config.ssh.username = "vagrant" # change as appropriate config.ssh.password = "vagrant"
If you're a fan of going nuclear, these commands will destroy your VM, and the base box, then reprovision twice:
vagrant destroyvagrant box remove precise32vagrant plugin install vagrant-hostsupdatervagrant plugin install vagrant-triggersvagrant plugin install vagrant-vbguestvagrant up --provisionvagrant reload --provision