Vagrant / Vaprobash problems on El Capitan - vagrant

Since upgrading to El Cap, I've had constant issues with Vagrant / Vaprobash. This is happening on two different macs, and both have been upgraded with the latest Vagrant and VirtualBox builds.
The VM does get started using vagrant up (at least, if you look at the box in the VirtualBox admin it's running, even though you can't connect to it), but during the startup it times out constantly:
Bringing machine 'Vaprobash' up with 'virtualbox' provider...
==> Vaprobash: Checking if box 'ubuntu/trusty64' is up to date...
==> Vaprobash: Clearing any previously set forwarded ports...
==> Vaprobash: Clearing any previously set network interfaces...
==> Vaprobash: Preparing network interfaces based on configuration...
Vaprobash: Adapter 1: nat
Vaprobash: Adapter 2: hostonly
==> Vaprobash: Forwarding ports...
Vaprobash: 22 => 2222 (adapter 1)
==> Vaprobash: Running 'pre-boot' VM customizations...
==> Vaprobash: Booting VM...
==> Vaprobash: Waiting for machine to boot. This may take a few minutes...
Vaprobash: SSH address: 127.0.0.1:2222
Vaprobash: SSH username: vagrant
Vaprobash: SSH auth method: private key
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
Vaprobash: Warning: Connection timeout. Retrying...
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.
When the box finally "runs", I can't connect to it. If I use VirtualBox to open a terminal, it seems like the connection timeout is a prompt where the VM is waiting for input for a login screen. However, this login should be handled by Vagrant.
Any thoughts on how to resolve this?

After much tearing of hair and grinding of teeth, reinstalling Vagrant, VirtualBox and removing / installing all my box images several times, I finally was able to make this work by totally removing all vagrant data (rm -rf ~/.vagrant.d/), uninstalling the vagrant app (rm -rf /usr/bin/vagrant) and then installing the vagrant app fresh.
Then I executed vagrant up and it regenerated all keys, which finally seemed to do the trick. I had removed and regenerated the keys manually, as well as copying my own id_rsa over the insecure_private_key file in .vagrant.d with no luck-- and reinstalling vagrant without first removing all data will not resolve the problem.
Hope this helps someone else.

is your vagrant file have vb.gui = true ? if not then add like :
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
if this is ok then it may be issue with your ssh key.
you can try following steps:
download private key from here and try to login in vagrant box.
ssh -i privatekey vagrant#ip
or
download private key from here and store somewhere and add below line in vagrant file :
config.ssh.private_key_path="full_path_of_ssh_privatekey"
then try to login using command:
vagrant ssh vmname
or
it may be your vagrant public key is not store in vagrant vm. so you can create shell script test.sh and add following line in test.sh file
mkdir /home/vagrant/.ssh
wget --no-check-certificate -O authorized_keys 'https://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub'
mv authorized_keys /home/vagrant/.ssh
chown -R vagrant /home/vagrant/.ssh
chmod -R go-rwsx /home/vagrant/.ssh
and use shell provisioner in Vagrantfile like :
config.vm.provision :shell, :path => "test.sh"
then provision that vm either
vagrant reload vmname --provision
or you can recreate vm using command
vagrant destroy vmname
vagrant up vmname

Related

Vagrant Monasca VM mounting failed with the error: No such device. Works with sudo

