33

I can't seem to get Homestead running. It hangs at SSH auth method: private key.

The Homestead VM starts. I can go to VirtualBox and open the terminal window and login with vagrant:vagrant.

I can't vagrant ssh, ssh vagrant@127.0.0.1:2204 or ssh vagrant@127.0.0.1 -p 2204.

None of my folders show up in the VM, but the VirtualBox says they are mapped.

Every time I vagrant up, I get:

vagrant up
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
==> homestead-7: Clearing any previously set forwarded ports...
==> homestead-7: Fixed port collision for 80 => 8000. Now on port 2200.
==> homestead-7: Fixed port collision for 443 => 44300. Now on port 2201.
==> homestead-7: Fixed port collision for 3306 => 33060. Now on port 2202.
==> homestead-7: Fixed port collision for 5432 => 54320. Now on port 2203.
==> homestead-7: Fixed port collision for 22 => 2222. Now on port 2204.
==> homestead-7: Clearing any previously set network interfaces...
==> homestead-7: Preparing network interfaces based on configuration...
    homestead-7: Adapter 1: nat
    homestead-7: Adapter 2: hostonly
==> homestead-7: Forwarding ports...
    homestead-7: 80 (guest) => 2200 (host) (adapter 1)
    homestead-7: 443 (guest) => 2201 (host) (adapter 1)
    homestead-7: 3306 (guest) => 2202 (host) (adapter 1)
    homestead-7: 5432 (guest) => 2203 (host) (adapter 1)
    homestead-7: 22 (guest) => 2204 (host) (adapter 1)
==> homestead-7: Running 'pre-boot' VM customizations...
==> homestead-7: Booting VM...
==> homestead-7: Waiting for machine to boot. This may take a few minutes...
    homestead-7: SSH address: 127.0.0.1:2204
    homestead-7: SSH username: vagrant
    homestead-7: SSH auth method: private key
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.

I replaced the homestead insecure private key with my key on my box. I see a lot of people get Warning: Connection timeout. Retrying..., but I don't get that far.

I'm on a mac 10.11.6

Any help would be greatly appreciated!

Scott O-Town
  • 331
  • 1
  • 3
  • 5

12 Answers12

87

I had the same problem on macOS 10.12 today, and lost 6 hours trying to find a fix. Finally, after several reinstallations, reboots, and trial and error, I somehow got it to work by following these steps...

  1. Completely uninstall and reinstall Vagrant, VirtualBox, and Homestead.
  2. Ensure the homestead-7 box is shut down within the VirtualBox UI
  3. Right-click the homestead-7 box, and choose Settings
  4. Click 'Network'
  5. Under 'Adapter 1', which should be attached to NAT, click 'Advanced'
  6. Tick the box beside 'Cable Connected'
  7. Save settings, and reprovision Homestead with vagrant up --provision
  8. Run vagrant reload --provision to reprovision the machine

That should be it! I was able to SSH in after this, but not able to view Homestead sites through the browser (even though I'd configured the /etc/hosts file), but a simple reboot of the Mac seemed to fix this.

Given I don't know what exactly caused this in the first place, this might just be a bit of luck for my case, but let me know how you get on.

Jack
  • 9,615
  • 18
  • 72
  • 112
  • 17
    Steps 3-6 solved the issue for me! You're a life saver @Jack! – schystz Dec 21 '16 at 03:56
  • 9
    Steps 3-6 solved the issue for me - but only temporarily. Destroying and recreating the vm requires steps 3-6 each time. Updating the Vagrantfile in my Homestead dir has been the best solution for me: https://github.com/mitchellh/vagrant/issues/7648#issuecomment-235282382 – Daniel Sposito Jan 06 '17 at 07:51
  • For me, I didn't have to reboot my mac after step 8, but noticed that the virtual machine is stuck at login. I just have to provide the default username and password (vagrant/vagrant) and after I am able to access my sites! Thanks a lot! – schystz Feb 14 '17 at 00:57
  • I'm using VirtualBox 5.0.1, and steps 3-6 do the trick. The link posted by @DanielSposito (https://github.com/mitchellh/vagrant/issues/7648#issuecomment-235282382) is on the money, just put in into your Vagrantfile. – lintuxvi May 03 '17 at 23:58
  • 1
    I logged in just to say thank you! using laravel 5.4 vagrant 1.9.5 virtualbox 5.1.22 – Aditya Jun 08 '17 at 11:25
  • I hit this problem as well, but this spurred me to update to latest VirtualBox and things are looking good. I'm actually testing out Nomad, not Homestead. – Howard M. Lewis Ship Jul 13 '17 at 21:44
13
  1. Open VirtualBox UI and enter the virtual machine.
  2. press Enter key to make system continue to boot.

And then you can see the vagrant up going on.

steven
  • 131
  • 1
  • 2
8

I had this problem. I enabled Vt-x in the bios and it cleared it.

gedq
  • 609
  • 9
  • 20
6

Vagrant 2.1.2

vagrant destroy then vagrant up --provision worked for me.

I have noticed that it usually happens when new version of vagrant released

mixa_ru
  • 573
  • 1
  • 6
  • 12
5

If you are on Windows, you have done everything here and still have trouble, maybe this is the solution you need.

Open the Command Prompt as an administrator. Type the bcdedit command. You may find hypervisorlaunchtype Auto. If that is the case, type bcdedit /set hypervisorlaunchtype off to turn it off. Reboot and try again.

Hope this helps.

alexcomo95
  • 161
  • 2
  • 3
  • 1
    After 3 evenings of troubleshooting, this ended up being the fix for me. Thanks!!! – Swen Aug 10 '21 at 19:59
3

Nothing here worked for me. I got into the situation of SSH auth method: private key because my mac black screened and crashed.

All that worked for me was a vagrant destroy then vagrant up --provision. Beware this will of course trash anything in your VM. but you should be using ephemeral principles anyway...

wired00
  • 13,930
  • 7
  • 70
  • 73
3

Enable "Virtualization Technology" in BIOS settings

Servet
  • 39
  • 2
3

I had to do a fsck. (disclaimer, I typed the commands from memory)

  1. Open VirtualBox UI and enter the virtual machine.
  2. If you see (initramfs), type exit
  3. fsck /dev/mapper/vagrant-vg-root -y
  4. reboot

Go back to your normal terminal and try a:

vagrant halt
vagrant up

For me, things were back to normal from here.

varta
  • 3,296
  • 1
  • 17
  • 18
1

This happened to me all of a sudden after working fine for a while using Homestead v6.4 with virtualbox. To fix, Open VirtualBox - if using - and check the logs there.

I found instructions to manually fsck a directory which fixed the issue

Your directory will likely be different, but mine was

fsck /dev/mapper/homestead--vg-root 

And then select y to fix all of the errors

DanTheMann
  • 165
  • 2
  • 8
0

Try to call vagrant up from CMD with admin rights

a_main
  • 377
  • 1
  • 6
  • 13
0

If you're still stuck, here's something you can quickly rule out:

For me the issue was too little video memory, for some reason in Virtual Box my video memory was set to 4mb, the minimum is 12mb, I set it to 24mb (with vm off) and ran vagrant up again, and it fixed the issue!

CodeJunkie
  • 339
  • 3
  • 16
0

I got this error after installing Docker Desktop for Windows. The two aren't compatible.

run Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor

this will disable hypervisor.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All to enable.

I've found that now Homestead takes a long time to boot, Open VMBox, select homestead and click on Show (green button). Wait until you have the homestead login prompt. Then go back & you can run vagrant ssh into Homestead.

Stevie B
  • 31
  • 3