Laravel homestead failing on “vagrant up” SSH timeout.

tl;dr:

If “vagrant up” is failing with an SSH library error, add this to your Laravel project’s Vagrantfile:

https://gist.github.com/830684b71b6343016a0f3f9ba22393a1

The longer version

I recently came across this error on macOS Sierra with Virtualbox and vagrant 1.9.1.

When provisioning or vagrant upping a Laravel homestead VM the process would fail with the following message.

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.

Update your Vagrantfile

config.vm.provider “virtualbox” do |v|
    v.gui = true
end

to the Vagrant file showed that the network adapter was taking over 5 minutes to come online, causing Vagrant’s ssh config to timeout. The problem seems to  lie in a missing cableconnected configuration option in the homestead Vagrantfile configuration.

The fix is to add the following configuration to your Homestead Vagrant file:

https://gist.github.com/830684b71b6343016a0f3f9ba22393a1

which allows the Vagrant VM to boot and configure it’s network connections much more quickly.

Problem sorted 🙂

Help other people find this

Leave a Reply

Your email address will not be published. Required fields are marked *