I am trying to create DevStack + Monasca setup on a Ubuntu 14.04 (64 bits) host running on a VirtualMachine.
Using the setup instructions given here: https://github.com/openstack/monasca-vagrant
This is a 2 VM setup - devstack & monasca running on two different VMs.
vagrant is used to setup and provision the whole thing. It first brings
up Devstack VM. During this process mounting shared folders give the output + error:
stack#stack-vm:~/monasca-vagrant$ vagrant up
Bringing machine 'devstack' up with 'virtualbox' provider...
Bringing machine 'mini-mon' up with 'virtualbox' provider...
==> devstack: Checking if box 'monasca/devstack' is up to date...
==> devstack: Clearing any previously set forwarded ports...
==> devstack: Clearing any previously set network interfaces...
==> devstack: Preparing network interfaces based on configuration...
devstack: Adapter 1: nat
devstack: Adapter 2: hostonly
==> devstack: Forwarding ports...
devstack: 22 (guest) => 2222 (host) (adapter 1)
==> devstack: Running 'pre-boot' VM customizations...
==> devstack: Booting VM...
==> devstack: Waiting for machine to boot. This may take a few minutes...
devstack: SSH address: 127.0.0.1:2222
devstack: SSH username: vagrant
devstack: SSH auth method: private key
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
devstack: Warning: Remote connection disconnect. Retrying...
==> devstack: Machine booted and ready!
==> devstack: Checking for guest additions in VM...
==> devstack: Setting hostname...
==> devstack: Configuring and enabling network interfaces...
==> devstack: Mounting shared folders...
devstack: /vagrant => /home/stack/monasca-vagrant
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attemped was:
set -e
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant
The error output from the command was:
: No such device
However, if I ssh into the DevStack VM and use sudo with mount command then the command works fine. Also, I am able to see the contents of shared folder in the guest.
So it seems, 'sudo' is required afterall for mounting the share. However, I am not able to find a way to do it through vagrant.
I tried to select 'auto-mount' from Virtualbox settings but they are also not editable.
Plus I made sure guest additions is installed on the Guest.
Would require and appreciate any help in successfully mounting the folders.
Thanks,
-Arun

Vagrant up stuck

I'm running vagrant up and I'm facing an issue that it seemed to be this one at the beginning Vagrant stuck connection timeout retrying. I've tried all the solutions in there, I also did a vagrant destroy, but as soon as I do vagrant suspend, then the vagrant up command doesn't work, I have to quit and do vagrant reload to get the VM working. It's very annoying and frustrating.
I'm using vagrant homestead version 0.4.4 at the moment and a part of this issue everything works perfectly once the VM is started.
My current system is OSX El Captain.
Let me know if you need more details.
My Vagrantfile:
require 'json'
require 'yaml'
VAGRANTFILE_API_VERSION ||= "2"
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
homesteadYamlPath = "Homestead.yaml"
homesteadJsonPath = "Homestead.json"
afterScriptPath = "after.sh"
aliasesPath = "aliases"
require File.expand_path(confDir + '/scripts/homestead.rb')
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exists? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
end
if File.exists? homesteadYamlPath then
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
elsif File.exists? homesteadJsonPath then
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
end
if File.exists? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath
end
end
Command up output when error:
~/Projects/credentialsApi (feature/10)$vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: A newer version of the box 'laravel/homestead' is available! You currently
==> default: have version '0.4.4'. The latest is version '0.5.0'. Run
==> default: `vagrant box update` to update.
==> default: Resuming suspended VM...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
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.
~/Projects/credentialsApi (feature/10)$
vagrant ssh-config command output:
~/Projects/credentialsApi (development)$vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2204
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile "/Users/pabloleone/Projects/credentialsApi/.vagrant/machines/default/virtualbox/private_key"
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
I finally fixed the issue. It was due to versions. I just upgraded vagrant and the VM.
First of all, try to run vagrant with VAGRANT_LOG=debug variable to debug the issue.
If that won't help, while it's showing you timeout messages, in another terminal run: vagrant status to see whether the VM is running correctly or not. Or run VirtualBox directly from GUI and check the machine state.
If it's running, check whether SSH credentials are correct, by the following command:
vagrant ssh-config
in order to:
check the hostname and port (e.g. 127.0.0.1:2222),
your private key (IdentityFile).
Also try logging in to the VM manually by:
vagrant ssh
or by this command (change default to proper host from above ssh-config command):
vagrant ssh-config > vagrant-ssh && ssh -F vagrant-ssh default
Since it works for you after vagrant reload (so your virtualization support in BIOS is likely enabled), possibly that your SSH server is not started by default on resume due to some issues. You should then check the SSH logs by fixing it via vagrant reload && vagrant ssh and check whether the logs by:
sudo tail /var/log/secure
If that's the case, for workaround to check whether the SSH service is run, add the following line like:
config.vm.provision :shell, run: "always", path: "scripts/check_ssh_service.sh"
Similar issue: Apache doesn't start after Vagrant reload
Finally check the following list for possible solutions to the SSH timeout problem:
Make sure your firewall or antivirus is not blocking the program (which I doubt will happen often)
Give your vagrant machine some time for timeouts to happen. If you dont have a very fast PC / Mac, the VM will take while to boot into an
SSH ready state, so timeouts will happen.
Therefore, first try to let vagrant timeout COMPLETELY before concluding that there is a fault.
If vagrant times out completely then increase the timeout limit in the vagrant file to a few min and try again.
If that still doesnt work, then try to clean boot your vagrant machine through the VirtualBox interface and enable the GUI of the
machine beforehand. If the GUI doesn't show anything happening (ie.
just blackscreen, no text) while it is booting, then your vagrant
machine has got problems.
Destroy the entire machine through the VB interface and reinstall.
Delete the ubuntu image files in the Vagrant Images folder in the user folder and redownload and install.
Do you even have an intel processor that supports 64bit hardware virtualisation? Google it. If you do, make sure there is no setting in
your Bios disabling this feature.
Disable hyper-v feature if you are running windows 7 or 8. Google how to disable.
Make sure you are running through an SSH enabled client. Use Git bash. Download: http://git-scm.com/downloads
Install a 32bit version of ubuntu like trusty32 or precise32. Just change the version in the vagrant file and reinstall vagrant in new
directory.
Make sure you are using the latest vagrant and virtualbox versions.
Last resorts: Format your computer, reinstall windows and buy an intel core isomething processor.
Source: GitHub post by #dezinerdudes
See also: SSH Timeout - Cant connect via ssh no matter what

