Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Homestead vagrant up times out

I'm following the official guide for running Laravel 5.1 on Homestead.

But when I try vagrant up it hangs up at homestead-7: SSH auth method: private key and eventually times out with the message:

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 the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

My SSH keys were generated using ssh-keygen -t rsa -C "you@homestead".

Can't access the machine through vagrant ssh, it outputs ssh_exchange_identification: read: Connection reset by peer.

Tried vagrant destroy and deleting the ~/.homestead folder to start again from scratch but same result.

Using Ubuntu 16.04 64-bit, Vagrant 1.8.4 and VirtualBox 5.0.18. Virtualization is enabled in my computer, other boxes boot up without problems.

like image 654
Camilo Avatar asked Dec 09 '16 16:12

Camilo


2 Answers

Running Win 10 Pro v 1607, VirtualBox 5.0.30, Vagrant 1.9.1 and Homestead 1.0.1.

I had same issues as described. Vagrant up command would run cleanly but hang at the SSH username: private key message. Reinstalled, checked .yaml file, recreated ssh keys - tried all the usual stuff without success.

Finally working when I changed the network setting in my Virtual Box.

  1. Brought up VirtualBox program with windows UI
  2. Clicked on Network - in the 'Adapter 1' tab, then opened up Advanced
  3. Clicked 'Cable Connected' checkbox
  4. At console $ prompt, vagrant halt
  5. then vagrant up

All then worked as expected. Unticked 'cable connected' and again vagrant up hanged. Reset 'cable connected' and vagrant up running correctly again.

The default settings for importing the base Laravel/Homestead box leaves the 'cable connected' setting unchecked/off

See vagrant issue 7648 for some background

If you don't want to keep ticking the cable connected box, the permanent fix is:

Locating the Vagrantfile file in the Homestead folder (probably its file path is ~/Homestead/Vagrantfile), and adding following to the Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| block fixes issue:

config.vm.provider 'virtualbox' do |vb|
    vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
end

With this change to the Vagrantfile vagrant up works on new imported laravel/homestead box

like image 81
HamptonNorth Avatar answered Sep 26 '22 04:09

HamptonNorth


If you are using Windows, you may need to enable hardware virtualization (VT-x). It can usually be enabled via your BIOS. If you are using Hyper-V on a UEFI system you may additionally need to disable Hyper-V in order to access VT-x.

I had virtualization turned on, but in VirtualBox it showed that no, I turned off Hyper-V and it all worked.

like image 45
Илья Зеленько Avatar answered Sep 25 '22 04:09

Илья Зеленько