Laravel Homestead vagrant up times out

11,000

Solution 1

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

Solution 2

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.

Solution 3

I sometimes hang on vagrant up with the error SSH username: private key

try

vagrant halt vagrant up

Solution 4

If it times out on ssh-key authentication it seems to be a host/guest communication error.

To confirm try ssh [email protected]

If it throws an error or times-out again make sure the virtual machine is shut down completely, by running vagrant halt and using the Virtualbox GUI to confirm this.

Under network I sure my adapter was "Cable Connected" and for my host only adapter I set "allow all" for promiscuis mode.

Virtual box Network settings screen

!Virtual box Network settings screen]2

I then ran vagrant up --provision and there was no wait during the authentication between the two.

After the vagrant provisioner script has run you may now vagrant ssh in

Solution 5

I was facing this problem and tried editing it in the VirtualBox Gui but my Homestead machine didn't appear in the list, here's the solution if it doesn't :

VBoxManage list runningvms

find your homestead machine in the list, it'll mostly be labelled "Homestead-x" (For me it was "Homestead-7") then run the following commands :

VBoxManage startvm "homestead-7" --type emergencystop
VBoxManage modifyvm "homestead-7" --cableconnected1 on

Afterwards cd into your homestead folder and you'll notice the machine was aborted, a simple vagrant up will start your machine successfully and without stop. Also consider adding the bit of code provided by @HamptonNorth to your VagrantFile for a permanent fix.

Share:
11,000
Camilo
Author by

Camilo

Been working with JavaScript since May 2019. Previously I worked with PHP.

Updated on June 24, 2022

Comments

  • Camilo
    Camilo almost 2 years

    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.

  • Iannazzi
    Iannazzi about 6 years
    actually i just ran into this problem again, vagrant reload did not work, had to find my original answer to get it back up
  • chazecka
    chazecka about 5 years
    This is for you guys, who where messing up with Hyper-V, Windows feature for installing virtual OSes like Ubuntu, etc. That was my exact case.