vagrant stuck at "default: Warning: Connection timeout. Retrying..."

I googling for some days and i do not find any solution to solve my problem.
I pretty sure, This problem not from VT-x because I using bento/ubuntu-14.04-i386 on Windows 8.1 (I guess my CPU allow to use 32bit as guest but 64bit dont C2D E7200)
I clone github repo from laravel/settler and replace config.vm.box = 'bento/ubuntu-14.04' into config.vm.box = 'bento/ubuntu-14.04-i386' on Vagrantfile
And start vagrant with vagrant up and i get this
λ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'bento/ubuntu-14.04-i386'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-14.04-i386' is up to date...
==> default: Setting the name of the VM: settler_default_1446635664316_42330
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 80 => 8000 (adapter 1)
default: 3306 => 33060 (adapter 1)
default: 5432 => 54320 (adapter 1)
default: 35729 => 35729 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
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.
vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile C:/Users/Jame/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
vagrant global-status
id name provider state directory
------------------------------------------------------------------------------------------
87ba96c default virtualbox running C:/Users/Jame/Dropbox/Private/myscript/config/settler
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
and GUI is
Please help, Thank :)
This might have various reasons and it's mostly about private / public keys. You can follow these step to troubleshoot:
1) First of all try if you can ssh with password to make sure that it's about keys. If you can't, then you should first find the reason for that and step 3 would be helpful in that case too.
2) Second thing to do is to find out which private key vagrant is using.
Run vagrant ssh-config and check IdentityFile, in your case this is the default insecure_private_key provided by vagrant.
3) Now run vagrant ssh -- -v which will show you the details of ssh progress, double check the private key that is used. If you see smt. like this at the end you can be sure that server cannot match your public key and that's the problem:
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/ozan/.vagrant.d/insecure_private_key
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: password
vagrant#127.0.0.1's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
vagrant#127.0.0.1's password:
4) ssh your guest with password and check if the public key is ok. You should check the permissions of the ~/.ssh directory and the /.ssh/authorized_keys file. They must be 755 (drwx------) and 600 (-rw-------) respectively and they must be owned by vagrant user.
5) Check that the public key matches your private key. To do so generate the public key from private key like ssh-keygen -f ~/.vagrant.d/insecure_private_key -y on your host and compare it with the one in ~/.ssh/authorized_keys
Also make sure that the keys is in the ~/.ssh/authorized_keys are on a single line, if you do smt. like copy paste it can happen that newline characters are inserted which will obviously break the public key.
And here are some notes about vagrant and homestead which would help:
Normally vagrant replaces this insecure_private_key with some secure one and adjusts everything at startup or halt if config.ssh.insert_key is set totrue in you configuration (which is the default in the latest version 1.7.4). So you might see some path under your .vagrant directory for the IdentityFile.
The problem in my case was, you can define which private key to use in your Homestead.yaml normally, however homestead didn't respect the custom keys for some reason, and vagrant didn't replace the insecure key too...
So I basically generated and copied the public key of the private key that is listed as IdentityFile and put it into authorized_keys which did solve the issue.
After fixing the public key I realized that vagrant replaced the insecure_private_key with some secure one successfuly...

Solution for vagrant installation

i need your help because i have to use cakebox for a project but i have some problems when i type vagrant up i get this error. I tried everything but it did not work.
Thanks in advance !
My-PC MINGW64 /A/App_LeagueUp!/cakebox (dev)
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'cakebox'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: cakebox_default_1444639086577_31058
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
default: Warning: Connection timeout. Retrying...
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.
My recomendation to figure out the problem is to set the
vb.gui flag to true in your Vagrantfile . add run then vagrant up. this will open the console, on a different window. It sometimes happen to me and then i reboot and everything is working fine.
If it doesnt post findings here, at least youll have more info
Try to enable virtualization from your boot menu and try it again.

Vagrant 1.7 SSH authentication failure on OSX – private key not copied to VM

First of all I know this is a duplicate issue but I battled with this issue for about 20 hours as none of other questions's answers were working for me. This is Mac OS X specific question and answer. Virtual provider was VirtualBox 4.3 and 5.0. Vagrant versions 1.7.1 and 1.7.4
This SSH authentication failure kept on happening. If I waited or exited the process I could "vagrant ssh" in without problems, using default password "vagrant". But because this SSH failure happened, it meant that the after boot -scripts were not executed either.
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'laravel/homestead'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Setting the name of the VM: homestead
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 80 => 8000 (adapter 1)
default: 443 => 44300 (adapter 1)
default: 3306 => 33060 (adapter 1)
default: 5432 => 54320 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
default: Warning: Authentication failure. Retrying...
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.
Vagrant 1.7 has this default config set to true: config.ssh.insert_key
Vagrant will automatically insert an keypair to use for SSH, replacing the default Vagrant's insecure key inside the machine if detected. link to Vagrant SSH settings
When after vagrant up I did vagrant ssh-config I could see that the private key path was ~/.vagrant.d/insecure_key – but that key was not copied to inside VM either.
The problem was in that I had somehow messed up my OS X's SSH config. This was apparent when I ran command ssh-add -l to list loaded keys in SSH agent. There was two different keys with the same path! However I cannot confirm this was the main reason for the problem as it had persisted for several days and during which I had made a few reboots.
I made a backup of .ssh folder and copied old config lines and files one by one. Another thing I did was to remove this ill-advised tip to add this line in ~/.ssh/config
Host *
ForwardAgent yes
This practice is strongly recommended against by Github:
Warning: You may be tempted to use a wildcard like Host * to just apply this setting to all SSH connections. That's not really a good idea, as you'd be sharing your local SSH keys with every server you SSH into. They won't have direct access to the keys, but they will be able to use them as you while the connection is established. You should only add servers you trust and that you intend to use with agent forwarding.
Before doing these steps I emptied ~/.vagrant.d folder to make sure I had no previously set up global configs in play. You could also uninstall Vagrant with their uninstall script and then reinstall.
Rebooted. Then I created a new SSH key.
Then vagrant provision or vagrant destroy && vagrant up. This is how I finally got this problem solved!
My solution was while Vagrant was displaying 'default: Warning: Authentication failure. Retrying...'
On my local machine grab the public ssh key and stick it into ~/.ssh/authorized_keys inside vagrant. Which allowed vagrant to ssh into the box seamlessly and continue on provisioning in my case. Wish I knew what caused the hang though. (I also deleted all traces of existing .vagrant and .vagrant.d folders before issuing vagrant up.)
cat ~/.ssh/id_rsa.pub
vagrant ssh
echo 'your-public key' >> ~/.ssh/authorized_keys (or paste it in by hand so you don't accidentally delete any existing keys)

Resources